You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by KOS <ko...@student.ethz.ch> on 2009/01/07 14:08:43 UTC

FileAuditor, NullPointerException

Hi

the org.apache.servicemix.jbi.audit.file.FileAuditor, which can be started
by putting  <audit:fileAuditor container="#jbi" directory="file:data/audit"
/> in the servicemix.xml, leads to a NPE in Interceptor.handleMessage()
methods, in my case always in BodyOutInterceptor.handleMessage().
It only happens when exchange.getMessage("in").getContent() is of type
StaxSource or DOMSource, because then SourceTransformer is used, which
causes in the end this error. If it is of type StreamSource, everything
works correctly.

The same as with the FileAuditor happens when debugging is turned on in
ServiceMix, as explained in an earlier post:
http://www.nabble.com/http%3Asoap-provider-doesn%27t-return-%28StaxUtils%29%2C-bug--tt21252942.html
The workaround for this problem, as supposed as answer to my post, was to
turn off debugging. This works.

But how can I use the FileAuditor then? Or how can I intercept DOMSource or
StaxSource efficiently, as the SourceTransformer doesn't work correctly? Do
I need to parse the XMLStreamReader 'by hand'? This is a lot of work, as I
only want to copy the content of the message/stream.

The Exception can be produced by sending e.g. a soap-request using
http:soap-consumer, http:soap-provider. Then, the content of the
NormalizedMessage is of type StaxSource.

Thanks for hints.
-- 
View this message in context: http://www.nabble.com/FileAuditor%2C-NullPointerException-tp21331007p21331007.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: FileAuditor, NullPointerException

Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,

The FileAuditor should be able to handle all kinds of exchanges.  It 
uses a TeeInputStream in order to handle StreamSources more efficiently 
(i.e. without converting them into a DOMSource or something first), but 
it should be perfectly capable of handling all others kinds of XML 
Sources as well.  I have just added a test to ensure it handles 
DOMSource objects as well and that doesn't show a problem.  Could you 
send the full stack trace you are getting? 

Regards,

Gert

KOS schreef:
> Hi
>
> the org.apache.servicemix.jbi.audit.file.FileAuditor, which can be started
> by putting  <audit:fileAuditor container="#jbi" directory="file:data/audit"
> /> in the servicemix.xml, leads to a NPE in Interceptor.handleMessage()
> methods, in my case always in BodyOutInterceptor.handleMessage().
> It only happens when exchange.getMessage("in").getContent() is of type
> StaxSource or DOMSource, because then SourceTransformer is used, which
> causes in the end this error. If it is of type StreamSource, everything
> works correctly.
>
> The same as with the FileAuditor happens when debugging is turned on in
> ServiceMix, as explained in an earlier post:
> http://www.nabble.com/http%3Asoap-provider-doesn%27t-return-%28StaxUtils%29%2C-bug--tt21252942.html
> The workaround for this problem, as supposed as answer to my post, was to
> turn off debugging. This works.
>
> But how can I use the FileAuditor then? Or how can I intercept DOMSource or
> StaxSource efficiently, as the SourceTransformer doesn't work correctly? Do
> I need to parse the XMLStreamReader 'by hand'? This is a lot of work, as I
> only want to copy the content of the message/stream.
>
> The Exception can be produced by sending e.g. a soap-request using
> http:soap-consumer, http:soap-provider. Then, the content of the
> NormalizedMessage is of type StaxSource.
>
> Thanks for hints.
>