[jboss-user] jndi for db2 datasource

Aljosa Mohorovic aljosa.mohorovic at gmail.com
Mon Jul 21 14:20:17 EDT 2008


i've can't deploy spring/hibernate application that deploys normally
on websphere, some error related to jndi.
i'm sure it's something stupid but i can't figure it out. any
instructions are appreciated.

Aljosa Mohorovic


20:12:48,612 INFO  [ConnectionFactoryBindingService] Bound
ConnectionManager
'jboss.jca:service=DataSourceBinding,name=jdbc/db2test' to JNDI name
'java:jdbc/db2test'
[...]
20:17:29,011 INFO  [TomcatDeployer] deploy, ctxPath=/db2testWeb,
warUrl=.../tmp/deploy/tmp39160db2testWeb-exp.war/
20:17:29,141 INFO  [[/db2testWeb]] Initializing Spring root
WebApplicationContext
20:17:29,332 ERROR [[/db2testWeb]] Exception sending context
initialized event to listener instance of class
org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'db2testDataSource' defined in ServletContext
resource [/WEB-INF/applicationContext.xml]: Invocation of init method
failed; nested exception is javax.naming.NameNotFoundException: jdbc
not bound
Caused by:
javax.naming.NameNotFoundException: jdbc not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)


[...]jboss-4.2.3.GA$ cat server/default/deploy/db2-jcc-xa-ds.xml
<?xml version="1.0" encoding="UTF-8"?>

<datasources>
    <!--
        IBM DB2 XA driver
        db2jcc.jar
    -->

    <xa-datasource>
        <jndi-name>jdbc/db2test</jndi-name>

        <xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>

        <xa-datasource-property
name="DatabaseName">db2test</xa-datasource-property>
        <xa-datasource-property name="User">user</xa-datasource-property>
        <xa-datasource-property
name="Password">password</xa-datasource-property>

        <!-- Note, as opposed to the Type2 driver, DB2 Type 4 requires
the PortNumber. By default this is 50000-->
        <xa-datasource-property name="PortNumber">50000</xa-datasource-property>

        <!-- Must be set if using multiple DB2 XA resources in same
transaction -->

        <isSameRM-override-value>false</isSameRM-override-value>

        <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
        <metadata>
            <type-mapping>DB2</type-mapping>
        </metadata>

    </xa-datasource>

</datasources>



More information about the jboss-user mailing list