2 Replies Latest reply on Oct 30, 2005 12:37 PM by mnloka

    Unable to set JDBC datasource in 4.0.3

    mnloka

      I have an application written for WAS (WSAD) and is functional. I want to move this application to Jboss (4.0.3).
      I downloaded Jboss, and exported my application to the default/deploy directory after making appropriate changes to config files.



      When I lauch the app, I get the following error:

      08:55:59,733 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:name=jdbc/eafDataSource,service=DataSourceBinding' to JNDI name 'java:jdbc/eafDataSource'

      08:56:00,274 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:name=DefaultDS,service=DataSourceBinding' to JNDI name 'java:DefaultDS'

      08:56:00,554 INFO [A] Bound to JNDI name: queue/A
      08:56:00,554 INFO [B] Bound to JNDI name: queue/B
      08:56:00,554 INFO [C] Bound to JNDI name: queue/C
      08:56:00,554 INFO [D] Bound to JNDI name: queue/D
      08:56:00,554 INFO [ex] Bound to JNDI name: queue/ex
      08:56:00,584 INFO [testTopic] Bound to JNDI name: topic/testTopic
      08:56:00,584 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
      08:56:00,584 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
      08:56:00,584 INFO [testQueue] Bound to JNDI name: queue/testQueue
      08:56:00,634 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.0.0:8093
      08:56:00,674 INFO [DLQ] Bound to JNDI name: queue/DLQ
      08:56:00,784 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:name=JmsXA,service=ConnectionFactoryBinding' to JNDI name 'java:JmsXA'

      08:56:05,281 INFO [TomcatDeployer] deploy, ctxPath=/MinimalWebApp, warUrl=.../tmp/deploy/tmp53002MinimalWebApp-exp.war/

      08:56:05,301 WARN [ServiceController] Problem starting service jboss.web.deployment:id=-35938914,war=MinimalWebApp.war org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: resource-ref: jdbc/eafDataSource has no valid JNDI binding. Check the jboss-web/resource-ref.)

      at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:366)
      at org.jboss.web.WebModule.startModule(WebModule.java:68)
      at org.jboss.web.WebModule.startService(WebModule.java:46)

      Now here are the config files I have
      Db2-ds.xml


      <local-tx-datasource>
      <jndi-name>jdbc/eafDataSource</jndi-name>
      <connection-url>jdbc:db2://127.0.0.1:11041/USMDC0DB2E</connection-url>
      <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
      <user-name>thisisme</user-name>
      password
      <min-pool-size>0</min-pool-size>
      <security-domain>DB2DbRealm</security-domain>

      <!-- sql to call when connection is created
      <new-connection-sql>some arbitrary sql</new-connection-sql>
      -->

      <!-- sql to call on an existing pooled connection when it is obtained from pool
      <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
      -->

      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

      <type-mapping>DB2</type-mapping>

      </local-tx-datasource>


      Standardjaws.xml

      eafDataSource
      <type-mapping>DB2</type-mapping>
      false

      Login-config.xml

      <application-policy name="DB2DbRealm">

      <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required">
      <module-option name="principal">thisisme</module-option>
      <module-option name="userName">password</module-option>
      <module-option name="password"></module-option>
      <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=eafDataSource</module-option>

      </login-module>

      </application-policy>

      Jboss-web.xml

      <jboss-web>
      <resource-ref>
      <res-ref-name>jdbc/eafDataSource</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <jndi-name>java:/env/jdbc/eafDataSource</jndi-name>
      </resource-ref>
      </jboss-web>

      Standardjbosscmp-jdbc.xml


      eafDataSource



      Web.xml

      <resource-ref id="ResourceRef_1103208507527">
      DB Connection
      <res-ref-name>jdbc/eafDataSource</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
      </resource-ref>



      Help please.

        • 1. Re: Unable to set JDBC datasource in 4.0.3
          darranl

          Can you execute the command 'jar -tf warname.war' against your war ane post the output here, initially it looks as if your jboss-web.xml is not being recognised for some reason.

          Also the jndi name of the datasource in the file jboss-web.xml should be 'java:/jdbc/eafDataSource' not 'java:/env/jdbc/eafDataSource'

          • 2. Re: Unable to set JDBC datasource in 4.0.3
            mnloka

            Thanks darranl. The file was not in the jar but in a folder in the deploy directory. I put it in the jar and got it working.

            Thanks again.