Setting Classpath for JavaObjectGateway

When calling methods on a java class that refers to other classes, Mediator throws a “ClassDef Not Found” error.

I wrote a simple class that prints the system properties to a file and called it from Mediator. The classpath consisted solely of launcher.jar

How do we set the classpath on the JOG?

regards,
- arp

Hi Arp,

There are two places you can set the classpath for the JOG. First, the xbd.object.classPath argument for the gateway. Second, you can specify additional external jar files in the factory configuration using SMH.

Hope this helps.

Best regards,
Mike

Hi Arp,

I’ll add that jars that invoke code fron native libraries (JNI) need to be in the system classpath.

Regards,

Jason

The problem is the system classpath is not being picked up. When we call our java class we write the value of system class path to a file using
System.getProperty(“java.class.path”);

What we get in this value is "C:\Products\Software AG\Mediator\host/lib/launcher.jar ". This is the same as what is specified in the SMH under System Information. It seems that the system class path is not concatenated when the the ComponentFactory is started.

Chris.

Hi Chris,

I don’t think we are currently offering a direct capability of adding jars to the system class path. The property you should be interested in is however “sun.boot.class.path” and not ?java.class.path?.
As long as you do not introduce a class conflict you could add the jars to this class path by placing them in the XML Mediator Host sub-directory ?/lib?. This will automatically cause the jars to be loaded by the bootstrap loader which should solve the problem you are having.
I would like however to again reemphasize the need to insure you are not introducing class conflicts. The jars you enter into this location will always be loaded, overriding any and all like jars or classes.

Regards,

- Matthew G.

Thanks Matthew, I will give it a try. I am still not quite comfortable that we cannot use the system CLASSPATH and would like some more clarity on this. The product documentation for the WebSphere MQ Example does specify the usee of the system CLASSAPTH. This whole stream came out of testing the WebSphere MQ Series example as documented in the product. We could not get it to work because the System Classpath was not being used. The product documentation…file:///C:/Products/Software%20AG/Mediator/Docs/samples/xbdsmq.htm#xbdsmq specifies in the prerequistes, to place the MQ Series jar files in the system CLASSPATH, this of course happens when you install MQ Series.