Hello,

I am working with JBoss 4.0.2 and Informix, and I want to access from a 
Session-Bean with a JDBC-call to the database. Thus I have done the following 
steps:

a) Copied the IBM Informix JDBC Driver 2.21.JC5-file ifxjdbc.jar in the 
directory \server\default\lib.

b) Created a new file named informix-ds.xml in the directory 
\server\default\deploy:


  <local-tx-datasource>
    <jndi-name>InformixDS</jndi-name>
    
<connection-url>jdbc:informix-sqli://server:port//database:INFORMIXSERVER=server</connection-url>
    <driver-class>com.informix.jdbc.IfxDriver</driver-class>
    <user-name>user</user-name>
    password
    
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.InformixExceptionSorter</exception-sorter-class-name>
    <!-- sql to call when connection is created
    <new-connection-sql>some arbitrary sql</new-connection-sql>
      -->
    <!-- sql to call on an existing pooled connection when it is obtained from 
pool 
    <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
      -->

    <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) 
-->
    
       <type-mapping>InformixDB</type-mapping>
    
  </local-tx-datasource>


c) Created a new business-method in the Session-Bean to connect to the 
database. 
At the first try I connected only to the default-database:

Context context = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:DefaultDS");
Connection con = ds.getConnection();
con.close();

This works fine.

d) At the second try I connected to the informix-database without a connection:

Context context = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:InformixDS");

This works, too.

e) At the third try I connected to the informix-database with a connection:

Context context = new InitialContext();
DataSource ds = (DataSource) context.lookup("java:InformixDS");
Connection con = ds.getConnection();
con.close();

Now the problems begun, and the JBoss-server logged 270 error-lines to the 
screen. The first lines looked like the following:

09:49:18,375 WARN  [TransactionImpl] XAException: 
tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=roell/17, BranchQual=, 
localId=17] errorCode=XA_UNKNOWN(0)
org.jboss.resource.connectionmanager.JBossLocalXAException: Error trying to 
start local tx: ; - nested throwable: 
(org.jboss.resource.JBossResourceException: SQLException; - nested throwable: 
(java.sql.SQLException: Transactions not supported)) at 
org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.start(TxConnectionManager.java:657)
at 
org.jboss.tm.TransactionImpl$Resource.startResource(TransactionImpl.java:1952)
at org.jboss.tm.TransactionImpl.enlistResource(TransactionImpl.java:548) at 
org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:436)
 at 
org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:322)
 at 
org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(BaseConnectionManager2.java:583)
 at 
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:450)
 at 
org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:874)
 at 
org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:103)

The Swing-Client, who has connected to the bean, shows me another exception:

org.jboss.tm.JBossTransactionRolledbackException: null; nested exception is: 
org.jboss.tm.JBossRollbackException: Unable to commit, 
tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=roell/17, BranchQual=, 
localId=17] status=STATUS_NO_TRANSACTION; - nested throwable: 
(org.jboss.resource.connectionmanager.JBossLocalXAException: wrong xid in 
commit: expected: null, got: XidImpl[FormatId=257, GlobalId=roell/17, 
BranchQual=1, localId=17]); - nested throwable: 
(org.jboss.tm.JBossRollbackException: Unable to commit, 
tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=roell/17, BranchQual=, 
localId=17] status=STATUS_NO_TRANSACTION; - nested throwable: 
(org.jboss.resource.connectionmanager.JBossLocalXAException: wrong xid in 
commit: expected: null, got: XidImpl[FormatId=257, GlobalId=roell/17, 
BranchQual=1, localId=17]))

f) I have added the <resource-ref> to the ejb-jar.xml and the jboss.xml:

<enterprise-beans>
   
      [CDATA[Description for Access]]
      <display-name>Name for Access</display-name>
      <ejb-name>Access</ejb-name>
      access.interfaces.AccessHome
      access.interfaces.Access
      <ejb-class>access.ejb.AccessBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      <resource-ref>
          Informix-Database
          <res-ref-name>InformixDS</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
        </resource-ref>

   
</enterprise-beans>


  <enterprise-beans>
    
      <ejb-name>Access</ejb-name>
      <jndi-name>ejb/Access</jndi-name>
      
      <resource-ref>
        <res-ref-name>InformixDS</res-ref-name>
        <jndi-name>InformixDS</jndi-name>
        </resource-ref>
    
  </enterprise-beans>

  <resource-managers>
  </resource-managers>


The error is the same like above. Nothing has changed after adding the 
resource-ref-tags.

What's wrong with my approach? I have read a lot of tutorials and other 
threads, but nowhere I can find a solution for my problem.

Would anyone help me, please?

Regards
Oliver


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3883333#3883333

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3883333


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to