portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [jira] Commented: (JS2-56) Objects Fail to Create with Tomcat Classloaders and cross context
Date Thu, 27 May 2004 20:15:04 GMT
The following comment has been added to this issue:

     Author: David Sean Taylor
    Created: Thu, 27 May 2004 1:14 PM
Another solution to consider:
loading User info and preferences when the user logs in

I've been reviewing Tomcat's code, and I don't see any pluggable Class loader implementation.
I found:


For the StandardClassLoader, they Bootstrap creates a hard-coded loader:

            unpacked[0] = new File(getCatalinaHome(),
                                   "common" + File.separator + "classes");
            packed2[0] = new File(getCatalinaHome(),
                                  "common" + File.separator + "endorsed");
            packed2[1] = new File(getCatalinaHome(),
                                  "common" + File.separator + "lib");

I haven't got thru the WebappClassLoader yet, which is really the class loader we need to

Just leaves me wishing Tomcat had pluggable components.

Im also concerned that this approach requires us to manipulate the class loaders for each
app server.

View this comment:

View the issue:

Here is an overview of the issue:
        Key: JS2-56
    Summary: Objects Fail to Create with Tomcat Classloaders and cross context
       Type: Task

     Status: Open
   Priority: Major

    Project: Jetspeed 2
             Components Core
   Fix Fors:

   Assignee: David Sean Taylor
   Reporter: David Sean Taylor

    Created: Tue, 25 May 2004 9:35 PM
    Updated: Thu, 27 May 2004 1:14 PM
Environment: Tomcat 4 and 5

J2 uses a cross-context class loader to share objects created in the jetspeed context with
other portlet application contexts. This works fine when objects have already been instantiated
in the jetspeed context. 

J2 infuses a common servlet into every portlet application that is deployed into a Tomcat
application server via the J2 portal's PAM (Portlet Application Manager). The code that runs
in this servlet is placed in Tomcat's shared/lib directory so that both Jetspeed common servlet
and the Jetspeed portal can share objects. 

The problems I am seeing with this approach are rooting in the creation of new objects. For
example, if a portlet application, such as the HW_App, has a portlet UserInfo, that requires
creation of preference objects. Preference objects by OJB. Looking at the code used by the
ojb object broker


you see object creation taking place as:

  result = constructor.newInstance(NO_ARGS);

And this code fails, class not found exception. It fails to find the object to be created,
such as a NodeImpl, which is deployed in the Prefs jar, normally stored under jetspeed's WEB-INF/lib
directory. This tells me that the classloader being used by the code above is not the same
as the cross-context classloader in Tomcat...or...the Tomcat cross-context class loader is
not designed to handle this kind of object construction.

I think we have several directions we can take for a solution
One experiment I tried with Tomcat 4.1.30, was:

1. move every jar out of WEB-INF/lib into shared/lib
2. delete all classes under WEB-INF/classes
3. copy jetspeed-2.0-a1.jar into shared/lib
4. move the JDBC driver into Tomcat's system directory or into the classpath

This seemed to work, although for some reason I could not login to the LoginPortlet tonight.
Not sure if its related. The solution is simple here: move everything down into shared/lib.

A second solution would be to replace Tomcat's cross-context class loader with our own.
Although I have not found a 'pluggable' way to do this.

A third solution would be to modify the classloader in the Jetspeed common servlet.
I have started some testing in this area without any success (yet):


see the infuseClasspath method

This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:

If you want more information on JIRA, or have a bug to report see:

To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org

View raw message