Troubleshooting
Problem
The visual snippet editor allows you to search and find methods in classes available only on a restricted basis at runtime. A runtime exception occurs when the Java™ snippet calls a method in a class found in one of the plugin JARs in the server's plugins directory.
Cause
Some of the Java methods found in the JARs in the server's plugin directory are available to be called, but some of them are considered internal use only and an exception is thrown if you try to call them from user code.
Diagnosing The Problem
A runtime exception is detected in the server log naming a class and method called from a visual snippet in the application.
Resolving The Problem
The reason the method you selected in the snippet editor cannot be called in the JAR in the plugins directory is because of the architecture of the server. JARs in the plugins directory have a list that specifies what classes in the JAR can be called. This is called the exports list, and it is honored by the class loader the server uses. Classes not on the list are considered internal use only. Thus, not all classes in the server plugin JARs are available to be called by user code.
You can call any method when the JAR is in the server's library directorym because it is not being treated as a plugin and a different class loader is used, one which does not implement the exports list.
The snippet editor is not aware of this mechanism so it treats a plugin JAR the same as a regular Java JAR file. That is it allows you to select the (unavailable) class and method to call in your program. The resolution is to make sure that classes you call in plugin JARs appear on the exports list.
For example you may search for StringUtils and find the class org.apache.commons.lang.StringUtils in the WebSphere JAR plugin/com.ibm.ws.jpa.jar. This class is used internally by the plugin and it is not exported. In this case you must download the class you need directly from Apache and place the JAR in the server's classpath.
Was this topic helpful?
Document Information
More support for:
WebSphere Integration Developer
Software version:
7.0.0.5, 7.0.0.4, 7.0.0.3, 7.0.0.2, 7.0.0.1, 7.0
Operating system(s):
Linux, Windows
Document number:
157951
Modified date:
15 June 2018
UID
swg21497604