Getting NoClassDefFoundError when deploying application on Tomcat 8.0 server

Kuldeep Jain :

I am trying to deploy our application through war file to Tomcat on a new server (RHEL 6.9) and ran into java.lang.NoClassDefFoundError: com/ibm/security/certclient/util/PkSsCertFactory. We have deployed the same application version on other existing servers and there is no issue on those.

This is a new server and we are deploying this war for the first time. We do have some custom libraries under ***/Tomcat8/catalinabasedirs/catalinabase0/customlib and have ensured that the version of the jar files under it are same as our other existing servers.

To give more context this application talks to other EJB apps and the mentioned bean ApplicationNameServiceMonitor is to check connectivity to one of the EJB applications.

I am trying to get the jar file containing this class and dig into it to troubleshoot further, meantime thought of posting the question here to get some help.

Following are the details:

Tomcat version: 8.0.x
Java Home: ***/Tomcat8/reference/jdk1.7.0_121/jre
JVM Version: 1.7.0_121-b32

Spring app context file containing this bean>> resources/appcheck/monitor.xml

<beans profile="xyz,abc,applicationname">
    <bean id="ApplicationNameServiceMonitor" class="com.mycomany.bbs.group.xy.monitor.MonitorFactory" factory-method="createMonitor" init-method="registerMonitor" c:type="wasejb">
        <property name="disable" value="${applicationnameservice.monitor.disable}" />
        <property name="service" value="${applicationnameservice.name}" />
        <property name="contextFactory" value="${applicationnameservice.ejb.jndi.factory}" />
        <property name="url" value="${applicationnameservice.ejb.jndi.url}" />
        <property name="version" value="#{'${applicationnameservice.ejb.address}'.substring(8,16).replace('/','.') + '${applicationnameservice.ejb.address}'.substring(16)}" />
        <property name="ejbs" value="#{'${applicationnameservice.monitor.services}'.split(',')}" />
        <property name="monitorSecurityConfig" ref="monitorSecurityConfigBean"/>
    </bean>
</beans>

Stacktrace

Message Key:CWPKI0043E: Error creating a chained certificate.  The exception that occurred is: java.lang.NoClassDefFoundError: com/ibm/security/certclient/util/PkSsCertFactory. not found in resource bundle:com.ibm.ws.ssl.resources.ssl
org.mule.api.config.ConfigurationException: Error creating bean with name 'ApplicationNameServiceMonitor' defined in class path resource [appcheck/monitor.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/ibm/security/certclient/util/PkSsCertFactory (org.mule.api.lifecycle.InitialisationException)
        at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49)
        at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
        at org.mule.context.DefaultMuleContextFactory$2.configure(DefaultMuleContextFactory.java:108)
        at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:222)
        at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:103)
        at org.mule.config.builders.MuleXmlBuilderContextListener.createMuleContext(MuleXmlBuilderContextListener.java:165)
        at org.mule.config.builders.MuleXmlBuilderContextListener.initialize(MuleXmlBuilderContextListener.java:94)
        at org.mule.config.builders.MuleXmlBuilderContextListener.contextInitialized(MuleXmlBuilderContextListener.java:70)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4884)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5347)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:973)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1849)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name 'ApplicationNameServiceMonitor' defined in class path resource [appcheck/monitor.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/ibm/security/certclient/util/PkSsCertFactory
        at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:112)
        at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:177)
        at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:100)
        at org.mule.config.builders.WebappMuleXmlConfigurationBuilder.doConfigure(WebappMuleXmlConfigurationBuilder.java:79)
        at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43)
        ... 20 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ApplicationNameServiceMonitor' defined in class path resource [appcheck/monitor.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/ibm/security/certclient/util/PkSsCertFactory
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1589)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:554)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
        at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:108)
        at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:104)
        ... 24 more
Caused by: java.lang.NoClassDefFoundError: com/ibm/security/certclient/util/PkSsCertFactory
        at com.ibm.ws.ssl.config.CertificateManager.selfSignedCertificateCreate(CertificateManager.java:212)
        at com.ibm.ws.ssl.config.CertificateManager.chainedCertificateCreate(CertificateManager.java:345)
        at com.ibm.ws.ssl.config.KeyStoreManager.checkIfClientKeyStoreAndTrustStoreExistsAndCreateIfNot(KeyStoreManager.java:1432)
        at com.ibm.ws.ssl.config.SSLConfigManager.addSSLConfigToMap(SSLConfigManager.java:3135)
        at com.ibm.ws.ssl.config.SSLConfigManager.addSSLConfigToMap(SSLConfigManager.java:3113)
        at com.ibm.ws.ssl.config.SSLConfigManager.parseSSLConfigURL(SSLConfigManager.java:3032)
        at com.ibm.ws.ssl.config.SSLConfigManager.initializeClientSSL(SSLConfigManager.java:420)
        at com.ibm.websphere.ssl.JSSEHelper.getInstance(JSSEHelper.java:308)
        at com.ibm.ws.security.orbssl.WSSSLClientSocketFactoryImpl$1.run(WSSSLClientSocketFactoryImpl.java:200)
        at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
        at com.ibm.ws.security.orbssl.WSSSLClientSocketFactoryImpl.createSSLSocket(WSSSLClientSocketFactoryImpl.java:198)
        at com.ibm.ws.orbimpl.transport.WSSSLTransportConnection.createSocket(WSSSLTransportConnection.java:236)
        at com.ibm.CORBA.transport.TransportConnectionBase.connect(TransportConnectionBase.java:344)
        at com.ibm.ws.orbimpl.transport.WSTransport$1.run(WSTransport.java:503)
        at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
        at com.ibm.ws.orbimpl.transport.WSTransport.getConnection(WSTransport.java:500)
        at com.ibm.CORBA.transport.TransportBase.getConnection(TransportBase.java:180)
        at com.ibm.rmi.iiop.TransportManager.get(TransportManager.java:97)
        at com.ibm.rmi.iiop.GIOPImpl.getConnection(GIOPImpl.java:134)
        at com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:228)
        at com.ibm.rmi.corba.ClientDelegate.locate(ClientDelegate.java:1738)
        at com.ibm.rmi.corba.ClientDelegate._createRequest(ClientDelegate.java:1763)
        at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1054)
        at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1131)
        at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1506)
        at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1032)
        at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1472)
        at com.ibm.rmi.corba.ClientDelegate.request(ClientDelegate.java:1657)
        at com.ibm.CORBA.iiop.ClientDelegate.request(ClientDelegate.java:1428)
        at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:449)
        at com.ibm.WsnBootstrap._WsnNameServiceStub.getProperties(_WsnNameServiceStub.java:38)
        at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1550)
        at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:1043)
        at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:963)
        at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:615)
        at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:128)
        at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:765)
        at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:164)
        at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
        at javax.naming.InitialContext.lookup(InitialContext.java:411)
        at com.mycomany.bbs.group.xy.monitor.ejb.WASEjbSubSystemMonitor.<init>(WASEjbSubSystemMonitor.java:91)
        at com.mycomany.bbs.group.xy.monitor.ejb.WASEjbServiceMonitor.registerMonitor(WASEjbServiceMonitor.java:32)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1719)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1656)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1585)
        ... 35 more
Kuldeep Jain :

Resolved the issue. This turned out to be totally different issue. The path to the jks file which we were referring to as keystore and truststore in our jvm argument was incorrect and that cause the code flow to go through the exceptional scenario where it tried to load certain class (that's what I concluded) and the jar for which was missing causing the exception. Since the pom dependency for the aforementioned jar was specified as provided it never complains in build etc. and failed only for this particular scenario occurred.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=166281&siteId=1