java.lang.NullPointerException if Notify message does not specify To field in 
header
------------------------------------------------------------------------------------

                 Key: SM-1886
                 URL: https://issues.apache.org/activemq/browse/SM-1886
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-wsn2005
    Affects Versions: 3.2.3
         Environment: I am using servicemix 3.2.3 on a virtual windows XP 
machine.  You can use the example wsn-http-binding example to reproduce this 
error.
            Reporter: David N Perkins


If a notification message is sent without specifying the To element in the 
Header servicemix will error.

For example, change this code in the client example of the notify message:
<env:Header>
<wsa:To>
http://www.consumer.org/service/endpoint
</wsa:To>
</env:Header>

To:
<env:Header>
</env:Header>

Then servicemix will first report this error:
WARN  - DeliveryChannelImpl            - Error calling listener: null
java.lang.NullPointerException
        at org.apache.servicemix.jbi.monitoring.StatisticsService.onExchangeAcce
pted(StatisticsService.java:307)
        at org.apache.servicemix.jbi.monitoring.StatisticsService$3.exchangeAcce
pted(StatisticsService.java:186)
        at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
d(DeliveryChannelImpl.java:608)
        at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
w.java:172)
        at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
ava:167)
        at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
a:134)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:651)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:676)
        at java.lang.Thread.run(Thread.java:595)

And then report this error after a minute or so:
ERROR - HttpComponent                  - Error processing exchange InOnly[
  id: ID:134.253.165.148-123293e28fe-19:0
  status: Active
  role: provider
  endpoint: http://www.consumer.org/service/endpoint
  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify xmlns:ns2="http://docs.o
asis-open.org/wsn/b-2" xmlns="http://www.w3.org/2005/08/addressing"; xmlns:ns3="h
ttp://docs.oasis-open.org/wsn/t-1" xmlns:ns4="http://docs.oasis-open.org/wsrf/bf
-2"><ns2:NotificationMessage><ns2:Topic Dialect="http://docs.oasis-open.org/wsn/
t-1/TopicExpression/Simple">
myTopic
</ns2:Topic><ns2:Message><alarm:Alarm xmlns:alarm="http://alarms.some-host";><Nam
e xmlns="" xmlns:ns6="http://www.w3.org/2005/08/addressing";>Kettle Overfill</Nam
e><Desc xmlns="" xmlns:ns6="http://www.w3.org/2005/08/addressing";>Kettle Overfil
l Alarm</Desc><Date xmlns="" xmlns:ns6="http://www.w3.org/2005/08/addressing";>20
07-09-22-12:00:30:100</Date><Severity xmlns="" xmlns:ns6="http://www.w3.org/2005
/08/addressing">3</Severity><Value xmlns="" xmlns:ns6="http://www.w3.org/2005/08
/addressing">110.2</Value><Ack xmlns="" xmlns:ns6="http://www.w3.org/2005/08/add
ressing">false</Ack>
</alarm:Alarm></ns2:Message></ns2:NotificationMessage></ns2:Notify>
]
java.net.ConnectException: Connection timed out: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:367)
        at java.net.Socket.connect(Socket.java:524)
        at java.net.Socket.connect(Socket.java:474)
        at java.net.Socket.<init>(Socket.java:371)
        at java.net.Socket.<init>(Socket.java:244)
        at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.c
reateSocket(DefaultProtocolSocketFactory.java:79)
        at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.c
reateSocket(DefaultProtocolSocketFactory.java:121)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java
:706)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$Http
ConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Htt
pMethodDirector.java:386)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMe
thodDirector.java:170)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:396)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:346)
        at org.apache.servicemix.http.processors.ProviderProcessor.process(Provi
derProcessor.java:168)
        at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi
feCycle.java:538)
        at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async
BaseLifeCycle.java:490)
        at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife
Cycle.java:46)
        at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun
d(DeliveryChannelImpl.java:620)
        at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo
w.java:172)
        at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j
ava:167)
        at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav
a:134)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:651)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:676)
        at java.lang.Thread.run(Thread.java:595)

The To element should not have to be filled in as it is not part of the 
ws-notification spec and if you already know who the message is suppose to go 
to then why use an esb?  Just send the message strait to the recipient.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to