views:

356

answers:

2

Hello,

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

+1  A: 

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.

Poindexter
It is in my war file :) Is there any need for that?
Yusuf Soysal
In that case I'm guessing that you have some sort of startup/shutdown class that calls that before the war file gets loaded. I would manually try putting the jar file in server's classpath or library folder and not just in the war file. Sometimes redundancy is the best solution.
Poindexter
There is no startup or shutdown class that I introduce to Weblogic, but I will give this a shot :)
Yusuf Soysal
A: 

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.

Bryan Loofbourrow
Actually, the listener is in the WAR file and declared as Spring "Message Driven Pojo"
Yusuf Soysal