Search code examples
javaservletsstrutsstruts-1

Would missing dependency cause servlet fails to initialize in Struts 1.x?


java.lang.NoClassDefFoundError: org/apache/commons/chain/config/ConfigParser

I deployed a Struts 1.x web application on Weblogic 9. Refer to this specific error line, it seem commons-chain-x.x.jar is missing from the build path. I tried with several different versions of commons-chain.jar (1.1 & 1.2) but not helpful. I googled about it for hours as well, can't find any solution. What's the actual issue here? Is the missing .jar actually caused the servlet to initialize properly?

p.s. I know...Struts is long outdated and no longer widely used, but for some reasons I have to. Any help over here would be appreciated.

Library:

enter image description here

Full error log:

Nov 9, 2018 4:00:25 PM org.apache.struts.action.ActionServlet init
SEVERE: Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable.  Most likely, this is due to an incorrect or missing library dependency.
java.lang.NoClassDefFoundError: org/apache/commons/chain/config/ConfigParser
    at org.apache.struts.action.ActionServlet.initChain(ActionServlet.java:1680)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:350)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:278)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
    at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
    at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:507)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1723)
    at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1700)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1620)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2761)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:889)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:333)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:566)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:136)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:104)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:320)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:815)
    at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1222)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:433)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:161)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
    at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
<Nov 9, 2018 4:00:25 PM SGT> <Error> <HTTP> <BEA-101216> <Servlet: "action" failed to preload on startup in Web application: "StrutsExample".
javax.servlet.UnavailableException: org/apache/commons/chain/config/ConfigParser
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:402)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:278)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    Truncated. see log file for complete stacktrace
> 

Solution

  • With reference to this article, clear up WebLogic server cache would helps. So it did according to my issue here. I simply deleted tmp folder and the error now disappeared.

    Weblogic Cache exists in $MW_HOME/user_projects/domains/ccg/servers/AdminServer/tmp I had named my domain ccg. You can replace that with your domain name in the above path.

    p.s. Folders tmp,cache and logs under the path above are safe for deletion.