Issue Details (XML | Word | Printable)

Key: SMXCOMP-335
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Guillaume Nodet
Reporter: Ryan Bohn
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ServiceMix Components

Sending an exchange in a thread created by the bean result in a NullpointerException on DeliveryChannel.send()

Created: 12/Nov/07 12:47 PM   Updated: 15/Feb/09 12:19 AM
Return to search
Component/s: servicemix-bean
Affects Version/s: None
Fix Version/s: 3.2.4, servicemix-bean-2008.01

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works BeanEndpoint_sm1134.patch 2008-09-01 10:50 PM Jeroen Ninck Blok 2 kB
Zip Archive servicemix-bean-example.zip 2007-11-12 12:47 PM Ryan Bohn 9 kB
Environment: Mac OSX Tiger


 Description  « Hide
I'm trying to send a message asynchronously from a sender to a receiver using an InOnly exchange. When I call DeliveryChannel.send(), I get the following NullPointerException:

Sending message: Hello?
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:846)
at org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:566)
at example.Sender$1.run(Sender.java:40)
at java.lang.Thread.run(Thread.java:613)

When I go to the line of code in the BeanEndpoint, I see the following:

requests.put(messageExchange.getExchangeId(), currentRequest.get());

Using my debugger, I noticed the value of currentRequest.get() returns null, which is not allowed in a ConcurrentHashMap (neither null keys nor null values are allowed). the message exchange id is non-null.

I also noticed that currentRequest is only set when the component receives an exchange, which is not the case here.

Both the sender and receiver are using bean endpoints. I have attached the project to this ticket. You can deploy the project using maven, with the following command:

mvn install jbi:projectDeploy



 All   Comments   Work Log   Change History   Subversion Commits   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Ryan Bohn added a comment - 26/Nov/07 05:10 AM
any word on this?

Bruce Snyder made changes - 23/Dec/07 08:04 AM
Field Original Value New Value
Comment [ The diff in the attached tarball does not contain any of the new files. In order to include the newly created files in the diff, you need to do a [{{svn add}}|http://svnbook.red-bean.com/en/1.0/re01.html] in your local copy to schedule the addition of the new files. Then run {{svn diff}} to create the diff file. This will include the new files in the diff file. ]
Guillaume Nodet added a comment - 25/Mar/08 04:42 PM
This is a use case that is not really handled at the moment.
It would require some modifications in the component to handle that.
As a workaround, using sendSync should work.

Jeroen Ninck Blok made changes - 01/Sep/08 10:50 PM
Attachment BeanEndpoint_sm1134.patch [ 16925 ]
Jeroen Ninck Blok added a comment - 01/Sep/08 10:51 PM
I have attached a patch to this issue. I am pretty sure that it doesn't fix the problem as Guillaume describes in his comment, however it does appear to be working without causing any (serious) memory leaks.

Guillaume Nodet made changes - 03/Sep/08 02:42 AM
Summary NullpointerException on DeliveryChannel.send() Sending an exchange is a thread created by the bean result in a NullpointerException on DeliveryChannel.send()
Guillaume Nodet made changes - 03/Sep/08 02:43 AM
Summary Sending an exchange is a thread created by the bean result in a NullpointerException on DeliveryChannel.send() Sending an exchange in a thread created by the bean result in a NullpointerException on DeliveryChannel.send()
Repository Revision Date User Message
ServiceMix #691553 Wed Sep 03 02:43:42 PDT 2008 gnodet SM-1134: sending an exchange in a thread created by the bean result in a NPE
Files Changed
MODIFY /servicemix/components/engines/servicemix-bean/trunk/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
ADD /servicemix/components/engines/servicemix-bean/trunk/src/test/resources/sender-bean.xml
MODIFY /servicemix/components/engines/servicemix-bean/trunk/src/test/java/org/apache/servicemix/bean/ConsumerBeanTest.java
ADD /servicemix/components/engines/servicemix-bean/trunk/src/test/java/org/apache/servicemix/bean/SenderBeanTest.java
ADD /servicemix/components/engines/servicemix-bean/trunk/src/test/java/org/apache/servicemix/bean/beans/SenderBean.java

Guillaume Nodet added a comment - 03/Sep/08 02:43 AM
Thanks a lot for this patch.

Sending src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
Sending src/test/java/org/apache/servicemix/bean/ConsumerBeanTest.java
Adding src/test/java/org/apache/servicemix/bean/SenderBeanTest.java
Adding src/test/java/org/apache/servicemix/bean/beans/SenderBean.java
Adding src/test/resources/sender-bean.xml
Transmitting file data .....
Committed revision 691553.


Guillaume Nodet made changes - 03/Sep/08 02:43 AM
Fix Version/s 3.3 [ 11850 ]
Resolution Fixed [ 1 ]
Assignee Guillaume Nodet [ gnt ]
Status Open [ 1 ] Resolved [ 5 ]
Guillaume Nodet made changes - 07/Oct/08 12:03 AM
Affects Version/s 3.2 [ 11810 ]
Affects Version/s servicemix-bean-2008.01 [ 11934 ]
Guillaume Nodet made changes - 07/Oct/08 12:04 AM
Affects Version/s servicemix-bean-2008.01 [ 11934 ]
Fix Version/s 3.3 [ 11850 ]
Fix Version/s servicemix-bean-2008.01 [ 11934 ]
Guillaume Nodet made changes - 07/Oct/08 12:11 AM
Fix Version/s 3.3 [ 11850 ]
Repository Revision Date User Message
SMX3 #713346 Wed Nov 12 02:47:10 PST 2008 gnodet Backport SM-1134 to 3.2.x branch
Files Changed
MODIFY /servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java

Repository Revision Date User Message
ServiceMix #713346 Wed Nov 12 02:47:10 PST 2008 gnodet Backport SM-1134 to 3.2.x branch
Files Changed
MODIFY /servicemix/smx3/branches/servicemix-3.2/deployables/serviceengines/servicemix-bean/src/main/java/org/apache/servicemix/bean/BeanEndpoint.java

Guillaume Nodet added a comment - 12/Nov/08 02:47 AM
Sending src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
Transmitting file data .
Committed revision 713346.

Backported to 3.2 branch


Guillaume Nodet made changes - 12/Nov/08 02:47 AM
Fix Version/s 3.2.4 [ 11990 ]
Gert Vanthienen made changes - 15/Feb/09 12:19 AM
Component/s servicemix-bean [ 11630 ]
Component/s servicemix-bean [ 11785 ]
Fix Version/s 3.2.4 [ 11990 ]
Fix Version/s servicemix-bean-2008.01 [ 11934 ]
Fix Version/s 3.3 [ 11850 ]
Project ServiceMix [ 10950 ] ServiceMix Components [ 11080 ]
Fix Version/s 3.3 [ 12055 ]
Fix Version/s servicemix-bean-2008.01 [ 12048 ]
Fix Version/s 3.2.4 [ 12007 ]
Key SM-1134 SMXCOMP-335