Announcement Announcement Module
Collapse
No announcement yet.
Classpath issue in a Weblogic environment with separate apps Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Classpath issue in a Weblogic environment with separate apps

    I am seeing class definition and/or class version errors relating to the classloader with regarding to some of the JOS support classes that Hibernate/Spring uses, such as Jakarta commons logging, as an example. Our situation is that we have two applications (each exist in its own JVM) that call each other. Each use Hibernate to do persistence to their own databases. Intermittently, I see these errors when I have the hibernate.jar and the supporting .jars in each application's app-inf/lib's. However, if I move the .jars to the server classpath then the issues go away.

    This configuration is not optimal because one application may use a latter version of the .jars and then this would require regression testing for all apps that use Hibernate and the associated .jars on the server.

    In general, I am wondering how others have configured their .jars. Is this something you just have to live with?? Or is there a viable solution to have the .jars live in each application?

    Thanks,
    Lou

  • #2
    What kind of errors are you getting?

    You're right: don't put those classes on the server's classpath, eventually you will run into trouble!

    Are you using ear files with beans-jars in them? If so, have you correctly configured the jar's manifest file (using Classpath: entries?)

    rgds,
    Alef

    Comment


    • #3
      Thanks Alef for your response. I get the error below or I'll get the NoClassDefFoundError when I know the classes is in the classpath, as this is an intermittent issue. However, once it happens, it continues to happen.

      The thing I don't understand is that it says there is a version conflict, but in BEA I am pretty sure that each application has a separate class loader so I'm not sure why this "versioning" error comes up. Any suggestions would be greatly appreciated.

      Thanks,
      Lou

      Code:
      Object=org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynchronization@2b04839, Exception=java.lang.ExceptionInInitializerError
      java.lang.ExceptionInInitializerError
      	at net.sf.hibernate.util.JDBCExceptionReporter.logWarnings(Ljava.sql.SQLWarning;)V(JDBCExceptionReporter.java:???)
      	at net.sf.hibernate.impl.BatcherImpl.closeConnection(Ljava.sql.Connection;)V(BatcherImpl.java:297)
      	at net.sf.hibernate.impl.SessionImpl.disconnect()Ljava.sql.Connection;(SessionImpl.java:3352)
      	at net.sf.hibernate.impl.SessionImpl.close()Ljava.sql.Connection;(SessionImpl.java:576)
      	at org.springframework.orm.hibernate.SessionFactoryUtils.doClose(Lnet.sf.hibernate.Session;)V(SessionFactoryUtils.java:651)
      	at org.springframework.orm.hibernate.SessionFactoryUtils.closeSessionOrRegisterDeferredClose(Lnet.sf.hibernate.Session;Lnet.sf.hibernate.SessionFactory;)V(SessionFactoryUtils.java:640)
      	at org.springframework.orm.hibernate.SessionFactoryUtils.access$300(Lnet.sf.hibernate.Session;Lnet.sf.hibernate.SessionFactory;)V(SessionFactoryUtils.java:86)
      	at org.springframework.orm.hibernate.SessionFactoryUtils$SpringSessionSynchronization.beforeCompletion()V(SessionFactoryUtils.java:776)
      	at org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynchronization.afterCompletion(I)V(SessionFactoryUtils.java:874)
      	at weblogic.transaction.internal.ServerSCInfo.callAfterCompletions(I)V(ServerSCInfo.java:853)
      	at weblogic.transaction.internal.ServerTransactionImpl.callAfterCompletions()V(ServerTransactionImpl.java:2708)
      	at weblogic.transaction.internal.ServerTransactionImpl.afterCommittedStateHousekeeping()V(ServerTransactionImpl.java:2606)
      	at weblogic.transaction.internal.ServerTransactionImpl.setCommitted()V(ServerTransactionImpl.java:2638)
      	at weblogic.transaction.internal.ServerTransactionImpl.globalRetryCommit(II)V(ServerTransactionImpl.java:2436)
      	at weblogic.transaction.internal.ServerTransactionImpl.globalCommit()V(ServerTransactionImpl.java:2365)
      	at weblogic.transaction.internal.ServerTransactionImpl.internalCommit()V(ServerTransactionImpl.java:278)
      	at weblogic.transaction.internal.ServerTransactionImpl.commit()V(ServerTransactionImpl.java:244)
      	at weblogic.ejb20.internal.BaseEJBObject.postInvoke(Lweblogic.ejb20.internal.InvocationWrapper;Ljava.lang.Throwable;)V(BaseEJBObject.java:299)
      	at weblogic.ejb20.internal.StatelessEJBObject.postInvoke(Lweblogic.ejb20.internal.InvocationWrapper;Ljava.lang.Throwable;)V(StatelessEJBObject.java:140)
      	at com.bea.wlw.runtime.core.bean.SyncDispatcher_k1mrl8_EOImpl.invoke(Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.request.Response;(SyncDispatcher_k1mrl8_EOImpl.java:110)
      	at com.bea.wlw.runtime.core.dispatcher.Dispatcher.remoteDispatch(Lcom.bea.wlw.runtime.core.dispatcher.DispFile;Lcom.bea.wlw.runtime.core.request.Request;)Lcom.bea.wlw.runtime.core.request.Response;(Dispatcher.java:161)
      	at com.bea.wlw.runtime.core.dispatcher.Dispatcher.dispatch(Lcom.bea.wlw.runtime.core.dispatcher.DispFile;Lcom.bea.wlw.runtime.core.request.Request;Ljavax.servlet.http.HttpServletResponse;Ljavax.servlet.ServletContext;)V(Dispatcher.java:49)
      	at com.bea.wlw.runtime.core.dispatcher.HttpServerHelper.executePostRequest(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;Ljavax.servlet.ServletContext;Ljavax.servlet.ServletConfig;)V(HttpServerHelper.java:713)
      	at com.bea.wlw.runtime.core.dispatcher.HttpServer.doPost(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(HttpServer.java:49)
      	at javax.servlet.http.HttpServlet.service(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(HttpServlet.java:760)
      	at javax.servlet.http.HttpServlet.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(HttpServlet.java:853)
      	at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(ServletStubImpl.java:996)
      	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(ServletStubImpl.java:419)
      	at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(ServletStubImpl.java:315)
      	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6456)
      	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(AuthenticatedSubject.java:321)
      	at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
      Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
      	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(Ljava.lang.String;)Lorg.apache.commons.logging.Log;(LogFactoryImpl.java:543)
      	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(Ljava.lang.String;)Lorg.apache.commons.logging.Log;(LogFactoryImpl.java:235)
      	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(Ljava.lang.Class;)Lorg.apache.commons.logging.Log;(LogFactoryImpl.java:209)
      	at org.apache.commons.logging.LogFactory.getLog(Ljava.lang.Class;)Lorg.apache.commons.logging.Log;(LogFactory.java:351)
      	at net.sf.hibernate.util.JDBCExceptionReporter.<clinit>&#40;&#41;V&#40;JDBCExceptionReporter.java&#58;12&#41;
      	at jrockit.vm.RNI.getRunnableCode&#40;I&#41;I&#40;Unknown Source&#41;
      	at jrockit.vm.RNI.trampoline&#40;&#41;V&#40;Unknown Source&#41;
      	at net.sf.hibernate.util.JDBCExceptionReporter.logWarnings&#40;Ljava.sql.SQLWarning;&#41;V&#40;JDBCExceptionReporter.java&#58;???&#41;
      	at net.sf.hibernate.impl.BatcherImpl.closeConnection&#40;Ljava.sql.Connection;&#41;V&#40;BatcherImpl.java&#58;297&#41;
      	at net.sf.hibernate.impl.SessionImpl.disconnect&#40;&#41;Ljava.sql.Connection;&#40;SessionImpl.java&#58;3352&#41;
      	at net.sf.hibernate.impl.SessionImpl.close&#40;&#41;Ljava.sql.Connection;&#40;SessionImpl.java&#58;576&#41;
      	at org.springframework.orm.hibernate.SessionFactoryUtils.doClose&#40;Lnet.sf.hibernate.Session;&#41;V&#40;SessionFactoryUtils.java&#58;651&#41;
      	at org.springframework.orm.hibernate.SessionFactoryUtils.closeSessionOrRegisterDeferredClose&#40;Lnet.sf.hibernate.Session;Lnet.sf.hibernate.SessionFactory;&#41;V&#40;SessionFactoryUtils.java&#58;640&#41;
      	at org.springframework.orm.hibernate.SessionFactoryUtils.access$300&#40;Lnet.sf.hibernate.Session;Lnet.sf.hibernate.SessionFactory;&#41;V&#40;SessionFactoryUtils.java&#58;86&#41;

      Comment


      • #4
        Originally posted by Alef Arendsen
        Are you using ear files with beans-jars in them? If so, have you correctly configured the jar's manifest file (using Classpath: entries?)
        Alef - could you ellaborate on this? I wasn't aware you need to muck with the manifest files in open source jars to get them to load correctly. Please let me know.

        Thanks,
        Lou

        Comment


        • #5
          nearly 5 years later and I am running into this issue in Weblogic 10.0.
          Anyone know the solution (apart from dropping the commons-logging jar into the domain classpath...)

          Comment

          Working...
          X