[JBoss Portal] - Re: Firts time, installing JBoss Portal, full of errors
by ThomasKundukulam
Hi,
I am using Hibernate SQL Database. I am getting an exception as
"java.sql.SQLException: You cannot commit during a managed transaction!
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:543)
at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:334)
at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:139)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:115)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:53)
at com.example.SessionCounter.testEntity(SessionCounter.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:308)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:104)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
11:04:07,505 INFO [STDOUT] GettING SOME ERRRRRRRRRRRRRRRROOOOOOOOORS
11:04:07,505 ERROR [STDERR] javax.persistence.RollbackException: Error while commiting the transaction
11:04:07,505 ERROR [STDERR] at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:63)
11:04:07,505 ERROR [STDERR] at com.example.SessionCounter.testEntity(SessionCounter.java:83)
11:04:07,505 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:04:07,505 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
11:04:07,505 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
11:04:07,505 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
11:04:07,505 ERROR [STDERR] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
11:04:07,505 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
11:04:07,505 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
11:04:07,505 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
11:04:07,505 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
11:04:07,505 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
11:04:07,505 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
11:04:07,505 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
11:04:07,505 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
11:04:07,505 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
11:04:07,505 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:308)
11:04:07,505 ERROR [STDERR] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:104)
11:04:07,505 ERROR [STDERR] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
11:04:07,505 ERROR [STDERR] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
11:04:07,505 ERROR [STDERR] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
11:04:07,505 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
11:04:07,505 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
11:04:07,505 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
11:04:07,505 ERROR [STDERR] Caused by: org.hibernate.TransactionException: JDBC commit failed
11:04:07,505 ERROR [STDERR] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:130)
11:04:07,505 ERROR [STDERR] at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:53)
11:04:07,505 ERROR [STDERR] ... 33 more
11:04:07,505 ERROR [STDERR] Caused by: java.sql.SQLException: You cannot commit during a managed transaction!
11:04:07,505 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:543)
11:04:07,505 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:334)
11:04:07,505 ERROR [STDERR] at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:139)
11:04:07,505 ERROR [STDERR] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:115)
11:04:07,505 ERROR [STDERR] ... 34 more
My persistence.xml is as follows:
----------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<persistence-unit name="Book3" transaction-type="RESOURCE_LOCAL">
<jta-data-source>java:/DefaultDS</jta-data-source>
org.hibernate.ejb.HibernatePersistence
com.entity.Book
</persistence-unit>
-----------------------------------------------------------------------
My sessin bean code which is invoking the entity bean is as follows:
---------------------------------------------------------------------
public void testEntity() {
System.out.println("--->testEntity");
EntityManager em = null;
try {
em = factory.createEntityManager();
System.out.println("before tx creation");
em.getTransaction().begin();
// tx.begin();
Book book = new Book();
book.setAuthor("Thomas");
book.setTitle("Engineer2");
em.persist(book);
// Long id = 1L;
// Book book1 = (Book) em.find(Book.class, id);
// System.out.println("******************************************");
// System.out.println("author name : " + book1.getAuthor());
// System.out.println("******************************************");
em.getTransaction().commit();
em.close();
System.out
.println("saved the book instance in the table + bookID : ");
} catch (Exception e) {
System.out.println("GettING SOME ERRRRRRRRRRRRRRRROOOOOOOOORS");
e.printStackTrace();
}
}
--------------------------------------------------------------------------
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977419#3977419
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977419
19 years, 7 months
[JBoss Seam] - SeamPhaseListener question for Seam newbie
by whuang
On the SeamPhaseListener class, at the beginning for beforePhase() method, it calls Lifecycle.setPhaseId(event.getPhaseId()). Then at the end of the afterPhase() method, it calls Lifecycle.setPhaseId(null);
What if the call Lifecycle.setPhaseId(null) is omitted or removed from the afterPhase() method, what is the side-affect of this?
I am asking this because I recently integrated Seam into my application which already has some Apache Shale Remoting feature, the Shale remoting features is broken after the Seam integration. I tested a temporary patch by extending the SeamPhaseListener and override the afterPhase() method like this.
@Override
| public void afterPhase(PhaseEvent p_event) {
| super.afterPhase(p_event);
| //Patch for Shale Remoting error
| Lifecycle.setPhaseId(p_event.getPhaseId());
| }
|
Thanks,
Bill
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977417#3977417
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977417
19 years, 7 months