0 Replies Latest reply on Oct 31, 2002 2:42 PM by Bill Goss

    Failed to register driver exception

    Bill Goss Newbie

      I'm using JBoss 3.0.3 and am trying to connect to a DB2 database. I'm getting a nested "Failed to register driver for: COM.ibm.db2.jdbc.app.DB2Driver" exception (I won't bore you with the exception listing) when trying to connect to the DB. I've searched the forums for this problem and have followed the steps I found in those searchs, putting db2java.jar in server/default/lib and making sure the DriverClass property was declared on one line. I'm now stumped and am looking for clues from someone smarter than I as to what may be wrong.

      According to the start up log, both my db2-service.xml and db2java.jar deployf course a nested exception and I won't bore you with the complete details. Here are excerpts from the log:

      db2java.jar deployment:

      10:57:47,750 INFO [MainDeployer] Starting deployment of package: file:/C:/jboss/jboss-3.0.3_tomcat-4.1.12/server/default/lib/db2java.jar
      10:57:48,062 INFO [MainDeployer] Deployed package: file:/C:/jboss/jboss-3.0.3_tomcat-4.1.12/server/default/lib/db2java.jar


      db2-service.xml deployment:

      10:57:54,593 INFO [MainDeployer] Starting deployment of package: file:/C:/jboss/jboss-3.0.3_tomcat-4.1.12/server/default/deploy/db2-service.xml
      10:57:54,781 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=DB2DS does not implement any Service methods
      10:57:54,781 INFO [JBossManagedConnectionPool] Creating
      10:57:54,781 INFO [JBossManagedConnectionPool] Created
      10:57:54,781 INFO [JBossManagedConnectionPool] Starting
      10:57:54,796 INFO [JBossManagedConnectionPool] Started
      10:57:54,796 INFO [MainDeployer] Deployed package: file:/C:/jboss/jboss-3.0.3_tomcat-4.1.12/server/default/deploy/db2-service.xml
      .
      .
      .
      10:58:04,171 INFO [MainDeployer] Starting deployment of package: file:/C:/jboss/jboss-3.0.3_tomcat-4.1.12/server/default/deploy/jboss-local-jdbc.rar
      10:58:04,328 WARN [ServiceController] jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper does not implement any Service methods
      10:58:04,328 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=DB2DS does not implement any Service methods
      10:58:04,328 INFO [LocalTxConnectionManager] Creating
      10:58:04,375 INFO [LocalTxConnectionManager] Created
      10:58:04,421 INFO [LocalTxConnectionManager] Starting
      10:58:04,484 INFO [DB2DS] Bound connection factory for resource adapter 'JBossLocalTransaction JDBC Wrapper' to JNDI name 'java:/DB2DS'
      10:58:04,484 INFO [LocalTxConnectionManager] Started




      db2-service.xml (relevent bits):

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


      DB2DS


      <config-property name="ConnectionURL" type="java.lang.String">jdbc:db2:cdsnd</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">enav_db2</config-property>
      <config-property name="Password" type="java.lang.String">3navdb2</config-property>http://www.jboss.org/servlet/JiveServlet/download/144-19597-3735243-767/sos-service.xml



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


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

      <!--embedded mbean-->

      10
      50
      5000
      15
      <!--
      criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports
      reauthentication)-->
      ByContainer


      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

      <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

      java:/TransactionManager
      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer


      jboss-web.xml:

      <?xml version="1.0"?>
      <!DOCTYPE jboss-web>

      <jboss-web>
      <context-root>/</context-root>


      <ejb-name>PASLogin</ejb-name>
      <jndi-name>PASLogin</jndi-name>
      <resource-ref>
      <res-ref-name>jdbc/DataSource</res-ref-name>
      <resource-name>DataSourceRef</resource-name>
      </resource-ref>



      <ejb-name>User</ejb-name>
      <jndi-name>User</jndi-name>
      <resource-ref>
      <res-ref-name>jdbc/DataSource</res-ref-name>
      <resource-name>DataSourceRef</resource-name>
      </resource-ref>


      <resource-managers>
      <resource-manager>
      <res-name>DataSourceRef</res-name>
      <res-jndi-name>java:/DB2DS</res-jndi-name>
      </resource-manager>
      </resource-managers>

      </jboss-web>



      ejb-jar.xml:

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

      <!DOCTYPE ejb-jar PUBLIC
      '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN'
      'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>

      <ejb-jar>
      <display-name>Preventive Alert System</display-name>
      <enterprise-beans>

      PAS Login EJB
      <display-name>PASLogin</display-name>
      <ejb-name>PASLogin</ejb-name>
      <jndi-name>PASLogin</jndi-name>
      com.kaiser.pas.login.beans.PASLoginHome
      com.kaiser.pas.login.beans.PASLoginRemote
      <ejb-class>com.kaiser.pas.login.beans.PASLoginBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-client-jar>PAS.jar</ejb-client-jar>
      <resource-ref>
      <res-ref-name>jdbc/DataSource</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>


      User EJB
      <display-name>User</display-name>
      <ejb-name>User</ejb-name>
      <jndi-name>User</jndi-name>
      com.kaiser.pas.user.beans.UserHome
      com.kaiser.pas.user.beans.UserRemote
      <ejb-class>com.kaiser.pas.user.beans.UserBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-client-jar>PAS.jar</ejb-client-jar>
      <resource-ref>
      <res-ref-name>jdbc/DataSource</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </enterprise-beans>
      </ejb-jar>


      web.xml (relevent bits):

      <ejb-ref>
      <ejb-ref-name>PASLogin</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      PASLoginHome
      PASLoginRemote
      <ejb-link>PASLogin</ejb-link>
      </ejb-ref>

      <ejb-ref>
      <ejb-ref-name>User</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      UserHome
      UserRemote
      <ejb-link>User</ejb-link>
      </ejb-ref>


      Connection code:

      try
      {
      Context jndi=new InitialContext();
      dataSource=(DataSource) jndi.lookup("java:/DB2DS");
      }
      catch (NamingException e)
      {
      throw new EJBException("BaseBeanAdapter could not get JNDI context: "+e);
      }


      Thanks in advance and pardon the rather length post.