Getting details of remote EJB exception - ejb-3.0

I am having big problems in fetching exception details from Remote EJBs...
I have a pipeline pattern implemented with Remote EJBs, where one EJB calls other EJBs to do certain tasks. What I can't figure out is how to get more meaningful exceptions when some problem occures.
Here is an example of a "very useful" output I typically get from the EJB container (Glassfish):
2010-11-18 12:22:36,974 DEBUG [CustomerDetectionFilter.java:48 [eef819a4debb613d0670dab35c39] - Checking customer details ...
2010-11-18 12:22:37,026 ERROR [ServiceCore.java:104] [eef819a4debb613d0670dab35c39] - nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: null; nested exception is:
javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 9998 Maybe; nested exception is:
org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806 completed: Maybe
javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: null; nested exception is:
javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 9998 Maybe; nested exception is:
org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806 completed: Maybe
at com.my.remote._CustomerDetectionFilterRemote_Wrapper.execute(com/my/remote/_CustomerDetectionFilterRemote_Wrapper.java) ~[project-common.jar:na]
So in this case I would know that this is the cause:
java.rmi.RemoteException: null
... but I have no way of getting more useful information for debugging.
Can you recommend a way of excepting handling where the caller of remote EJB needs to get more details about the problem that occured? AppServer is Glassfish 2.1.
Thank you,
Bozo

There are various ways for handling exceptions. We can configure them to get most information about root cause from it.
Below link might provide useful information & topic is discussed briefly.
Best practices in EJB exception handling - http://www.ibm.com/developerworks/java/library/j-ejbexcept.html

Related

How to restore writing to queue after failure

After disk space is finish I got InternalError. Adding disk space wasn't fix problem.
Is it possible to restore and continue to persist?
May be on error I can try to recreate/close?
Creation of the queue queue = SingleChronicleQueueBuilder.binary(basePath)
.build();
Writing on a single thread "TradeReactorEventPersister-1"
ExcerptAppender appender = acquireAppender;
if (appender == null) {
appender = queue.acquireAppender();
acquireAppender = appender;
}
appender.writeBytes(BytesStore.wrap(b));
After next exceptions:
2019-08-23 08:13:26.963 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception a fault occurred in a recent unsafe memory access operation in compiled Java code in thread TradeReactorEventPersister-1
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
at net.openhft.chronicle.wire.AbstractWire.updateHeaderAssertions(AbstractWire.java:546)
at net.openhft.chronicle.wire.AbstractWire.updateHeader(AbstractWire.java:533)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:470)
2019-08-23 08:13:26.965 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception a fault occurred in a recent unsafe memory access operation in compiled Java code in thread TradeReactorEventPersister-1
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
at net.openhft.chronicle.wire.AbstractWire.updateHeaderAssertions(AbstractWire.java:547)
at net.openhft.chronicle.wire.AbstractWire.updateHeader(AbstractWire.java:533)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:470)
2019-08-23 08:13:27.166 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception a fault occurred in a recent unsafe memory access operation in compiled Java code in thread TradeReactorEventPersister-1
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
at net.openhft.chronicle.wire.AbstractWire.updateHeader(AbstractWire.java:511)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:470)
2019-08-23 08:13:27.167 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads. in thread TradeReactorEventPersister-1
java.lang.AssertionError: you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads.
at net.openhft.chronicle.wire.AbstractWire.enterHeader(AbstractWire.java:322)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeHeader(SingleChronicleQueueExcerpts.java:405)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:463)
I couldn't persist after adding disk space.
I got last exception on every trying to persist event:
2019-08-23 08:22:50.746 +0000 ERROR [TradeReactorEventPersister-1] LoggingUncaughtExceptionHandler - Uncaught exception you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads. in thread TradeReactorEventPersister-1
java.lang.AssertionError: you cant put a header inside a header, check that you have not nested the documents. If you are using Chronicle-Queue please ensure that you have a unique instance of the Appender per thread, in other-words you can not share appenders across threads.
at net.openhft.chronicle.wire.AbstractWire.enterHeader(AbstractWire.java:322)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeHeader(SingleChronicleQueueExcerpts.java:405)
at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:463)
Unfortunately chronicle queue works at the pretty low level, and it is unable to automatically repair itself after data corruption (and disk space will inevitably lead to data corruption). BTW to avoid this, Chronicle Queue will warn you if you are running low on disk space, you should've seen a warning message like:
"your disk " + this.fileStore + " is almost full, warning: chronicle-queue may crash if it runs out of space."
PS you shouldn't really need to do the lazy acquire logic. You can always simply do queue.acquireAppender() - it's a cheap call which gets preexisting appender from the ThreadLocal pool, and will not create the new appender every time.

SQL Profiler identify exception

I am new to using SQL Profiler and have been using it to try and identify the source of an exception. It occurs during a trigger but does not appear to be caused by it. I have the Exception EventClass selected but I do not see any information as to where the exception was thrown from.
The exception occurs after a SELECT in the trigger that works successfully. I have inserted a RAISERROR after the select to log the parameters and return values from the select. They are all valid.
As I put more RAISERROR statements in, the exception moves further down within the trace.
I must be missing something in how to log the Exception in the profiler. I just cannot see where the exception is coming from so I can get to it and fix it.
The text of the exception is "Arithmetic overflow error converting expression to data type datetime."
Found it. Needed more events to properly encapsulate the exception in Profiler.

Exception when getting job execution status in Spring-XD Admin

I am trying to see the execution status of a job I ran, but at some random points I get the following error:
2015-10-14T14:41:24-0400 1.2.0.RELEASE ERROR qtp195949131-28 rest.RestControllerAdvice - Caught exception while handling a request
org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: java.lang.Integer cannot be cast to java.lang.String (through reference chain: org.springframework.xd.rest.domain.JobExecutionInfoResource["jobExecution"]->org.springframework.batch.core.JobExecution["executionContext"]->org.springframework.batch.item.ExecutionContext["values"]->java.util.concurrent.EntrySetView[0]->java.util.concurrent.MapEntry["value"]->java.util.ArrayList[0]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: java.lang.Integer cannot be cast to java.lang.String (through reference chain: org.springframework.xd.rest.domain.JobExecutionInfoResource["jobExecution"]->org.springframework.batch.core.JobExecution["executionContext"]->org.springframework.batch.item.ExecutionContext["values"]->java.util.concurrent.EntrySetView[0]->java.util.concurrent.MapEntry["value"]->java.util.ArrayList[0])
Now, I say "random", but the truth is I don't even know which step causes this exception since those are the only logs I have. The jobs run successfully with seemingly no errors, but this really worries me. I've been looking online for days for this, but I don't see anything that can either help me debug this, or even gives an inkling of what might cause this. Any help?
Thanks, N.S.
Okay, so I figured out that the problem was that we were serializing in the execution context a List>, and one of those internal maps contained an Integer as an Object instead of a String. This seems to cause the deserialization of the context to crash.
Solution? Don't store that list within the execution context (instead we wrote the whole list object to a file for transferring between various steps).

Throwing exception from ServiceActivator vs. Filter behaves differently

In our application we have error handling mechanism, where we throw runtime exceptions on an error. I noticed a strange behavior and I want to understand the mechanism underlying this one
1) Situation 1: Exception thrown from ServiceActivator is converted to MessageHandlingException
When an error occurs in a ServiceActivator, we throw an exception. The message we get on ErrorChannel has PayLoad as org.springframework.integration.MessageHandlingException and actual exception thrown as cause
2) Situation 2: Exception thrown from Filter is not masked with MessageHandlingException
When an error occurs in Filter, and we throw exception, then PayLoad is actual exception, and is not masked with org.springframework.integration.MessageHandlingException
I have a few questions:
Why exception throwing from ServiceActivator behaves differently than in Filter
Are there some "best practices" around error handling in Spring-integration projects, while utilizing the errorChannel and related infrastructure
Update 1:
Filter extends AbstractFileListFilter which is part of a filter chain- a custom CompositeFileFilter which implements FileListFilter
CompositeFileFilter is being used by a file:inbound-channel-adapter and which passes the output to a Channel declared below:
<int:channel
id="channelForFilesComingIn"
datatype="java.io.File"
>
<int:dispatcher task-executor="dispatchExecutor" />
</int:channel>
Update 2:
Whet we are trying to do is read files from filesystem and process them. In file reading part, using file:inbound-channel-adapter with a CompositeFilter which filters files which are not completely uploaded or don't meet naming standards.
After all filters pass, file is handed over to a ServiceActivator for processing
In any of above (Filter chain or Service) , if there is an error condition, it has to be reported to DB and by email. For achieving this we are throwing ApplicationException which are caught by errorChannel, and passed to specialized channels.
Just to make it clear, a MessageHandlingException is thrown (wraps user exception) when a Message HANDLER fails - a message handler is something that HANDLES a message.
If an exception is thrown in the MessageSource, there is no message yet so a MessageHandlingException (or any MessagingException) does not apply.
Instead, the poll fails and the exception is thrown back to the poller.
If you want to handle exceptions in a polled endpoint (MessageSource), you need to give the poller an ErrorHandlingTaskExecutor, to which you can provide an ErrorHandler and do what you want with the exception, but since there is no message yet, it is the original exception thrown by the MessageSource.
If you want to send it to the error channel, you'll need to do that in your custom ErrorHandler.

Windows Phone 7-System.ArgumentOutOfRangeException

everyone.
I am developing an app for the win7 phone and have some problem with navigation. I have one panorama and
two pivot controls. The panorama control it is MainPage, when I am navigating to the first pivot
control and do some job, I can go back to the MainPage and then go out of the app without any problem.
However, when I do some job in the second pivot control, then I have a problem to go back to the MainPage.
I am navigating MainPage-->FirstPivot"Back button"-->MainPage-->SecondPivot"Back button"-->MainPage. I can see that I am entering the MainPage,
but then app is crashes. In the output window, I can see this exception:
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurr*emphasized text*ed in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
'taskhost.exe' (Managed): Loaded 'System.SR.dll'
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.ArgumentException' occurred in System.Windows.dll
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.dll
You do not give enough detail in your question to answer it, however, it sounds like you have a problem with where you maintain state and possibly your tombstoning implementation. I would recommend reading this article and basing your solution around the techniques described:
http://www.scottlogic.co.uk/blog/colin/2011/05/a-simple-windows-phone-7-mvvm-tombstoning-example/
I encountered this error when I tried to bind two UIElement into two different container.
(In fact UIElement was a UserControl(partial class). I have another class named same and partial, this caused missunderstanding :)
In silverlight you can remove one element from a container and add it into another container.
But you can't add an UIElement into two different container.
But something else cause this error as Colin said the error message is not so clear.
I'm seeing below errors in your stack. You may check part of IsolatedStorage usage if exist.
occurr*emphasized text*ed in System.Windows.dll
and
System.IO.IsolatedStorage.IsolatedStorageException' occurred
Hope helps

Resources