1 Reply Latest reply on Jul 1, 2006 11:55 PM by pearson

    ClassCast EX lookup postgres XADatasSource

    dusty

      Hi there!

      I have a problem on lookup my postgresql (Driver: postgresql-8.1-407.jdbc3.jar) XADataSource within JBoss 3.2.3:

      My postgresqlXA-ds.xml:

      <datasources>
       <xa-datasource>
       <jndi-name>postgresqlXA</jndi-name>
       <track-connection-by-tx/>
       <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
       <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
       <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
       <xa-datasource-property name="DatabaseName">webdb</xa-datasource-property>
       <xa-datasource-property name="User">user</xa-datasource-property>
       <xa-datasource-property name="Password">pass</xa-datasource-property>
       </xa-datasource>
      </datasources>
      


      My test lookup code:
      InitialContext ctx = new InitialContext();
      PGXADataSource ds = (PGXADataSource)
       ctx.lookup("java:/postgresqlXA");
      


      Deployment works fine I quess:

      2006-06-14 08:35:35,562 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/Unify/NXJWork/jboss/server/default/deploy/postgresqlXA-ds.xml
      2006-06-14 08:35:35,578 INFO [org.jboss.resource.connectionmanager.RARDeployment] Started jboss.jca:service=ManagedConnectionFactory,name=postgresqlXA
      2006-06-14 08:35:35,578 INFO [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Started jboss.jca:service=ManagedConnectionPool,name=postgresqlXA
      2006-06-14 08:35:35,578 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/Unify/NXJWork/jboss/server/default/deploy/postgresqlXA-ds.xml
      ...
      2006-06-14 08:35:37,125 INFO [org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.postgresqlXA] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=XATxCM,name=postgresqlXA to JNDI name 'java:/postgresqlXA'
      2006-06-14 08:35:37,125 INFO [org.jboss.resource.connectionmanager.TxConnectionManager] Started jboss.jca:service=XATxCM,name=postgresqlXA


      On lookup the DataSource I got the following ClassCastException:
      2006-06-14 09:04:07,250 FATAL [de.mdsi.web.session] XADataSource getConnection failed
      java.lang.ClassCastException
       at de.mdsi.web.session.basics.BaseSessionBean.getXAConnection(BaseSessionBean.java:194)
      ...
      


      For debug I tried to print the received Class - it was:
      Class=class org.jboss.resource.adapter.jdbc.WrapperDataSource

      I thing it should be the org.postgresql.xa.PGXADataSource ?

      Can you please help my, what I do wrong?