Hello Christoph,

ACTIVEMQ_CLASSPATH is by default only set to include the conf/ directory.
E.g. if you start a default AMQ instance and connect to it using jconsole and 
click on the VM Summary tab, then you can see this parameter being passed into 
the JVM as follows

-Dactivemq.classpath=/opt/FUSE/AMQ/apache-activemq-5.5.1-fuse-01-13/conf;       
         

Looking at Main.java of activemq-console, subproject, it seems to be possible 
to add additional classpath entries to activemq.classpath, as this code section 
suggests:

// Add any custom classpath specified from the system property
// activemq.classpath
app.addClassPathList(System.getProperty("activemq.classpath"));


Assuming you have packaged your custom classes into a jar file, you need to add 
the full jar file to the classpath, i.e. 
%ACTIVEMQ_HOME%/customlibs/<file>.jar 

and not just the folder containing the jar file.


The easiest option for you is probably to place you custom classes in form of a 
jar file into the AMQ_HOME/lib/optional folder. That way these classes will be 
found at runtime. 

Hope this helps.



Torsten Mielke
tors...@fusesource.com
tmie...@blogspot.com

On Jan 30, 2012, at 9:06 AM, Christoph Burmeister wrote:

> Hi users,
> 
> I've written some classes (message-transformers for camel-routing) which
> should be used inside ActiveMQ. Actually at the moment I put them into the
> %ACTIVEMQ_HOME%\libs-folder and it works. In real-world deployment I want
> to separate the custom libraries from the ActiveMQ-own libraries while
> putting my own classes in another folder.
> 
> After reading some documentation, it should work with the
> activemq.home-system-property. But my own classes are not found if I change
> the %ACTIVEMQ_CLASSPATH%-variable in activemq.bat from
> 
> set
> ACTIVEMQ_CLASSPATH=%ACTIVEMQ_BASE%/conf;%ACTIVEMQ_HOME%/conf;%ACTIVEMQ_CLASSPATH%
> to
> set
> ACTIVEMQ_CLASSPATH=%ACTIVEMQ_BASE%/conf;%ACTIVEMQ_HOME%/conf;%ACTIVEMQ_HOME%/customlibs;%ACTIVEMQ_CLASSPATH%
> 
> As a workaround I use java.ext.dirs-property this way:
> 
> set ACTIVEMQ_CUSTOM_LIBRARIES = %ACTIVEMQ_HOME%/customlibs
> and then add a property to the calling java-command in activemq.bat:
> -Djava.ext.dirs="%ACTIVEMQ_CUSTOM_LIBRARIES%"
> And now while starting up the broker, my custom libraries are picked up
> from the customlibs-folder.
> 
> This works, no questions, but it would be nicer if somebody could explain
> me, how to use the way with the activemq.classpath-property.
> 
> best,
> christoph
> 
> OS:    Win2k8 R2
> AMQ: 5.5.1
> JVM:  1.6.0_26




Reply via email to