I was a bit puzzled when I first read your mail because this would
have implied that the NotificationBroker has never worked :-( But now
I've understood the problem.
If you give a JBIContainer or ComponentContext when constructing the
NotifiationBroker object, it creates a client with a JAXBMarshaler
which overrides the very method that fails. Unfortunately, when
giving a ServiceMixClient, the marshaler is not changed and the
DefaultMarshaler is used.
I guess it should be possible to set a jaxb marshaler on the client
before constructing the NotificationBroker to workaround your
problem... but I guess it would be better if the the marshaler is
automatically set to a JAXB one instead.
I suppose the same thing may happen with the other class in the wsn
client api...
Wanna raise a jira and provide a patch ?
On 9/21/07, Ryan Moquin <[EMAIL PROTECTED]> wrote:
> Ok, I think this is a bug in some form (that the very least and exception or
> message should be logged). It appears that servicemix doesn't like my
> object is silently tosses it into the trash:
>
> This method (in NotificationBroker) gets executed with my object and a
> org.oasis_open.docs.wsn.b_2.Notify is constructed:
>
> public void notify(String topic, Object msg) throws JBIException {
> Notify notify = new Notify();
> NotificationMessageHolderType holder = new
> NotificationMessageHolderType();
> if (topic != null) {
> TopicExpressionType topicExp = new TopicExpressionType();
> topicExp.getContent().add(topic);
> holder.setTopic(topicExp);
> }
> holder.setMessage(new NotificationMessageHolderType.Message());
> holder.getMessage().setAny(msg);
> notify.getNotificationMessage().add(holder);
> send(notify);
> }
>
> Eventually this method gets executed (in DefaultMarshaller) with the Notify
> object that was created as the parameter in body, but since the Notify
> object isn't an instance of any of the 3 things it's looking for, it returns
> null (actually the message variable isn't even used in this method):
>
> protected Source asContent(NormalizedMessage message, Object body) {
> if (body instanceof Source) {
> return (Source) body;
> } else if (body instanceof String) {
> // lets assume String is the XML to send
> return new StringSource((String) body);
> } else if (body instanceof Node) {
> return new DOMSource((Node) body);
> }
> return null;
> }
>
> This null then is put into the message variable as the content (line 56 on
> DefaultMarshaller), hence my object gets tossed:
>
> Source content = asContent(message, body);
> message.setContent(content);
>
> This was all called by DefaultServicemixClient, which returns back to the
> following method, with the in variable now populated with null as the
> content:
>
> protected void populateMessage(MessageExchange exchange, Map
> exchangeProperties,
> Map inMessageProperties, Object content)
> throws MessagingException {
> NormalizedMessage in = exchange.getMessage("in");
> populateExchangeProperties(exchange, exchangeProperties);
> populateMessageProperties(in, inMessageProperties);
> getMarshaler().marshal(exchange, in, content);
> }
>
> I'll jira this since an action item of some kind should definitely be done,
> I'd go ahead and patch it but I'm not completely sure what kind of class
> it's expecting in the asContent method yet.
>
> On 9/20/07, Ryan Moquin <[EMAIL PROTECTED]> wrote:
> >
> > I did debug my app and it is submitting an object that is not null, which
> > is why this is puzzling. Initially I thought maybe I was trying to through
> > a null object in there. I'll do some poking around and see if I can find
> > where it might be going haywire.
> >
> > On 9/20/07, Guillaume Nodet <[EMAIL PROTECTED]> wrote:
> > >
> > > The client does not send anything for an unknown reason.
> > > You can see that because the in message has a null content.
> > > This is what causes the exception.
> > > I suggest to remote debug the app to see what happens...
> > > Just set the environment variable SERVICEMIX_DEBUG to TRUE, launch
> > > servicemix and debug from eclipse or your favorite ide...
> > >
> > > On 9/20/07, Ryan Moquin <[EMAIL PROTECTED] > wrote:
> > > > I don't get much more, but here is what I see now:
> > > >
> > > > DEBUG - WSNComponent - Received exchange: status:
> > > Active,
> > > > role: provider
> > > > DEBUG - WSNComponent - Retrieved correlation id:
> > > null
> > > > ERROR - WSNComponent - Error processing exchange
> > > InOnly[
> > > > id: ID:10.40.16.154-1152419544a-28:1
> > > > status: Active
> > > > role: provider
> > > > endpoint: Broker
> > > > in: null
> > > > ]
> > > > java.lang.IllegalArgumentException: source parameter must not be null
> > > > at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(
> > > > AbstractUnmarshallerImpl.java:98)
> > > > at org.apache.servicemix.wsn.component.WSNEndpoint.process(
> > > > WSNEndpoint.java:128)
> > > > at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(
> > > > AsyncBaseLifeCycle.java:538)
> > > > at
> > > org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(
> > > > AsyncBaseLifeCycle.java:490)
> > > > at
> > > org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(
> > > > BaseLifeCycle.java:46)
> > > > at
> > > > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound
> > > (
> > > > DeliveryChannelImpl.java:610)
> > > > at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> > > > AbstractFlow.java :170)
> > > > at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(
> > > > SedaFlow.java:167)
> > > > at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(
> > > > SedaQueue.java:134)
> > > > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
> > > > ThreadPoolExecutor.java:650)
> > > > at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> > > > ThreadPoolExecutor.java:675)
> > > > at java.lang.Thread.run (Thread.java:595)
> > > > DEBUG - DeliveryChannelImpl - Send ID:
> > > 10.40.16.154-1152419544a-28:1
> > > > in DeliveryChannel{servicemix-wsn2005}
> > > > DEBUG - SedaFlow - Called Flow send
> > > > DEBUG - SedaQueue -
> > > > [EMAIL PROTECTED] dequeued
> > > > exchange: I
> > > > nOnly[
> > > > id: ID:10.40.16.154-1152419544a-28:1
> > > > status: Error
> > > > role: consumer
> > > > endpoint: Broker
> > > > in: null
> > > > error: java.lang.IllegalArgumentException: source parameter must not
> > > be
> > > > null
> > > > ]
> > > > DEBUG - DeliveryChannelImpl - Notifying exchange ID:
> > > > 10.40.16.154-1152419544a-28:1(e99889) in DeliveryChannel{I
> > > > D:10.40.16.154-1152419544a-0:1} from processInboundSynchronousExchange
> > > > DEBUG - DeliveryChannelImpl - Notified: ID:
> > > > 10.40.16.154-1152419544a-28 :1(e99889) in DeliveryChannel{ID:10.40.1
> > > > 6.154-1152419544a-0:1} from sendSync
> > > >
> > > > On 9/20/07, Guillaume Nodet <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > It seems that nothing is received by then WS-Notification component.
> > >
> > > > > Can you raise the log level to DEBUG and see what is displayed ?
> > > > >
> > > > > On 9/20/07, Ryan Moquin <[EMAIL PROTECTED]> wrote:
> > > > > > It's actually the JAXB objects I generated with CXF for my
> > > webservices.
> > > > > > Those should be JAXB2 elements. They are the elements I return
> > > from my
> > > > > > webservice to a connected client.
> > > > > >
> > > > > > On 9/20/07, Guillaume Nodet < [EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > What kind of object do you send ? IIRC it has to be a DOM
> > > element or a
> > > > > > > JAXB2 pojo so that JAXB2 can marshal it to xml.
> > > > > > >
> > > > > > > On 9/20/07, Ryan Moquin <[EMAIL PROTECTED]> wrote:
> > > > > > > > I'm having some trouble when attempting to publish a
> > > > > notification. When
> > > > > > > I
> > > > > > > > do, I get this error:
> > > > > > > >
> > > > > > > > ERROR - WSNComponent - Error processing
> > > exchange
> > > > > > > InOnly[
> > > > > > > > id: ID:192.168.1.2-11520deb240-28:0
> > > > > > > > status: Active
> > > > > > > > role: provider
> > > > > > > > endpoint: Broker
> > > > > > > > in: null
> > > > > > > > ]
> > > > > > > > java.lang.IllegalArgumentException: source parameter must not
> > > be
> > > > > null
> > > > > > > > at
> > > javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal
> > > > > (
> > > > > > > > AbstractUnmarshallerImpl.java:98)
> > > > > > > > at
> > > org.apache.servicemix.wsn.component.WSNEndpoint.process(
> > > > > > > > WSNEndpoint.java:128)
> > > > > > > > at
> > > org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess
> > > > > (
> > > > > > > > AsyncBaseLifeCycle.java:538)
> > > > > > > > at
> > > > > > > org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(
> > > > > > > > AsyncBaseLifeCycle.java:490)
> > > > > > > >
> > > > > > > > My code that causes this is:
> > > > > > > >
> > > > > > > > private void sendNotification(Object notification) {
> > > > > > > > try {
> > > > > > > > if(wsnBroker == null)
> > > > > > > > createWsnBroker();
> > > > > > > > wsnBroker.notify("notificationTopic", notification);
> > > > > > > > } catch (Exception e) {
> > > > > > > > e.printStackTrace();
> > > > > > > > }
> > > > > > > > }
> > > > > > > >
> > > > > > > >
> > > > > > > > I've looked and my notification object isn't null, is there
> > > > > something
> > > > > > > called
> > > > > > > > source somewhere that I need to set?
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Cheers,
> > > > > > > Guillaume Nodet
> > > > > > > ------------------------
> > > > > > > Blog: http://gnodet.blogspot.com/
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Cheers,
> > > > > Guillaume Nodet
> > > > > ------------------------
> > > > > Blog: http://gnodet.blogspot.com/
> > > > >
> > > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > > ------------------------
> > > Blog: http://gnodet.blogspot.com/
> > >
> >
> >
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/