Ahhh, wait.. you know what? You got me thinking on your correction of my
original theory.. I have one spot that my assumption should prove true.. and
I think this might explain a few things as well... I'm actually using the
DeliveryChannel to send in TWO spots on the bean.. so it's possible that in
those two spots, two different threads are using that same deliverychannel
and clobbering each other.. and may be why I see the deadlocks sometimes..
so maybe I just need to synchronize on the deliverychannel when sending in
each of those two spots... that almost has to be it.... using the servicemix
client really exploded, probably for the same reasons.... hopefully that
is.. to some extent it seems like the threadlocal should prevent that, but
dunno.. something weird is happening either way with it.
On Mon, Jun 23, 2008 at 3:31 AM, Ryan Moquin <[EMAIL PROTECTED]> wrote:
> Sure, I backed out the changes in my editor.. basically my bean is standard
> compared to the servicemix docs (for how to handle the exchange coming in),
> then my bean takes the injected deliverychannel and hands it to a class that
> creates a message to send out with results of some analysis performed.. here
> is the code to send out (it's using the DeliveryChannel injected into the
> bean by Servicemix):
>
> Marshaller notificationMarshaller = jaxbContext.createMarshaller();
> notificationMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
> Boolean.TRUE);
> notificationMarshaller.marshal(notification, writer);
> if (destinationQname == null) {
> destinationQname = new QName(getDestinationNamespace(),
> getDestinationService());
> }
> MessageExchangeFactory exchangeFactory =
> deliveryChannel.createExchangeFactory();
> InOnly exchange = exchangeFactory.createInOnlyExchange();
> NormalizedMessage message = exchange.createMessage();
> message.setContent(new StringSource(writer.toString()));
> exchange.setInMessage(message);
> exchange.setService(destinationQname);
> deliveryChannel.send(exchange);
>
> The send is where the ConcurrentHashmap complains about an NPE .. I think
> because the BeanComponent sets the CurrentRequest to null around the time my
> code is trying to send a request that must get clobbered? There's no other
> explanation for it.. it looks like the NPE is caused by
> currentRequest.get(), which is set back to null by the BeanComponent and
> since they are in the same thread.... they interfere.
>
> Ryan
>
>
> On Mon, Jun 23, 2008 at 3:24 AM, Guillaume Nodet <[EMAIL PROTECTED]> wrote:
>
>> Is there any way you could paste the code of the bean you're using so
>> that i can have a quick look. You can skip any non-jbi related
>> processing...
>>
>> On Mon, Jun 23, 2008 at 9:18 AM, Ryan Moquin <[EMAIL PROTECTED]>
>> wrote:
>> > No, I'm just simply using the deliverychannel to send out, which is
>> > mentioned in the servicemix docs as something that you can do. I assume
>> > that means it's recommended :) I did see that I can inject a
>> > ComponentContext and so I'm currently changing my outbound messages to
>> that
>> > to see if I can get around this problem. I think I just can't use the
>> > DeliveryContext in the same Pojo (same thread).
>> >
>> > On Mon, Jun 23, 2008 at 3:11 AM, Guillaume Nodet <[EMAIL PROTECTED]>
>> wrote:
>> >
>> >> The NPE in the PojoChannel.send() method means that the
>> >> currentRequest.get() is null.
>> >> Do you perform any threading operation in the pojo ? If yes, you
>> >> should try to remove that, as the component is already able to handle
>> >> concurrent requests.
>> >>
>> >> On Sat, Jun 21, 2008 at 6:48 AM, Ryan Moquin <[EMAIL PROTECTED]>
>> >> wrote:
>> >> > I hate to say this Bruce, but unfortunately 3.2.2 is working pretty
>> bad
>> >> for
>> >> > me and has the same problem :( It only seems to affect our
>> production
>> >> > server and in a few minutes after start up, I start getting the
>> >> > NullPointerException.. slowly all my services start doing it and they
>> all
>> >> > stop working. If I stop and restart servicemix, then servicemix-jms
>> >> > components are no longer routable. I'm guessing this error causes
>> >> > Servicemix to shut them down and not deploy them anymore (Servicemix
>> does
>> >> > the same thing if a service unit starts up, tries to make a Joram
>> >> connection
>> >> > to a server that isn't up, servicemix will shutdown that SU and will
>> >> always
>> >> > shut it down immediately after it starts on any subsequent run).
>> >> >
>> >> > It seems like this problem must be related to a race condition. When
>> >> doing
>> >> > development testing, I never see this problem on my laptop even under
>> >> high
>> >> > load. One our fast test server, I see this error popup once on
>> startup
>> >> and
>> >> > then it doesn't seem to happen again. On our even faster production
>> >> server,
>> >> > the whole thing looses it's wheels and falls apart after a few
>> minutes.
>> >> >
>> >> > I'm supposed to be deploying this system in a few days and of course
>> >> that's
>> >> > the only spot where I can't temporarily limp by. Is it possible you
>> >> could
>> >> > give me some hints on what the problem is and I'll debug it this
>> weekend
>> >> to
>> >> > see if I can fix it, or at least patch it temporarily? I really need
>> to
>> >> > figure out way to get around this problem. Other than that, 3.2.2
>> seems
>> >> to
>> >> > work perfectly fine.
>> >> >
>> >> > Here is the caused by error again in case it's any bit different than
>> the
>> >> > 3.2.1 one was:
>> >> >
>> >> > Caused by: java.lang.NullPointerException
>> >> > at
>> >> >
>> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
>> >> > at
>> >> >
>> >>
>> org.apache.servicemix.bean.BeanEndpoint$PojoChannel.send(BeanEndpoint.java:569)
>> >> > at
>> >> >
>> >>
>> com.notification.impl.JbiNotificationHandlerImpl.sendNotification(JbiNotificat
>> >> > ionHandlerImpl.java:80)
>> >> >
>> >> > Also, is the delivery channel component threadsafe? I'm curious if
>> >> multiple
>> >> > threads accessing it is a problem or if I should keep access to it
>> >> > synchronized? I'm currently synchronizing, but don't want to if I
>> don't
>> >> > need to.
>> >> >
>> >> > Thanks!
>> >> > Ryan
>> >> >
>> >> > On Thu, Jun 19, 2008 at 2:19 AM, Bruce Snyder <
>> [EMAIL PROTECTED]>
>> >> > wrote:
>> >> >
>> >> >> On Wed, Jun 18, 2008 at 7:56 PM, Ryan Moquin <
>> [EMAIL PROTECTED]>
>> >> >> wrote:
>> >> >> > I'm using Servicemix 3.2.1, so I'll give 3.2.2 a try. I was kind
>> of
>> >> >> waiting
>> >> >> > until it was released, but this problem is now cropping up on a
>> >> regular
>> >> >> > basis on a server so I'll definitely give it a shot. Hopefully
>> this
>> >> will
>> >> >> > allow me to get this project done so I can then get that Joram
>> write
>> >> up
>> >> >> done
>> >> >> > since I should have ran across hopefully most of the gotchas for
>> it at
>> >> >> that
>> >> >> > point.
>> >> >>
>> >> >> 3.2.2 will be released very soon and I know it's pretty stable.
>> Maybe
>> >> >> we can release it this weekend.
>> >> >>
>> >> >> Bruce
>> >> >> --
>> >> >> perl -e 'print
>> >> >> unpack("u30","D0G)[EMAIL
>> >> >> PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> >> >> );'
>> >> >>
>> >> >> Apache ActiveMQ - http://activemq.org/
>> >> >> Apache Camel - http://activemq.org/camel/
>> >> >> Apache ServiceMix - http://servicemix.org/
>> >> >>
>> >> >> Blog: http://bruceblog.org/
>> >> >>
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> Guillaume Nodet
>> >> ------------------------
>> >> Blog: http://gnodet.blogspot.com/
>> >>
>> >
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>
>