Thanks for the response. I tried this property and it did not work, I am still seeing the message being resent - I have to undeploy my app and take out the offending piece of code that throws the exception, and finally redeploy the app to get the process to quit... during this process i get around 2-4 new server log files of 2000Kb each depending on how quick I am. I must do this because if I undeploy my app or shutdown the app server - the message is written to persistent storage and resent on startup/deployment.
I've actually come up with what I think will lead us closer to the problem. I created a simple test case that would throw a java.lang.ArrayIndexOutOfBoundsException, on this exception everything work fine - my MDB caught the exception and there were no resends.
The code that will produce infinite loop of exception/resend is:
[code]@PersistenceContext private EntityManager eManager;
try {
String sqlStmt; // this is dynamically generated based on java entity bean values
// there is a possibility that this statement is invalid - which is causing the exception
Vector result = (Vector) eManager.createNativeQuery(sqlStmt).getSingleResult(); // here is the exception
} catch (Exception e)
{ // my exception logger
}[/code]
I can see my MDB catch the exception, but somewhere in the method call the exception is being written to the logfile outside of my control (so I have two entries of the same exception). This is the exception from my log file that is coming from outside the MDB - as I mentioned before, I have another entry in the logfile from my MDB exception handler - they are exactly the same stracktrace/exception. My MDB does not fail, it catches the exception and continues execution to completion. The problem comes from the message being resent and reprocessed, thereby hitting the same exception/resending etc...
Is it legal to use entitymanager calls in a MDB? It seems that this type of exception is that only one to cause the loop.
[code]
[#|2007-08-16T09:44:46.934-0700|WARNING|sun-appserver9.1|oracle.toplink.essentials.session.file:/path/to/my/dir/-PersistenceUnitName|_ThreadID=18;_ThreadName=p: thread-pool-1; w: 4;_RequestID=7fe6b1f6-1e70-490c-8cbf-aae724d794f9;|
Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 9.1 (Build b33)): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-00904: "BAD_FIELD": invalid identifier
Error Code: 904
Call:SELECT COUNT(*) FROM MY_TABLE WHERE GOOD_FIELD = 1 AND BAD_FIELD = 1
Query:DataReadQuery()
at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:303)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:551)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:437)
at oracle.toplink.essentials.threetier.ServerSession.executeCall(ServerSession.java:465)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:213)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:199)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:270)
at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeSelect(DatasourceCallQueryMechanism.java:252)
at oracle.toplink.essentials.queryframework.DataReadQuery.executeNonCursor(DataReadQuery.java:105)
at oracle.toplink.essentials.queryframework.DataReadQuery.executeDatabaseQuery(DataReadQuery.java:97)
at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:536)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2219)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:335)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:472)
at my.class.path.MyQueue.onMessage(MyQueue.java:177)
at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1051)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2846)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3930)
at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:996)
at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:61)
at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:166)
at $Proxy113.onMessage(Unknown Source)
at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:230)
at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:63)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:509)
Caused by: java.sql.SQLException: ORA-00904: "BAD_FIELD": invalid identifier
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:626)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:182)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:500)
at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:942)
at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:532)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1037)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2905)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2946)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:711)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:486)
... 30 more
|#]
[/code]
[Message sent by forum member 'kjsempire' (kjsempire)]
http://forums.java.net/jive/thread.jspa?messageID=231199