You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jdmturbomr2 <jt...@gmail.com> on 2013/04/10 22:03:10 UTC

How, exactly, to get the vm component to work

Hi, 

I've created a simple test scenario with two classes (separate camel
contexts) and a few very simple routes for the purposes of testing the "vm"
component.  The routes are as follows:

Class1: tcp (via mina) -> vm:test
Class2: vm:test -> file:outbox

Upon running the two classes and sending a message over, I get confirmation
from the first class that the TCP message has been received and sent to the
vm queue.  The second class however, never receives the message.  The camel
documentation says the following:

/[...] VM supports communication across CamelContext instances - so you can
use this mechanism to communicate across web applications (provided that
camel-core.jar is on the system/boot classpath)./

I also found a post from Claus saying:

/Its a cheap way of sharing between multiple WAR files with the cost of
having camel-core in the bootstrap classloader. /

OK.  So I must admit that my knowledge of class loading and how that works
is a bit limited, however I believe I've done my due diligence and wrestled
with this for bit and I simply cannot get it to work.  I have all of the
jars that come with the camel distribution specified in the "Java Build
Path" of my project in Eclipse.  In Eclipse there is a "Run Configurations"
dialog.  Within that dialog there is a "Classpath" tab.  Within that tab
there are two nodes: "Bootstrap Entries" and "User Entries".  I have tried
adding multiple jars (including the camel-core jar as referenced above) to
the "Bootstrap Entries" node.  Unfortunately, every time I am greeted with
an exception of some kind.  What am I missing?  Is there a simple guide on
how to get this vm component working?



--
View this message in context: http://camel.465427.n5.nabble.com/How-exactly-to-get-the-vm-component-to-work-tp5730678.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How, exactly, to get the vm component to work

Posted by laowai <ra...@gmail.com>.
Hi,

I'm struggling with this exactly same issue, how to get the VM component to
work. I'm at the same point as OP, trying to figure out how to share
camel-core between the WAR files. Also, I'm not expert in class loading but
can see from the logs that the problems are related to dependecies.

I'm running WARs in Apache Tomcat and using Maven projects to build the WAR
files.

The main problem I'm having at the moment is that I cannot sort out the
dependencies for the shared camel-core. If I share only camel-core component
I get class loader exception related to Log dependecies. If I share also
log4j, slf4j and slf4j-api (dependencies included by default in the maven
project) I get exception related to commons-log. If I remove all log
dependencies there is another exception.

I'm quite sure that OP has same/similar problem with the dependencies as
sharing just camel-core doesn't seem to be enough.

The unit tests are demonstrating how to use VM, but doesn't answer to the
question how to share the camel-core which is key to get the VM working.

Are there some other packages that must be also shared with camel-core? Any
documentation, tutorials, examples about how to share camel-core?

Thanks




--
View this message in context: http://camel.465427.n5.nabble.com/How-exactly-to-get-the-vm-component-to-work-tp5730678p5731878.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How, exactly, to get the vm component to work

Posted by Christian Mueller <ch...@gmail.com>.
Our unit tests are a good source [1].

[1]
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/vm/

Best,
Christian



--
View this message in context: http://camel.465427.n5.nabble.com/How-exactly-to-get-the-vm-component-to-work-tp5730678p5730733.html
Sent from the Camel - Users mailing list archive at Nabble.com.