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.
Related
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.
Our web service client in live environment recently got the exception:
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:107)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
at com.sun.proxy.$Proxy146.search(Unknown Source)
....
I've done a lot of search online, including a few posts here at StackOverflow:
Catching webservice exception with CXF: NoClassDefFoundError: SOAPFaultBuilder
Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.internal.ws.fault.SOAPFaultBuilder
And my understanding was our client received a SOAP Fault from the server and it's missing some jar file. So I'm trying to solve the problem by first recreating it.
I created a simple Web Service server project in Eclipse which has a web method throws a simple fault class annotated by #WebFault. Then I created a simple Web Service client project which consumes the web method. The client project doesn't have any additional libraries/jars in its classpath; all it has is the JRE. To my surprise, it didn't throw the NoClassDefFoundError exception! Instead, I got the javax.xml.ws.soap.SOAPFaultException I defined on the server side.
The class SOAPFaultBuilder is indeed in rt.jar in JRE. So the simple web service projects I created probably just work as they should. However, how come the web service client in our live environment throw the NoClassDefFoundError exception? That project definitely has rt.jar in the classpath.
Can anyone please shed some light on this problem? If it's missing some jar files (either from the jaxws RI or Apache CXF or others), why would the super simple client I created didn't throw the error? Both the live environment and my local environment use Java7u51.
I have encountered the same problem and I could subsequently resolve this.
Due to the following error mentioned in the Problem, the underlying cause of the SOAP Fault could not be found.
I followed the steps mentioned in the following link, to identify the reason for NoClassDefFoundError.
http://javarevisited.blogspot.in/2011/06/noclassdeffounderror-exception-in.html
I could find the following errors in my application log:
java.lang.ExceptionInInitializerError
Caused by: java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to com.sun.xml.internal.bind.api.JAXBRIContext
The reason for the above classcast exception is due to conflicting jar files.
rt.jar (this is present in jre classpath)
jaxb-impl-2.0.1.jar (this is present in my application classpath).
I have removed the file jaxb-impl-2.0.1.jar from my classpath and the actual error is gone.
I had the same erorr and I resolved this issue by deleting the jax-impl.jar from the tomcat lib folder. It was a possible conflict of the jaxb jar versions with one of my webapps installed in tomcat.
http://programtalk.com/java/i-was-running-gwt-application-on-tomca/
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
Im following http://www.mkyong.com/spring/spring-quartz-scheduler-example/ to develop a job for my spring app... Im getting the following exception when im trying to run it.
Can anyone tell whats the resolution for this?
Exception in thread "Main Thread" java.lang.NoClassDefFoundError: weblogic/logging/LogEntryFormatter >
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClass0(ClassLoader.java:891)
at java.lang.ClassLoader.loadClass(ClassLoader.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at weblogic.logging.commons.LogImpl.<init>(LogImpl.java:14)
at weblogic.logging.commons.LogFactoryImpl.getInstance(LogFactoryImpl.java:21)
at weblogic.logging.commons.LogFactoryImpl.getInstance(LogFactoryImpl.java:18)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:145)
at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:70)
at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.<init>(AbstractRefreshableConfigApplicationContext.java:45)
at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:59)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:136)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:84)
at com.jobs.RunMeJob.main(RunMeJob.java:10)
Seems like you are using the weblogic common logging mechanism in your app...and missing some jars/classes in your WL classpath. Can you post your classpath?
Also, you might want to try SLF4J for logging (http://www.slf4j.org) which I find so much easier to use (as well as versatile, allowing you to use any underlying logging mechanism, such as popular log4j for example)
If you deployed quartz to your Weblogic domain's lib directory you need to ensure that all of quartz dependencies are also deployed to the same directory.
I solved a similar problem by deploying jcl-over-slf4j and slf4j-api.
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