Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1778
  • Last Modified:

WEB-INF/lib : Jar location problem for mqccf.jar

Hi all,

We are migrating our websphere 4.0 to websphere 5.0.1 and also WSAD4.0 to WSAD 5.0. We have one project which uses mqccf.jar that comes with VA for java 3.x version. we used to to include this jar in application classpath. with websphere 5.0.1 migration, I put this mqccf.jar file in application class path. with this change I am not even able to start my app server. The reason might be it is over writing mq.jar which is used by embeded JMS server.

Then I put the jar file in WEB-INF/lib. Now I am able to start my app server. But my classes unable to find classes avaible in mqccf.jar.So i am getting below exception.

[4/6/04 19:24:13:621 EDT]    c05c2 ExceptionUtil E CNTR0020E: Non-application exception occurred
 while processing method "getQueueDepthForMonitoring" on bean "BeanId(CRMSMS#CRMSMSEJB.jar#CRMMe
ssaging, null)". Exception data: java.lang.NoClassDefFoundError: com/ibm/connector/mq/MQCommunic
ationErrorException

My Questions are

*) How websphere app server locates jar files available in WEB-INF/lib?
*) why I am unable to start my app server if I include VA for Java mqccf.jar in my app server classpath?

Please suggest me a solution for this problem.


Thanks in advance,
Ravi Kothyala






0
kothyala
Asked:
kothyala
1 Solution
 
pluimCommented:
From the symptoms you're describing, WAS doesn't start because the mqccf.jar is taking precedence over mq.jar if you put it in the app server classpath.
The older mqccf.jar doesn't have the necessary functions/ classes/ implementation, causing WAS to fail.

The error you're getting when you put the jar in WEB-INF/lib suggests that WAS is selecting mq.jar before mqccf.jar, i.e. the app server classpath takes precedence over WEB-INF/lib. The setup you want is
(a) application server uses mq.jar
(b) application uses mqccf.jar

Take a look at the article J2EE class loading demystified (http://www-106.ibm.com/developerworks/websphere/library/techarticles/0112_deboer/deboer.html).
Relevant section:

-------
The most important concept in Figure 1 above is that each classloader is defined as a child of the classloader above it. A classloader can have delegation turned on or off. The first two classloaders (Java and WebSphere) have it turned on and the last two (AEX and module) have it turned off.

When delegation is turned on, the classloader first delegates the request to its parent classloader. If none of the parent classloaders can find the class, the original classloader attempts to load the class.

When delegation is turned off, the classloader first attempts to load the class itself. If it can't load the class, it asks its parent to load the class.
In either case, requests can only go up the tree; they cannot go down. If the WebSphere classloader is requested to find a class in a J2EE module, it cannot go down to the module classloader to find that class, and a ClassNotFoundException will occur. After a class is loaded by a classloader, any new classes that it tries to load will reuse the same classloader, or go up the chain until the class is found.
-------

To accomplish what you want, you need to turn delegation OFF. All this assumes mqccf.jar can actually co-exist in this environment. If there is a real compatibility problem, then solving the classloader issue won't help.

0
 
greyfairerCommented:
Jars that are in WEB-INF/lib are found by the classloader for the web module it is contained in, not for the entire ear.  Since you need to access them from an EJB (I assume -> CRMSMSEJB.jar), you have to make it available for the ejb-jar.  One solution that should work, is to include mqccf.jar as a dependency jar in your ear, that is, at the same level as your ejb jar, and reference it from the META-INF/MANIFEST.MF in a Classpath entry:
Class-Path: mqccf.jar

When starting the EJB Module, the classloader will read this section, and will try to locate the dependendcy jar relative to the ear root. See also http://www.theserverside.com/articles/content/J2EE-Deployment/chapter.html
0
 
kothyalaAuthor Commented:
Thanks a Bunch...It really saved my time.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now