users@glassfish.java.net

XA Datasource configured, but not being used.

From: <glassfish_at_javadesktop.org>
Date: Mon, 17 Mar 2008 22:24:34 PST

I'm working with Glassfish, Toplink, and Postgres.

I have a session bean that injects a persistence context and another session bean that also has a persistence context. ie:
[code]
@Stateless
public class AccountManagerEJBBean
        extends SomeBaseClass
        implements SomeApplication.model.AccountManagerEJB
{
    @PersistenceContext
    private EntityManager _manager;
                      
    @EJB
    private ConfigEJB configEJB;
    //The above bean also has a persistence context member.
 
//...etc
[/code]


When I call _manager.persist() , I get the following exception :
[code]
java.lang.IllegalStateException: Local transaction already has 1 non-XA Resource: cannot add more resources.
[/code]


The datasource that this bean is using is configured as an XA datasource. In the Admin Console, under Resources > JDBC > Connection Pools > [myConnectionPool] , the Resouce Type is "javax.sql.XADataSource".
This reflects the configuration specified in my sun-resources.xml
[code]
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.postgresql.ds.PGSimpleDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="jdbc/SomeConnectionPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.XADataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
[/code]


I don't know if this should matter, but the injected EJB (ConfigEJB) is from another module, within the same application, that uses the _same_ datasource.

Does anybody know what I am missing? Why would I be seeing this error from a connection that appears to be set up as an XA Datasource? Any help would be really appreciated.Thanks!
[Message sent by forum member 'dcaudell' (dcaudell)]

http://forums.java.net/jive/thread.jspa?messageID=264526