tags:

views:

74

answers:

1

Hi Friends,

We are currently in the process of migrating our application from our production environment to a brand new data center.

  • Current Production Environment : Java 1.4, Java EE 3, WAS 5.1, JSF 2.1
  • New Data Center Environment: Java 1.5, Java EE 5, WAS 6.1, JSF 2.1
Our application is built on JSF 2.1 and contains the code below in one of the AJAX calls:
request.getSession().getServletContext().getRequestDispatcher(
        "/results.faces").include(request, response);
And this is where we run into issues.

Case 1: EAR structure as per the standard specs
. EAR -> WAR -> WEB-INF -> lib -> *.jar (all application specific jars are under WEB-INF/lib). This does not work and we kee on getting exceptions for class not found by the classloader. Also, the above AJAX call fails (not output generated)

Case 2: EAR contains all the application JAR files on the root (MANIFEST.MF has the classpath specified manually).
This approach works perfectly and all the JAR files are loaded without any issues. Moreover, the AJAX call also goes through fine.

Any ideas why this could be happenning.

- Ashish

+1  A: 

Yes, it's because Java EE app servers have a hierarchy of class loaders that goes something like this: first the bootstrap class loader is called; next is the EAR level class loader, then the WAR level class loader. Higher level class loaders won't look below for classes they need. If they don't find what they need a ClassNotFoundException will be thrown.

So the JARs in WEB-INF/lib were not visible to the EAR level class loader. When you move those JARs up you solve the problem. It makes all those JARs visible to all WARs in your EAR as well.

One thing you might want to check is the specification for your web.xml and other files. The servlet and JSP specs changed somewhere along the way, so JARs like JSTL and such went from version 1.0 to 1.1. You might want to carefully check your web.xml and all JARs to make sure that they match the specs supported by your Java EE app server.

Unfortunately, upgrading the app server isn't as easy as plopping an EAR or WAR in.

duffymo