1 Reply Latest reply: Oct 7, 2011 9:23 AM by Robert.Patrick-Oracle RSS

    porting from Oracle 10g AS to Oracle 11g Weblogic server

    884227
      Hi,

      I am trying to port J2EE applicatin from Oracle 10g AS to Oracle 11g Weblogic Server. I have jsp files which contains sql code embedded to fetch data from the DB. The components used in this application are Java, JSP, Servlets and Stateless session beans.

      I have a commonjar which is used to create DB Connection manager and other common stuff which is present inside web-inf/lib. My application is packaged as an ear and which contains the war and different ejb-project.jar files. When the Stateless bean is trying to call the ConnectionManager class, which is present inside the commonjar inside web-inf/lib, I get InvocationTargetException. When I debugged in Eclipse, I see that that inside ejb the reference ConnectionManager, the variable cannot be resolved. So I guess at runtime, ejb is not able to locate ConnectionManager Class.

      I tried to copy this jar to APP-INF/lib and the same jar is present inside web-inf/lib as well. In that case what happens is the jsp fails with the exception ConnectionManager cannot be resolved.

      How can I make the ejb work by keeping the commonjar inside web-inf/lib alone.

      Any help or suggestions?

      Thanks
      Raj
        • 1. Re: porting from Oracle 10g AS to Oracle 11g Weblogic server
          Robert.Patrick-Oracle
          The classloader hierarchy in WLS looks like this (arrows denote inheritance direction):

          Java bootstrap classloader <- Java CLASSPATH classloader <- WLS $DOMAIN_HOME/lib classloader <- Application (e.g., EAR) classloader <- web app classloader <- single JSP classloader

          The Connection Manager is loaded by the web app classloader while the EJBs are loaded by the application classloader so the EJBs have no visibility to the classes loaded by the child (web app) classloader.

          The simplest fix might be to move the Connection Manager jar file to the EAR file's APP-INF/lib directory.

          One word of caution though, you need to be using WebLogic Server's Data Sources and JDBC connection pooling to make sure that you correct transactional behavior if the application is doing any sort of JTA transaction (regardless of whether the JTA transactions are using XA or not...).

          Hope this helps,
          Robert