we are using ppas9.3 database and hibernate3 in our project. We are using a method that is already calling two other methods. In one method we are executing 'select' query(that becomes fail to execute because that 'column doesn't exist'
) and after closing this connection(i.e. jdbc connection) we are calling second method that is executing after first becomes fails and this time we are taking connection by using 'HibernateUtils.getCurrentSession().connection'
and when executing select query(that is executing successfully in database) then getting following error:-
BasicAction: a0028c9:d2ba:53c51ef5:6e4 status: ActionStatus.ABORT_ONLY > cannot proceed STATUS_MARKED_ROLLBACK; - nested throwable: (javax.tra
nsaction.RollbackException: Transaction TransactionImple < ac, BasicAction: a0028c9:d2ba:53c51ef5:6e4 status: ActionStatus.ABORT_ONLY > cannot proceed STATUS
_MARKED_ROLLBACK)
18:14:08,475 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
javax.ejb.EJBTransactionRolledbackException: [2] An exception has occurred: ERROR: current transaction is aborted, commands ignored until end of transaction
block
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
at org.jboss.aspects.tx.TxInterceptor$Supports.invoke(TxInterceptor.java:148)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:81)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
at $Proxy145.checkHistory(Unknown Source)
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:597)
at com.datagenic.infra.WebServiceAdapterInterceptor.executeCall(WebServiceAdapterInterceptor.java:178)
at com.datagenic.infra.WebServiceAdapterInterceptor.intercept(WebServiceAdapterInterceptor.java:82)
at sun.reflect.GeneratedMethodAccessor375.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
and when first statement is not throwing any error then second is also working fine. what i checked is:- 1. I used a savepoint before execution of first statement and rollback to that savepoint if error comes. 2. Tried to rollback without savepoint. but every time getting error in second method. Method Code is:-
private String buildItems() {
try {
loadItemsForInfos();
addItems();
} catch (RuntimeException e) {
e.getPrintStack();
}
}
1st Method is:-
public void loadValueForInfos(){
ResultSet rs = null;
Connection conn = getDSConnection(); // we are taking connection through JNDI name.
PreparedStatement pst = conn.prepareStatement("select * from items where id = ?")//this query by default fails to execute.
pst.setObject(1,12);
try{
rs = executeQuery();
while (rs.next()){
//have some code..
}
}catch(SQLException e){
} finally {
SqlUtils.closeResources(pst, rs);
}
and 2nd Method is:-
public void addItems() {
String query = "select * from particularitems where id = ?";
PreparedStatement stmt = null;
ResultSet rs = null;
Connection conn = null;
try {
conn = HibernateUtil.currentSession().connection();
stmt = conn.prepareStatement(query);
stmt.setInt(1, 34);
rs = stmt.executeQuery();
while (rs.next()) {
}
} catch (Exception se) {
throw new Exception(se);
} finally {
SqlUtils.closeResources(stmt, rs);
}
}
This error only comes when first query fails to execute even though second query is correct means execute successfully.
We are using
auto commit off;
So could you please tell me the exact reason and how can i fix it.thank you,