camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DominicTulley <dominic.tul...@telelogic.com>
Subject Re: CAMEL and ActiveMQ5 - Integration - Progress!
Date Tue, 14 Aug 2007 13:34:05 GMT

This is a bit bizarre now...

I duplicated your experiment with the examples jar and sure enough it all
worked.

So, I looked at my jar and the only significant difference I could see was
that I didn't have a META-INF/spring/camel-context.xml in it.  So, I put one
in (copied from the example that worked) and it started working.

So,  do I need to have camel-context.xml in the jar (and if so, does it have
to be in a spring subdirectory of META-INF)?

Now, the really bizarre bit is that I took the camel-context.xml out again
(to prove it really was the thing that mattered) and it still worked!

So, I now have a jar which contains a RouteBuilder and the RouteBuilder is
loaded and configured as it should be.  I just don't understand why. 
Perhaps ActiveMQ is caching something that's letting it work subsequently..

I'd really like to get to the bottom of this - mainly so that this
discussion thread can contain the solution for anyone else that encounters
it..

Thanks,

-Dominic


James.Strachan wrote:
> 
> On 8/14/07, DominicTulley <dominic.tulley@telelogic.com> wrote:
>> This is also the problem I am now facing (I started another thread on it,
>> but
>> this one is also good).
>>
>> I have debugged through the point where the loading appears to occur
>> (org.apache.camel.util.ResolverUtil) and the class loader is not
>> returning a
>> URL to the jarfile that contains my builder (in fact the call to the
>> class
>> loader returns an empty Enumeration of URLs irrespective of what package
>> name is provided - and the package name IS being passed incorrectly to
>> this
>> method).   For instance, even if I provide a package of "org", the
>> classloader returns an empty enumeration.  This suggests to me there is
>> an
>> issue with the state of the classpath at the point when this is running
>> (no
>> doubt ActiveMQ and Spring do their own terribly clever things during
>> this).
>>
>> If I run a simple test case of the code (copy and paste bits of the code
>> and
>> run it in eclipse) then it works just fine.  It's definitely something to
>> do
>> with when it's running within ActiveMQ.
>>
>> I'm wondering if dynamic loading of RouteBuilders has ever been observed
>> to
>> work in ActiveMQ (do I stand a chance of making it work?) or is this a
>> significant issue that will need investigating and resolving?
> 
> It should work! :)
> 
> So I just did a test to check this really does work. Here's what I did.
> 
> * copied the camel-example-spring.jar into the activemq/lib directory
> (in the binary distro of 5.x).
> * editied the conf/activemq.xml to look like this...
> 
>   <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring">
>      <package>org.apache.camel.example</package>
>   </camelContext>
> 
> Then I started ActiveMQ and it just worked (I saw the queue
> "test.MyQueue" in the web console - then when I sent a message via the
> web console the camel processing log message appeared in the console).
> 
> I wonder - if the change you hit is the change from the "packages"
> attribute in camel 1.0 to the 0-many <package> elements in Camel 1.1?
> 
> I've just added a little warning to the 1.1 download page in case thats
> it...
> http://cwiki.apache.org/CAMEL/camel-110-release.html
> 
> also I've patched the activemq.xml in trunk with comments to show the
> new syntax etc.
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/CAMEL-and-ActiveMQ5---Integration-tf4140859s22882.html#a12144599
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message