3 Replies Latest reply: Jan 17, 2013 8:14 AM by 935795 RSS

    DataSource unavailable

    935795
      Hello,

      I deployed a web app into weblogic, but unable to reach the datasource.

      The web application has a web.xml and has the following resource configuration
      <!-- Reference for the store datasource -->
      <resource-ref id="STPResourceRef_1">
      <res-ref-name>STPDataSource</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      The weblogic is configured with the following Data Source.
      Data Sources
      Name : STPDataSource
      Type :Generic
      JNDI Name : jdbc/STPStoreDataSource
      Targets : myserver, Server-0

      The JNDI tree has the following entry
      JNDI Tree Structure
      Server-0
      __WL_GlobalJavaApp
      java:global
      javax
      jdbc
      STPStoreDataSource
      weblogic

      And the jndi entry for jdbc/STPStoreDataSource is
      Binding Name: jdbc.STPStoreDataSource
      Class: weblogic.jdbc.common.internal.RmiDataSource_1211_WLStub


      The error I recieve in the server-0.out is
      com.anitesolutions.utils.servlet.config.ConfigDatabaseException: Configuration Error: Datasource undefined - 'STPDataSource'


      The same code works in websphere, but not in weblogic. I tested the Datasource in weblogic if it connects to the DB and it does. The problem is the container is unable to reach the DataSource. I can't figure out what is wrong.
      Your suggestion will be useful.

      Thanks
        • 1. Re: DataSource unavailable
          935795
          hello, can anyone spot an error in my post? Your help will be useful.
          thanks
          • 2. Re: DataSource unavailable
            935795
            Hello,

            I have got a hint. I am migrating an application in Websphere to Weblogic. In Websphere, ibm-web-bnd.xml file handles the binding between the project resource name and the datasource in websphere. The id="STPResourceRef_1" mentioned above is resolved to jdbc/STPStoreDataSource in ibm-web-bnd.xml . The code continues to use ctx.lookup("STPDataSource"). Is there any such binding in Java EE 6 or weblogic specific files? If you can tell me this missing link, my problem will be solved.
            • 3. Re: DataSource unavailable
              935795
              Hello,

              I have found the missing link and want to share with people who would have a similar problem.
              In Websphere, there is a binding file ibm-web-bnd.xmi that binds the jndi value and the resource-ref. In Java EE 6, this is done by a <lookup> sub-element in the resource-ref. I am not sure if there is a similar way in J2EE 1.5. I am hoping that this change will help me deploy in Websphere and Weblogic, as I am using a Java EE standard.

              phew..
              thank god..