WebSphere Message Brokers
File: as24996_
Writer: Lorraine Waitt

Concept topic

This build: July 31, 2007 21:38:52

User-defined node classloading

When a Java user-defined node is packaged as a PAR file, the Java user-defined node is loaded in a separate classloader. The classloader loads any class that is packaged within the deployed PAR. The classes that are placed in the JAR override any classes that are in the shared classes directory or the CLASSPATH environment variable. If the deployed PAR contains more than one node type, the nodes share the same classloader. Therefore, a set of user-defined nodes that share static data should be packaged in a single PAR file. Java user-defined nodes that are packaged as simple JAR files are loaded in the same classloader. The classes and the location from which they are loaded are written to user trace, so you can use this information to check that the correct classes are being loaded.

The broker uses the following classloader tree:

The diagram shows the components of the classloader tree that are used by the broker. The Bootstrap is the root node of the tree and has the System as its only child. The child of System is Common. Common has two children: Broker and Shared. Broker doesn't have any children, and Shared has many children. The children of Shared include Grouped, and Java user-definde nodes. There can be any number of Java user-defined nodes.

The following describes the components in the classloader tree:

User-defined nodes classloading search paths

User-defined nodes package in a PAR

The broker uses the following search path to find user-defined node classes:
  1. /classes to locate classes in the deployed PAR.
  2. /lib to locate any JAR files in the deployed PAR.
  3. <WorkPath>/shared-classes/ to locate any JAR files.
  4. CLASSPATH environment variable.

User-defined nodes package in a JAR

The broker uses the following search path to find user-defined node classes:
  1. The deployed JAR file.
  2. <WorkPath>/shared-classes/ to locate any JAR files
  3. CLASSPATH environment variable.

Endorsed standards for overriding classes

The endorsed standards overriding mechanism allows the following standard packages to be overridden in the JRE:

  • javax.rmi.CORBA
  • org.omg.CORBA
  • org.omg.CORBA.DynAnyPackage
  • org.omg.CORBA.ORBPackage
  • org.omg.CORBA.portable
  • org.omg.CORBA.TypeCodePackage
  • org.omg.CORBA_2_3
  • org.omg.CORBA_2_3.portable
  • org.omg.CosNaming
  • org.omg.CosNaming.NamingContextExtPackage
  • org.omg.CosNaming.NamingContextPackage
  • org.omg.Dynamic
  • org.omg.DynamicAny
  • org.omg.DynamicAny.DynAnyFactoryPackage
  • org.omg.DynamicAny.DynAnyPackage
  • org.omg.IOP
  • org.omg.IOP.CodecFactoryPackage
  • org.omg.IOP.CodecPackage
  • org.omg.Messaging
  • org.omg.PortableInterceptor
  • org.omg.PortableInterceptor.ORBInitInfoPackage
  • org.omg.PortableServer
  • org.omg.PortableServer.CurrentPackage
  • org.omg.PortableServer.POAManagerPackage
  • org.omg.PortableServer.POAPackage
  • org.omg.PortableServer.portable
  • org.omg.PortableServer.ServantLocatorPackage
  • org.omg.SendingContext
  • org.omg.stub.java.rmi
  • org.w3c.dom
  • org.xml.sax
  • org.xml.sax.ext
  • org.xml.sax.helpers
Refer to the Endorsed Standards Override Mechanism for more information.

To override these packages in the broker, place the JAR files for the API standards in the /lib directory of the PAR.

JNDI context

When looking up a JNDI context, the context classloader is used. If the lookup uses classes that are packaged with the user-defined node, the context classloader must be the same as the classloader that is being used to load the user-defined node. To ensure that each thread uses the same classloader, the following code can be included in the user-defined node class:
Thread.currentThread.setContextClassLoader(this.getClass().getClassLoader());
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:38:52

as24996_ This topic's URL is: