I'll try giving it another try later today. I did remove the old
servicemix JAR and I was using the new SNAPSHOT JAR. Of course, I was
doing all of this while fending of trick-or-treaters coming to my door, so
I may have made a mistake...
> Some basic questions, but ...
> Have you removed from the classpath the old version of servicemix ? Do
> you use the latest snapshot ?
> If you answer yes to the two questions, could you please test if the
> MessageExchange
> are correctly serialized / deserialized.
> Using the following code:
>
> MessageExchange me = new InOnlyImpl("exchangeId");
> NormalizedMessage msg = me.createMessage();
> me.setMessage(msg, "in");
> msg.setContent(new StringSource("<hello>world</hello>"));
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> ObjectOutputStream oos = new ObjectOutputStream(baos);
> oos.writeObject(me);
> oos.close();
>
> ByteArrayInputStream bais = new
> ByteArrayInputStream(baos.toByteArray());
> ObjectInputStream ois = new ObjectInputStream(bais);
> Object out = ois.readObject();
> System.out.println(((MessageExchange)
> out).getMessage("in").getContent());
>
> Could you check that the out object has a content ?
> If no, then one of the two previous questions is not correct ;) as this
> works perfectly for me.
>
> Cheers,
> Guillaume Nodet
>
> Craig Walls wrote:
>
>>
>> Incidentally...after all of that...I still can't seem to get the
>> content sent across container boundaries. In summary, here's what I
>> did:
>>
>> 1. Placed the 2.0 SNAPSHOT and those other 3 JARs in my classpath. 2.
>> Moved up to Java 5 to avoid the invalid class version error when
>> compiling
>> 3. Started up the services container.
>> 4. Rolled my own XmlWebApplicationContext that instantiates itself
>> with the XBeanProcessor.
>> 5. Deployed the web client.
>>
>> From all indications, the content that I'm setting on the client side
>> of the exchange never makes it to the service-side. Properties make
>> the trip, but the content does not.
>>
>> Any clues?
>>
>>
>> Craig Walls wrote:
>>
>>>
>>> Okay, I moved up to Java 1.5 and have the service-side of my example
>>> working with the 2.0 SNAPSHOT. I'm loading the container myself in
>>> Spring code that is similar to the code in org.servicemix.Main:
>>>
>>> List processors = Arrays.asList(new Object[] { new
>>> XBeanProcessor() });
>>> new ClassPathXmlApplicationContext(
>>> "com/habuma/pig/service/service-container.xml", processors);
>>>
>>> But I run into a wrinkle with the client-side...You see, the client
>>> side of my example is web-based. Previously (with version 1.1), I had
>>> this in my web.xml file:
>>>
>>> <servlet>
>>> <servlet-name>pig</servlet-name>
>>>
>>> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
>>>
>>>
>>> <load-on-startup>1</load-on-startup>
>>> <init-param>
>>> <param-name>contextClass</param-name>
>>>
>>> <param-value>org.servicemix.jbi.config.XmlWebApplicationContext</param-value>
>>>
>>>
>>> </init-param>
>>> </servlet>
>>>
>>> Now that I'm at 2.0, I figured that I should probably be using the
>>> XBean version of XmlWebApplicationContext...not a problem...
>>>
>>> <init-param>
>>> <param-name>contextClass</param-name>
>>>
>>> <param-value>org.xbean.spring.context.XmlWebApplicationContext</param-value>
>>>
>>>
>>> </init-param>
>>>
>>> But here's the problem...using "1.1 compatibility" I need to be able
>>> to set an XBeanProcessor on XmlWebApplicationContext, similar to what
>>> I did on the service side. Except that I don't instantiate
>>> XmlWebApplicationContext. DispatcherServlet has that honor.
>>> Therefore, there's no clear way to set the XBeanProcessor and so the
>>> XmlWebApplicationContext doesn't know how to parse the
>>> ServiceMix-specific context.
>>>
>>> There are a few options:
>>>
>>> * My client's container doesn't have any of its own components, so
>>> I
>>> suppose that I could use standard Spring XML to configure the
>>> container. But if I decide to add a service to that container
>>> then things get ugly.
>>> * I could go put the appropriate property file in META-INF and
>>> declare an xmlns in my XML to handle the ServiceMix-specific
>>> stuff. But in my opinion the fact that ServiceMix is using XBean
>>> should be as transparent to me as possible. Having to tweak my
>>> XML to explicitly say that I'm using ServiceMix tags via XBean
>>> seems kinda dirty to me.
>>> * Perhaps a custom ServiceMix-specific DispatcherServlet could be
>>> written that handles the creation of XmlWebApplicationContext
>>> appropriately.
>>> * Or perhaps (and maybe even better), the ServiceMix version of
>>> XmlWebApplicationContext could extend the XBean version and
>>> properly register the XBeanProcessor. This means I'd have to
>>> change web.xml back to use the old ServiceMix-specific
>>> XmlWebApplicationContext...but that's okay with me.
>>>
>>> What advice is there for me? Any ideas on how to deal with this? I
>>> favor the last option...here's what I've got that seems to do the
>>> trick:
>>>
>>> package org.servicemix.jbi.config;
>>>
>>> import java.util.Arrays;
>>>
>>> import org.servicemix.jbi.config.spring.XBeanProcessor;
>>>
>>> public class XmlWebApplicationContext extends
>>> org.xbean.spring.context.XmlWebApplicationContext {
>>> public XmlWebApplicationContext() {
>>> super(Arrays.asList(new Object[] { new XBeanProcessor() }));
>>> }
>>> }
>>>
>>>
>>>
>>>
>>> Guillaume Nodet wrote:
>>>
>>>> Hi All !
>>>>
>>>> A snapshot of ServiceMix 2.0 has been deployed at
>>>> http://dist.codehaus.org/servicemix/jars/servicemix-2.0-SNAPSHOT.jar
>>>> It includes a number of bug fixes, especially on cluster flow (for
>>>> Craig) and sendSync on pub/sub (for George).
>>>>
>>>> To use it on a 1.x distribution, you will need to put the jar at the
>>>> place of the old one (do not forget to remove the old one from the
>>>> classpath).
>>>> It works the same way, and you can access the compatibility mode in
>>>> the following way :
>>>> ..\..\bin\servicemix -v1 servicemix.xml
>>>>
>>>> You will certainly encouter a number of ClassNotFoundException. You
>>>> will need to add the following jars to the classpath:
>>>> http://dist.codehaus.org/xbean/jars/xbean-spring-2.0-SNAPSHOT.jar
>>>> http://www.ibiblio.org/maven/springframework/jars/spring-1.2.5.jar
>>>>
>>>> http://www.ibiblio.org/maven/backport-util-concurrent/jars/backport-util-concurrent-2.0_01_pd.jar
>>>>
>>>>
>>>>
>>>> Do not forget to remove the old spring jar from the classpath too.
>>>>
>>>> Enjoy !
>>>>
>>>> Cheers,
>>>> Guillaume Nodet