0 Replies Latest reply: Nov 18, 2013 5:29 AM by 2efc76f6-e670-4ac4-b4a6-150ab9738bfe RSS

    Data source JNDI lookup fails in Weblogic 12.1.2

    2efc76f6-e670-4ac4-b4a6-150ab9738bfe

      What  is changed in the Weblogic 12.1.2 JNDI handling?

      My EJB 2.1 application has been working fine with Weblogic versions up to 12.1.1, but with version 12.1.2 it is giving the following error at startup:


      weblogic.application.ModuleException: javax.naming.NameNotFoundException: remaining name: comp/env/jdbc/DataSourceAlias

      where jdbc/DatasourceAlias is the res-ref-name of the actual datasource named jdbc/APP_DATASOURCE which is set through the admin console.

       

      The discovery of the datasource is performed by this piece of code :
      ds = initialContext.lookup ("java:comp/env/" + refName)

       

      This is what is failing with Weblogic 12. After some research I found out that in order for the datasource lookup to succeed, I have to :

      1) ignore the subcontext "comp/env" and

      2) use the actual JNDI name "jdbc/APP_DATASOURCE" instead of the reference "jdbc/DataSourceAlias"

       

      However for the EJBs, nothing is changed, they are found in the comp/env subcontext.

       

      Hope this helps someone, or let someone tell me how the migration to Weblogic 12.1.2 is supposed to be done.