This is quite odd behavior. I have a far-fetched theory about it however :-).

I notice that you are using a local xa resource which I think means you are using the generic tranql connector with db2 rather than the db2 specific connector that would use the real XAResource to manange the transaction? This means in particular that: -- suspend/resume don't work, and I'm not sure if they would attempt to throw and exception or just proceed blindly with the previous tx. -- if the application calls connection.commit() that is likely to end the current transaction and (due to j2ca mumbo-jumbo) put the connection in auto-commit.

Now.... on startup, openjpa is likely to do a bunch of metadata analysis of the database, including possibly creating the tables etc for you, but I think at least checking that the mapping it has will work. If it creates the tables, it first looks for a non-jta datasource; if there is none, it tries to use a connection from the jta-datasource, trying to suspend the current tx and working in some other transaction context (I don't remember what exactly). With derby, this just doesn't work in geronimo and you have to supply a non-jta-datasource.

So, I wonder if you have a non-jta-datasource set up properly, and if you don't, what happens if you do set up such a datasource.

Note that you can't construct the entire plan for such a datasource using the console db pool wizard, you have to edit the plan by hand to specify <no-transaction/>.

Please let us know if this is relevant and fixes the problem.

I'd also strongly advise using the db2-specific tranql adapter. I need to release the latest fixed version, but a snapshot is at http://snapshots.repository.codehaus.org/org/tranql/tranql-connector- db2-xa/1.2-SNAPSHOT/tranql-connector-db2-xa-1.2-20080326.214959-2.rar

thanks
david jencks
On Mar 29, 2008, at 2:47 AM, Łukasz Budnik wrote:

Hi All!

I have a very simple EntityFacade SLSB. It basically provide
EntityManager methods plus some additional useful operations,
and logging.

I have a method EntityFacade.executeNamedQueryAsList() which works
fine except one case - in whole system I have one backing bean which
behaves quite weird.

During invocation of EntityFacade.executeNamedQueryAsList() I have a
transaction exception. The exception occurs only during the very first
call to the SLSB! When for example I reload page, my backing bean
invokes SLSB and retrieves
the results without any exception.

Note, that EntityFacade.executeNamedQueryAsList() does not
insert/update/delete records, it simply fetches some data from DB.

This is the stack trace:


08:35:48,203 ERROR [Transaction] Unexpected exception rolling back
[EMAIL PROTECTED]
4d1d; continuing with rollback
javax.transaction.xa.XAException
at org.apache.geronimo.connector.outbound.LocalXAResource.rollback (LocalXAResource.java:88) at org.apache.geronimo.transaction.manager.TransactionImpl.rollbackResour ces(TransactionImpl.java:581) at org.apache.geronimo.transaction.manager.TransactionImpl.rollback (TransactionImpl.java:475) at org.apache.geronimo.transaction.manager.TransactionManagerImpl.rollbac k(TransactionManagerImpl.java:258) at org.apache.openejb.core.transaction.TransactionPolicy.rollbackTransact ion(TransactionPolicy.java:181) at org.apache.openejb.core.transaction.TxRequired.afterInvoke (TxRequired.java:77) at org.apache.openejb.core.stateless.StatelessContainer._invoke (StatelessContainer.java:233) at org.apache.openejb.core.stateless.StatelessContainer._invoke (StatelessContainer.java:188) at org.apache.openejb.core.stateless.StatelessContainer.invoke (StatelessContainer.java:165) at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod (EjbObjectProxyHandler.java:217) at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke (EjbObjectProxyHandler.java:77) at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke (BaseEjbProxyHandler.java:321) at org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke (Jdk13InvocationHandler.java:49)
        at $Proxy62.executeNamedQueryAsList(Unknown Source)
at org.xh.nuntius.web.controllers.docs.FaqController.init (FaqController.java:24) at org.xh.utils.web.lifecycle.phaselisteners.ControllersInitializerPhaseL istener.afterPhase(ControllersInitializerPh
seListener.java:28)
at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListeners After(PhaseListenerManager.java:92) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase (LifecycleImpl.java:107) at org.apache.myfaces.lifecycle.LifecycleImpl.execute (LifecycleImpl.java:76) at javax.faces.webapp.FacesServlet.service (FacesServlet.java:148) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter (ExtensionsFilter.java:147) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206) at org.xh.nuntius.web.filters.SecurityAbuseDetectorFilter.doFilter (SecurityAbuseDetectorFilter.java:26) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206) at org.xh.nuntius.web.filters.CharsetFilter.doFilter (CharsetFilter.java:45) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:175) at org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke (DefaultSubjectValve.java:51) at org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:433) at org.apache.geronimo.tomcat.GeronimoStandardContext $SystemMethodValve.invoke(GeronimoStandardContext.java:396) at org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke (GeronimoBeforeAfterValve.java:47) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:109) at org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:563) at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run (JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.resource.spi.LocalTransactionException: Unable to rollback at org.tranql.connector.jdbc.ManagedXAConnection.localTransactionRollback (ManagedXAConnection.java:123) at org.tranql.connector.AbstractManagedConnection $LocalTransactionImpl.rollback(AbstractManagedConnection.java:197) at org.apache.geronimo.connector.outbound.LocalXAResource.rollback (LocalXAResource.java:86)
        ... 45 more
Caused by: com.ibm.db2.jcc.c.SqlException:
[ibm][db2][jcc][10114][10307] Niepoprawna operacja: jawne wywołanie
instrukcji CO
MIT lub ROLLBACK nie jest dozwolone w trybie zatwierdzania
automatycznego (auto-commit).


^^^^^ in English it says something like this:

incorrect operation: explicit COMMIT or ROLLBACK is not allowed in
auto-commit mode

        at com.ibm.db2.jcc.c.p.rollback(p.java:752)
        at com.ibm.db2.jcc.c.gc.rollback(gc.java:162)
at org.tranql.connector.jdbc.ManagedXAConnection.localTransactionRollback (ManagedXAConnection.java:121)
        ... 47 more
08:35:48,453 ERROR [OpenEJB] The TransactionManager reported an
exception while attempting to rollback the transaction: null
08:35:48,453 ERROR [PhaseListenerManager] Exception in PhaseListener
RESTORE_VIEW(1) afterPhase

any idea what might be wrong?

best regards
Łukasz

Reply via email to