7 Replies Latest reply on Oct 5, 2001 9:04 AM by chrisr1

    DB2 DataSource Error

    hades11

      Hi.

      My name is Victor Serrato, I'm new JBOSS user, so I
      think it is a common error , but I don't found it in
      the FAQ list.

      I am using DB2 V. 7.1, jdk 1.3, and I added the
      db2java.zip in lib/ext and the fallowing lines in
      tomcat/jboss.jcml

      <!-- DB2 Driver -->

      COM.ibm.db2.jdbc.net.DB2Driver



      org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl
      DB2DS
      jdbc:db2://localhost:8888/hades
      Hades
      Hades


      <!-- End DB2 Driver -->

      When jboss start it produced the fallowing lines :
      ...
      [Configuration] URL set to
      jdbc:db2://localhost:8888/hades in
      DefaultDomain:service=XADataSource,name=DB2
      ...
      [DB2DS] Initializing
      [DB2DS] Initialized
      ...

      [DB2DS] Starting
      [DB2DS] XA Connection pool DB2DS bound to java:/DB2DS
      [DB2DS] Stopped
      [DB2DS] java.lang.NullPointerException
      [DB2DS] at org.opentools.minerva.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSource.java:165)
      [DB2DS] at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:330)
      [DB2DS] at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:93)
      [DB2DS] at java.lang.reflect.Method.invoke(Native Method)
      [DB2DS] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [DB2DS] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [DB2DS] at org.jboss.util.ServiceControl.start(ServiceControl.java:97)
      [DB2DS] at java.lang.reflect.Method.invoke(Native Method)
      [DB2DS] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [DB2DS] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [DB2DS] at org.jboss.Main.(Main.java:217)
      [DB2DS] at org.jboss.Main$1.run(Main.java:121)
      [DB2DS] at java.security.AccessController.doPrivileged(Native Method)
      [DB2DS] at org.jboss.Main.main(Main.java:117)
      [Service Control] Could not start DefaultDomain:service=XADataSource,name=DB2
      [Service Control] java.lang.NullPointerException
      [Service Control] at org.opentools.minerva.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSource.java:165)
      [Service Control] at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:330)
      [Service Control] at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:93)
      [Service Control] at java.lang.reflect.Method.invoke(Native Method)
      [Service Control] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [Service Control] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [Service Control] at org.jboss.util.ServiceControl.start(ServiceControl.java:97)
      [Service Control] at java.lang.reflect.Method.invoke(Native Method)
      [Service Control] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [Service Control] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [Service Control] at org.jboss.Main.(Main.java:217)
      [Service Control] at org.jboss.Main$1.run(Main.java:121)
      [Service Control] at java.security.AccessController.doPrivileged(Native Method)
      [Service Control] at org.jboss.Main.main(Main.java:117)


      Please could anybody tell me any solution for this problem?

      Thanks

      Victor Serrato virrato@yahoo.com

        • 1. Re: DB2 DataSource Error
          nemesis

          I am not experienced on DB2 but I couldn't help but noticing that your JDBC driver class starts with COM. and not com. in your definition

          COM.ibm.db2.jdbc.net.DB2Driver

          Are you sure this is correct? Java is case sensitive so you might be specifiying a "non existent" class!

          Cheers,
          Nemesis

          • 2. Re: DB2 DataSource Error
            stuebe

            I work with the same configuration. You must use the app driver (replace "net" with "app"). That should work fine.

            Good luck

            • 3. Re: DB2 DataSource Error
              hades11

              I removed the reference to InstantDB and DefaultDS in
              jboss.jcml and jboss work OK with DB2.

              Does Anybody know a better solution for this problems?

              • 4. Re: DB2 DataSource Error
                chrisr1

                Hi Victor,

                I have configured up JBoss 2.4.2 - tomcat 4.0 with UDB v7.1 (as per the instructions in the JBOSS documentation) but using the app driver...
                COM.ibm.db2.jdbc.app.DB2Driver

                I was also using the 'org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl' rather than the Minerva version

                Like you, I am also getting the NullPointerException.
                It might be worth getting the source code for the wrapper and sticking some debug on the getConnection() method to see which parameter is null.

                Regards

                • 5. Re: DB2 DataSource Error
                  davidjencks

                  Unfortunately the code to find the connection is not very near where the exception is thrown. Usually this npe means there is something wrong with your config so no db connection can be established.... not very helpful. Setting blocking true makes the pool hang instead, or you can set blocking timeout and get an exception. I wish I knew a better way to diagnose connection problems other than experimentation. Any ideas?

                  • 6. Re: DB2 DataSource Error
                    jwliu

                    check the db2 user and password and port,
                    or the user you create dont have enough permission.

                    • 7. Re: DB2 DataSource Error
                      chrisr1

                      Thanks for all the suggestions but all it turned out to be was my forgetting to copy the db2java.zip file to the lib\ext directory. Teach me to play about with so many versions of JBoss at the same time.
                      Everything starts up fine now so on with deploying petstore to test it all out.