You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by speed <su...@gmail.com> on 2006/08/06 01:03:26 UTC

EIP components throw NullPointerException

It will be great help if someone can help me understand this behavior in 3.0
M2.

When FilePoller ->(sends a binary file) -> static-recipient-list (eip
component), there are lots of NullPointerExceptions are seen in the logfile
when DEBUG is turned on.

Everything works fine but these exceptions are very annoying.  Can someone
help me understand how do I get rid of these exceptions.

Here are some of the exceptions:

4:53:50,349 | DEBUG | Thread-21  | EIPSpringComponent       |
emix.common.AsyncBaseLifeCycle  376 | Received exchange: status: Active,
role: Provider
14:53:50,990 | DEBUG | Thread-21  | DeliveryChannelImpl      |
.messaging.DeliveryChannelImpl  404 | Send
ID:skadakia-2926-1154814826661-2:0 in
DeliveryChannel{ID:skadakia-2921-1154814824607-0:0}
14:53:51,000 | DEBUG | Thread-21  | MessageExchangeImpl      |
.messaging.MessageExchangeImpl  742 | Error caught in toString
java.lang.NullPointerException
	at
org.apache.servicemix.jbi.jaxp.StringSource.getInputStream(StringSource.java:56)
	at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
	at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:138)
	at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:280)
	at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.toString(MessageExchangeImpl.java:695)
	at java.lang.String.valueOf(String.java:2131)
	at java.lang.StringBuffer.append(StringBuffer.java:370)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:343)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:410)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.sendConsumerExchange(AsyncBaseLifeCycle.java:447)
	at org.apache.servicemix.eip.EIPEndpoint.send(EIPEndpoint.java:202)
	at
org.apache.servicemix.eip.patterns.StaticRecipientList.processAsync(StaticRecipientList.java:155)
	at org.apache.servicemix.eip.EIPEndpoint.process(EIPEndpoint.java:238)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:397)
	at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:42)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:622)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:168)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:226)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
	at java.lang.Thread.run(Thread.java:534)
14:53:51,000 | DEBUG | Thread-21  | DeliveryChannelImpl      |
.messaging.DeliveryChannelImpl  343 | Sent: null
14:53:51,010 | DEBUG | Thread-21  | MessageExchangeImpl      |
.messaging.MessageExchangeImpl  742 | Error caught in toString
java.lang.NullPointerException
	at
org.apache.servicemix.jbi.jaxp.StringSource.getInputStream(StringSource.java:56)
	at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
	at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:138)
	at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:280)
	at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.toString(MessageExchangeImpl.java:695)
	at java.lang.String.valueOf(String.java:2131)
	at java.lang.StringBuffer.append(StringBuffer.java:370)
	at
org.apache.servicemix.jbi.nmr.DefaultBroker.resolveAddress(DefaultBroker.java:390)
	at
org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:286)
	at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:713)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:374)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:410)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.sendConsumerExchange(AsyncBaseLifeCycle.java:447)
	at org.apache.servicemix.eip.EIPEndpoint.send(EIPEndpoint.java:202)
	at
org.apache.servicemix.eip.patterns.StaticRecipientList.processAsync(StaticRecipientList.java:155)
	at org.apache.servicemix.eip.EIPEndpoint.process(EIPEndpoint.java:238)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:397)
	at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:42)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:622)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:168)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:226)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
	at java.lang.Thread.run(Thread.java:534)


Your suggestions will be greatly appreciated.

speed

-- 
View this message in context: http://www.nabble.com/EIP-components-throw-NullPointerException-tf2057346.html#a5668498
Sent from the ServiceMix - User forum at Nabble.com.


Re: EIP components throw NullPointerException

Posted by speed <su...@gmail.com>.
WOW, that's great info.  Once again truly appreciate your time.

Yes, I have double checked the BinaryFileMarshaler.java code (3.0 M2 and not
the latest) and meesage content is not set as stated by you.  I will raise
JIRA for that, never done it before but will figure it out, there must be a
question on that in this forum.

Thanks a lot.

Sundeep

-- 
View this message in context: http://www.nabble.com/EIP-components-throw-NullPointerException-tf2057346.html#a5732429
Sent from the ServiceMix - User forum at Nabble.com.


Re: EIP components throw NullPointerException

Posted by Guillaume Nodet <gn...@gmail.com>.
On 8/8/06, speed <su...@gmail.com> wrote:
>
>
> Thank you for quick reply.  If you have time, I would like to understand
> the
> reason behind this problem for curiosity sake and also will help me
> understand ServiceMix better.


The JBI spec mandates  a valid xml payload  as the content of the message.
ServiceMix allow null contents or other kind of non-xml content, though all
components have not been extensively tested with such things.

One another thing is that, I am using out of the box VFS FilePoller and
> FileWriter (within static-recipient-list, EIP) which uses
> BinaryFileMarshaler, again as is.  So how do I define a dummy XML payload,
> which property should be set?


Would you mind raising a JIRA for that ? The BinaryFileMarshaler should be
able
to handle that.  As a workaround (if you don' t want to use svn head), you
should implement your own  marshaler by inheriting the BinaryFileMarshaler
and just override readMessage wih

    public void readMessage(MessageExchange exchange, NormalizedMessage
message, InputStream in, String path) throws IOException, JBIException {
        super.readMessage(exchange, message, in, path);
        message.setContent(new StringContent("<payload/>"));
    }

Another kind of similar problem I am facing with EIP component usage of
> static-routing-slip and/or pipeline consists of the following error, again
> everything works fine though, I believe it has something to do with the
> response message being received:
>
>                error: javax.jbi.messaging.MessagingException: illegal
> exchange status: done


This usually happen when a component does not recognize an InOut mep and
use it as an InOnly mep.

I am using lightweight components extended from TranformComponentSupport.


If your component returns false when the "transform"
method is called and the exchange is an InOut mep, this error will occur.


Here is servicemix.xml snippet, please let me know if I am doing anything
> wrong here:
>
> <!-- this is the BinaryFileMarshaler for reading and writing binay files
> from a ftp server -->
>             <bean id="marshaler"
> class="org.apache.servicemix.components.util.BinaryFileMarshaler"
> singleton="true">
>                 <property name="contentType" value="binarydata"/>
>                 <property name="attachment" value="file"/>
>             </bean>
>
> <!-- pipeline and routing slip ->
>                 <sm:activationSpec>
>                         <sm:component>
>                                 <eip:component>
>                                 <eip:endpoints>
>                                                         <eip:pipeline
> service="bc:pipeline" endpoint="endpoint">
>
>                                                           <eip:transformer>
>                                                             <eip:exchange-target
> service="bc:routingSlip" />
>
>                                                           </eip:transformer>
>                                                           <eip:target>
>                                                             <eip:exchange-target
> service="bc:tracer" />
>                                                           </eip:target>
>                                                         </eip:pipeline>
>                                         </eip:endpoints>
>                                 </eip:component>
>                                 </sm:component>
>                         </sm:activationSpec>
>
>                 <sm:activationSpec>
>                         <sm:component>
>                                 <eip:component>
>                                 <eip:endpoints>
>                                            <eip:static-routing-slip
> service="bc:routingSlip"
> endpoint="endpoint">
>                                                           <eip:targets>
>                                                             <eip:exchange-target
> service="bc:xmltransformer" />
>                                                             <eip:exchange-target
> service="bc:processList" />
>                                                             <eip:exchange-target
> service="bc:mailsender" />
>                                                           </eip:targets>
>
>                                                         </eip:static-routing-slip>
>                                         </eip:endpoints>
>                                 </eip:component>
>                                 </sm:component>
>                         </sm:activationSpec>
>
> Once agin thank you for kind help.
>
> speed
> --
> View this message in context:
> http://www.nabble.com/EIP-components-throw-NullPointerException-tf2057346.html#a5696712
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet

Re: EIP components throw NullPointerException

Posted by speed <su...@gmail.com>.
Thank you for quick reply.  If you have time, I would like to understand the
reason behind this problem for curiosity sake and also will help me
understand ServiceMix better.

One another thing is that, I am using out of the box VFS FilePoller and
FileWriter (within static-recipient-list, EIP) which uses
BinaryFileMarshaler, again as is.  So how do I define a dummy XML payload,
which property should be set?

Another kind of similar problem I am facing with EIP component usage of
static-routing-slip and/or pipeline consists of the following error, again
everything works fine though, I believe it has something to do with the
response message being received:

               error: javax.jbi.messaging.MessagingException: illegal
exchange status: done

I am using lightweight components extended from TranformComponentSupport.

Here is servicemix.xml snippet, please let me know if I am doing anything
wrong here:

<!-- this is the BinaryFileMarshaler for reading and writing binay files
from a ftp server -->
	    <bean id="marshaler"
class="org.apache.servicemix.components.util.BinaryFileMarshaler"
singleton="true">
	    	<property name="contentType" value="binarydata"/>
	    	<property name="attachment" value="file"/>
	    </bean>

<!-- pipeline and routing slip ->
      		<sm:activationSpec> 
        		<sm:component> 
          			<eip:component> 
            			<eip:endpoints>            
							<eip:pipeline service="bc:pipeline" endpoint="endpoint">
							  <eip:transformer>
							    <eip:exchange-target service="bc:routingSlip" />
							  </eip:transformer>
							  <eip:target>
							    <eip:exchange-target service="bc:tracer" />
							  </eip:target>
							</eip:pipeline>
			        	</eip:endpoints> 
			    	</eip:component> 
				</sm:component> 
			</sm:activationSpec>
			
      		<sm:activationSpec> 
        		<sm:component> 
          			<eip:component> 
            			<eip:endpoints>            
				           <eip:static-routing-slip service="bc:routingSlip"
endpoint="endpoint">
							  <eip:targets>
							    <eip:exchange-target service="bc:xmltransformer" />
							    <eip:exchange-target service="bc:processList" />
							    <eip:exchange-target service="bc:mailsender" />
							  </eip:targets>
							</eip:static-routing-slip>
			        	</eip:endpoints> 
			    	</eip:component> 
				</sm:component> 
			</sm:activationSpec>

Once agin thank you for kind help.

speed
-- 
View this message in context: http://www.nabble.com/EIP-components-throw-NullPointerException-tf2057346.html#a5696712
Sent from the ServiceMix - User forum at Nabble.com.


Re: EIP components throw NullPointerException

Posted by Guillaume Nodet <gn...@gmail.com>.
As a workaround, you should have your file marshaler set a dummy xml
payload.
I will fix these problems.

On 8/6/06, speed <su...@gmail.com> wrote:
>
>
> It will be great help if someone can help me understand this behavior in
> 3.0
> M2.
>
> When FilePoller ->(sends a binary file) -> static-recipient-list (eip
> component), there are lots of NullPointerExceptions are seen in the
> logfile
> when DEBUG is turned on.
>
> Everything works fine but these exceptions are very annoying.  Can someone
> help me understand how do I get rid of these exceptions.
>
> Here are some of the exceptions:
>
> 4:53:50,349 | DEBUG | Thread-21  | EIPSpringComponent       |
> emix.common.AsyncBaseLifeCycle  376 | Received exchange: status: Active,
> role: Provider
> 14:53:50,990 | DEBUG | Thread-21  | DeliveryChannelImpl      |
> .messaging.DeliveryChannelImpl  404 | Send
> ID:skadakia-2926-1154814826661-2:0 in
> DeliveryChannel{ID:skadakia-2921-1154814824607-0:0}
> 14:53:51,000 | DEBUG | Thread-21  | MessageExchangeImpl      |
> .messaging.MessageExchangeImpl  742 | Error caught in toString
> java.lang.NullPointerException
>         at
> org.apache.servicemix.jbi.jaxp.StringSource.getInputStream(
> StringSource.java:56)
>         at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(
> SourceTransformer.java:221)
>         at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(
> SourceTransformer.java:138)
>         at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(
> SourceTransformer.java:280)
>         at
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.toString(
> MessageExchangeImpl.java:695)
>         at java.lang.String.valueOf(String.java:2131)
>         at java.lang.StringBuffer.append(StringBuffer.java:370)
>         at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> DeliveryChannelImpl.java:343)
>         at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> DeliveryChannelImpl.java:410)
>         at
> org.apache.servicemix.common.AsyncBaseLifeCycle.sendConsumerExchange(
> AsyncBaseLifeCycle.java:447)
>         at org.apache.servicemix.eip.EIPEndpoint.send(EIPEndpoint.java
> :202)
>         at
> org.apache.servicemix.eip.patterns.StaticRecipientList.processAsync(
> StaticRecipientList.java:155)
>         at org.apache.servicemix.eip.EIPEndpoint.process(EIPEndpoint.java
> :238)
>         at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(
> AsyncBaseLifeCycle.java:397)
>         at
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(
> BaseLifeCycle.java:42)
>         at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> DeliveryChannelImpl.java:622)
>         at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> AbstractFlow.java:168)
>         at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java
> :176)
>         at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java
> :226)
>         at
> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java
> :291)
>         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run
> (Unknown
> Source)
>         at java.lang.Thread.run(Thread.java:534)
> 14:53:51,000 | DEBUG | Thread-21  | DeliveryChannelImpl      |
> .messaging.DeliveryChannelImpl  343 | Sent: null
> 14:53:51,010 | DEBUG | Thread-21  | MessageExchangeImpl      |
> .messaging.MessageExchangeImpl  742 | Error caught in toString
> java.lang.NullPointerException
>         at
> org.apache.servicemix.jbi.jaxp.StringSource.getInputStream(
> StringSource.java:56)
>         at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(
> SourceTransformer.java:221)
>         at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(
> SourceTransformer.java:138)
>         at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(
> SourceTransformer.java:280)
>         at
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.toString(
> MessageExchangeImpl.java:695)
>         at java.lang.String.valueOf(String.java:2131)
>         at java.lang.StringBuffer.append(StringBuffer.java:370)
>         at
> org.apache.servicemix.jbi.nmr.DefaultBroker.resolveAddress(
> DefaultBroker.java:390)
>         at
> org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(
> DefaultBroker.java:286)
>         at
> org.apache.servicemix.jbi.container.JBIContainer.sendExchange(
> JBIContainer.java:713)
>         at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> DeliveryChannelImpl.java:374)
>         at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> DeliveryChannelImpl.java:410)
>         at
> org.apache.servicemix.common.AsyncBaseLifeCycle.sendConsumerExchange(
> AsyncBaseLifeCycle.java:447)
>         at org.apache.servicemix.eip.EIPEndpoint.send(EIPEndpoint.java
> :202)
>         at
> org.apache.servicemix.eip.patterns.StaticRecipientList.processAsync(
> StaticRecipientList.java:155)
>         at org.apache.servicemix.eip.EIPEndpoint.process(EIPEndpoint.java
> :238)
>         at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(
> AsyncBaseLifeCycle.java:397)
>         at
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(
> BaseLifeCycle.java:42)
>         at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> DeliveryChannelImpl.java:622)
>         at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> AbstractFlow.java:168)
>         at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java
> :176)
>         at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java
> :226)
>         at
> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java
> :291)
>         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run
> (Unknown
> Source)
>         at java.lang.Thread.run(Thread.java:534)
>
>
> Your suggestions will be greatly appreciated.
>
> speed
>
> --
> View this message in context:
> http://www.nabble.com/EIP-components-throw-NullPointerException-tf2057346.html#a5668498
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet