4 Replies Latest reply on Feb 15, 2003 4:55 AM by roberto

    db2 datasource configuration

    cummings

      Greetings -

      I'm trying to configure a db2 7.1.0 datasource on Windows 2000 with JBoss 3.0.4. I edited the file db2-service.xml
      and placed it in the directory "..\server\default\deploy\MyApp.war". I then put the file db2java.zip that has the class COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource in the default\lib directory.

      When starting jboss I get lots of exceptions. I've excerpted some below, just as an example - there are a lot of ClassCast, OperationNotSupported and NameNotFound exceptions. Can I use this version of db2 with jboss 3.0.4? Any suggestions appreciated!

      some of the errors:

      14:35:56,937 INFO [WebService] Started
      14:35:56,937 INFO [NamingService] Starting
      14:35:56,937 INFO [NamingService] Starting jnp server
      14:35:57,140 INFO [NamingService] Started jnpPort=1099, rmiPort=0, backlog=50, bindAddress=null, Client SocketFactory=null, Server SocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad093076
      14:35:57,171 ERROR [NamingService] Starting failed
      javax.naming.NameNotFoundException: [IBM][JDBC Driver] CLI0637E java: cannot be found.
      at COM.ibm.db2.jndi.DB2Context.lookup(DB2Context.java:166)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at org.jboss.naming.NamingService.startService(NamingService.java:200)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy0.start(Unknown Source)

      ***********

      14:35:57,187 INFO [SecurityConfig] Starting
      14:35:57,187 INFO [SecurityConfig] Started
      14:35:57,234 INFO [JaasSecurityManagerService] Starting
      14:35:57,250 ERROR [JaasSecurityManagerService] Starting failed
      javax.naming.OperationNotSupportedException: [IBM][JDBC Driver] CLI0626E getNameParser() is not supported in this version of DB2 JDBC 2.0 driver.
      at COM.ibm.db2.jndi.DB2Context.getNameParser(DB2Context.java:401)
      at javax.naming.InitialContext.getNameParser(InitialContext.java:432)
      at org.jboss.security.plugins.JaasSecurityManagerService.startService(JaasSecurityManagerService.java:207)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
      at java.lang.reflect.Method.invoke(Native Method)

      ***************************

      14:35:57,250 INFO [TransactionManagerService] Starting
      14:35:57,296 ERROR [TransactionManagerService] Starting failed
      java.lang.ClassCastException: javax.naming.Reference
      at COM.ibm.db2.jndi.DB2Context.bind(DB2Context.java:219)
      at javax.naming.InitialContext.bind(InitialContext.java:358)
      at org.jboss.tm.TransactionManagerService.bindRef(TransactionManagerService.java:188)
      at org.jboss.tm.TransactionManagerService.startService(TransactionManagerService.java:96)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:398)
      at org.jboss.system.ServiceController.start(ServiceController.java:418)
      at java.lang.reflect.Method.invoke(Native Method)

        • 1. Re: db2 datasource configuration

          i'm using DB2 7.x with no problem... but i'm using COM.ibm.db2.jdbc.app.DB2Driver not DB2ConnectionPoolDataSource as you.

          and i put db2-service.xml in "..\server\default\deploy", not "..\server\default\deploy\MyApp.war".

          you can see ad example of db2-service.xml under "<jboss dir>\docs\examples\jca"

          bye

          • 2. Re: db2 datasource configuration
            cummings

            Roberto - thanks - I now use the same driver class and moved the file db2-service.xml to the deploy dir. So far still not working though - here's an excerpt from the file. My datasource name is TWDB2 - does anything appear to be wrong with the xml below? Also, are there any other files that need to be modified (other than db2-service.xml and standardjbosscmp-jdbc.xml) for jboss to startup?

            Another possible problem is my driver - what driver are you using? Mine came with db2 and is the file db2java.zip (1,293 KB).

            <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=DB2DS">
            jdbc/TWDB2


            <config-property name="ConnectionURL" type="java.lang.String">jdbc:db2:TWDB2</config-property>
            <config-property name="DriverClass" type="java.lang.String">COM.ibm.db2.jdbc.app.DB2Driver</config-property>
            <!--set these only if you want only default logins, not through JAAS -->
            <config-property name="myLogin" type="java.lang.String"></config-property>
            <config-property name="myPassword" type="java.lang.String"></config-property>


            <!--Below here are advanced properties -->
            <!--hack-->
            <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper

            • 3. Re: db2 datasource configuration
              cummings

              Looks as though my db2 jdbc driver is a problem - what driver are you using and where did you get it?

              Thanks,

              Charles

              • 4. Re: db2 datasource configuration

                try this:
                <?xml version="1.0" encoding="UTF-8"?>


                <depends optional-attribute-name="ManagedConnectionFactoryName">
                <!--embedded mbean-->


                TWDB2DS


                <config-property name="ConnectionURL" type="java.lang.String">jdbc:db2:TWDB2</config-property>
                <config-property name="DriverClass" type="java.lang.String">COM.ibm.db2.jdbc.app.DB2Driver</config-property>
                <!--set these only if you want only default logins, not through JAAS -->
                <config-property name="UserName" type="java.lang.String">YOUR USER ID</config-property>
                <config-property name="Password" type="java.lang.String">YOUR PASSWORD</config-property>


                <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper


                <depends optional-attribute-name="ManagedConnectionPool">

                0
                50
                5000
                15
                ByContainer


                <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager
                <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager
                java:/TransactionManager
                jboss.jca:service=RARDeployer




                I use the same db2java.zip (coming with ibm db2 7 with last fix).

                bye