classloading in Wildfly 9 - java

I am deploying my application to Wildfly 9 and I am getting a strange error that resembles class loading problems. The same war file deploys successfully to Tomcat so I am guessing Wildfly is bundling com.google classes and somehow it is interfering with the bundled libraries in the war file.
First, the error looks like this:
Caused by: java.lang.IllegalAccessError: tried to access method com.google.common.collect.MapMaker.makeComputingMap(Lcom/google/common/base/Function;)Ljava/util/concurrent/ConcurrentMap; from class com.google.inject.internal.Annotations$AnnotationChecker
at com.google.inject.internal.Annotations$AnnotationChecker.<init>(Annotations.java:104)
at com.google.inject.internal.Annotations.<clinit>(Annotations.java:122)
at com.google.inject.Key.ensureRetainedAtRuntime(Key.java:362)
at com.google.inject.Key.strategyFor(Key.java:354)
at com.google.inject.Key.get(Key.java:222)
at org.eclipse.sisu.wire.ParameterKeys.<clinit>(ParameterKeys.java:28)
at org.eclipse.sisu.wire.DependencyAnalyzer.<init>(DependencyAnalyzer.java:92)
at org.eclipse.sisu.wire.ElementAnalyzer.<init>(ElementAnalyzer.java:87)
at org.eclipse.sisu.wire.WireModule.configure(WireModule.java:74)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
at com.google.inject.spi.Elements.getElements(Elements.java:103)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
at com.google.inject.Guice.createInjector(Guice.java:94)
at com.google.inject.Guice.createInjector(Guice.java:71)
at com.google.inject.Guice.createInjector(Guice.java:61)
and I have both guava-16.0.1.jar and sisu-guice-3.1.0-no_aop.jar inside my war file's lib folder.
so I basically need to solve this issue, whether it is a class loading issue or not.

Related

Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet

I am using eclipse neon.3 version and tomcat 8.5.15,I tried to execute simple hello world program using spring mvc but I am getting this issue=>
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet.
It happened only with spring mvc projects,rather than spring mvc,other codes executed successfully. Also mentioned the jar files which I have uploaded.
Please help me.
There is no javax.servlet-api.jar in the classpath. Maybe it is not in tomcat's lib folder.
Try to add this jar to your WEB-INF/lib directory. To download a jar go to https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api/3.1.0
I had the same problem when I first tried to use Tomcat. If you imported HttpServlet class from jakarta.servlet.http try importing it from javax.servlet.http instead, that's what worked for me. Since I used jakarta-servlet-api dependency I expected to find the HttpServlet class in the javax.servlet.http package, however I was wrong.
I extracted the jakarta-servlet-api.jar and saw that the package is called javax.
So I imported HttpServlet from javax.servlet.http instead and it worked fine.

Websphere 8.x not able to identify axis 1.4 jar in WEB-INF/lib

I have built and deployed a war file in websphere 8.5 server. All axis 1.4 related jars are placed in WEB-INF/lib folder. However when I run the application and try to access the code that calls the webservice I get below error. Same war file works fine in TOMCAT 7 server. I do see that axis.jar exist and contains axisfault.class. Please help.
Caused by: java.lang.NoClassDefFoundError: org.apache.axis.AxisFault
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:93)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:170)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:179)
at org.uddi4j.transport.TransportFactory.getTransport(TransportFactory.java:61)
at org.uddi4j.client.UDDIProxy.send(UDDIProxy.java:1940)
at org.uddi4j.client.UDDIProxy.find_service(UDDIProxy.java:888)
at bofasecurity.UDDIHelper.getEndPoint(UDDIHelper.java:70)
at bofasecurity.xxxxSecurityWrapper.buildBofASecurityWrapper(BofASecurityWrapper.java:273)
at bofasecurity.xxxxSecurityWrapper.<init>(BofASecurityWrapper.java:212)
at bofasecurity.xxxxSecurityWrapper$Builder.build(BofASecurityWrapper.java:179)
at com.ml.grci.service.impl.SearchACCLServiceImpl.buildSecWrapper(SearchACCLServiceImpl.java:721)
at com.ml.grci.service.impl.SearchACCLServiceImpl.searchACCL(SearchACCLServiceImpl.java:160)
at com.ml.grci.webapp.action.ACCLSearchAction.execute(ACCLSearchAction.java:233)
... 83 more
Caused by: java.lang.ClassNotFoundException: org.apache.axis.AxisFault
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
This is likely due to a classloader issue. WebSphere 8.5 loads axis.jar (see /deploytool/itp/plugins/org.apache.axis_1.4.0.v201005080400/lib). Would recommend either removing the conflicting jar or changing the class loader policy (PARENT LAST). See how to set java class loader PARENT_LAST
Also not sure if this would help, but if you're trying to do web services using a third party framework there's a very good article on how to do this: http://www.ibm.com/developerworks/websphere/library/techarticles/1001_thaker/1001_thaker.html

websphere 8.5.5 jaxws-rt: java.lang.NoClassDefFoundError: com.sun.xml.ws.spi.ProviderImpl

i have to migrate my ear project from JBoss to WebSphere 8.5.5.
My webService (I use jax-ws) is correctly deployed and I can invoke it with no error, but, when I try to invoke an external webService, i get the following error
java.lang.NoClassDefFoundError: com.sun.xml.ws.spi.ProviderImpl (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:176)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1564)
at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36)
at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95)
at javax.xml.ws.spi.Provider.provider(Provider.java:82)
at javax.xml.ws.Service.<init>(Service.java:56)
jaxws-rt is in WEB-INF/lib directory, and I can use other classes from that library. I tried with a simple:
Class.forName("com.sun.xml.ws.Closeable").getProtectionDomain().getCodeSource().getLocation().getPath()
Wich returns the expected path:
/opt/IBM/WAS8.5_1/AppServer/profiles/AppSrv01_1/installedApps/svr04Cell02_1/MyEar.ear/MyWebService.war/WEB-INF/lib/jaxws-rt-2.1.4.jar
This means that jaxws-rt is in my classpath. So, why can't I see ProviderImpl class?
Thanks in advance

<HTTP> <BEA-101163> <Could not load user defined listener:

I have modified an EAR for Weblogic 10 ( BEA 10 )which is already running on BEA 8..
I am getting the following error while deploying the EAR..
[HTTP:101163]Could not load user defined listener: com.xxx.xxxx.jmx.LifecycleListener java.lang.NoClassDefFoundError: com/tibco/sdk/MException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357) at java.lang.Class.getConstructor0(Class.java:2671) at java.lang.Class.newInstance0(Class.java:321) at java.lang.Class.newInstance(Class.java:303) at weblogic.servlet.internal.WebComponentContributor.getNewInstance(WebComponentContributor.java:187) at weblogic.servlet.internal.WebComponentContributor.createListenerInstance
Have you faced this error ?Please help me...
From the Exception it seems that some library is missing from your ear file. Make sure that com.xxx.xxxx.jmx.LifecycleListener is a valid package and included correctly in your ear.
If you are developing and building the ear with JDeveloper make sure you add this lib in your application resources. If you do this manualy make sure that this lib exists in your WEB-INF/lib folder

NoClassDefFoundError in spring

I wrote a Spring application which runs on Weblogic 10.3. In this application I have some JMS Queue consumers.
Sometimes I got an error when the application is closing or opening (I saw this error in both situation) saying:
java.lang.NoClassDefFoundError: org/springframework/jms/connection/SmartConnectionFactory
at org.springframework.jms.connection.ConnectionFactoryUtils.releaseConnection(ConnectionFactoryUtils.java:72)
at org.springframework.jms.listener.AbstractJmsListeningContainer.refreshSharedConnection(AbstractJmsListeningContainer.java:385)at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:779)
at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:761)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:892)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: org.springframework.jms.connection.SmartConnectionFactory
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:35)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
... 6 more
Why do I get this error and what should I do to solve it?
The version of the spring.jar is 2.5.5
That Exception means that the class is not getting loaded into the JVM. Make sure that the spring.jar is in the Weblogic server's classpath or library folder.
It's all very well that you have this class in your war, but in Weblogic, the war has its own classloader. Since your stack trace shows a JMS listener, I'd ask: where is the listener? If it's in the war, then you have a mystery. But it sure looks as though it's somewhere else, and it's that somewhere else that would be missing this Spring class.

Categories

Resources