aspose file tools*
The moose likes Tomcat and the fly likes Common classloader Tomcat 7 versus 6, using SAP JCO library Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Common classloader Tomcat 7 versus 6, using SAP JCO library" Watch "Common classloader Tomcat 7 versus 6, using SAP JCO library" New topic
Author

Common classloader Tomcat 7 versus 6, using SAP JCO library

Ralf Mertens
Greenhorn

Joined: Feb 06, 2013
Posts: 2
Hi,

I wrote some web application (based on .jsp) running on Tomcat 6 using SAP's Java Connector.
The Java Connector files (.jar und some native .dll) are placed in the tomcat/lib folder.

I wrote a custom realm for tomcat that uses the Java Connector to authorize the user
in SAP. The web application also communicates via the pre-loaded Java Connector with
SAP. All this works fine for several years now, with hundreds of users.

Now I tried to upgrade to Tomcat 7 and encountered severe problems.

After converting the realm to Tomcat 7 the realm establishes the SAP connection correctly, but
when the web application is started, a new instance of the Java Connector is established and
this instance builds a new connection to SAP.
The problem is, that the Java Connector may only run once in the JVM, so at this point only one
user can use the web application. Starting the web application from another client causes errors.

It seems, that the web application class loader ignores the already loaded and initialized classes
in the common class loader (the static variables in the classes are null at startup of the web
application, even though the realm initialized the classes).

I tried to use the shared-class loader, but the realm requires to be loaded in the common class loader.
When the realm is loaded, the shared-class loader seems not to be present.

Any suggestions what to do ?

Regards
Ralf
Ralf Mertens
Greenhorn

Joined: Feb 06, 2013
Posts: 2
Problem solved.
I moved the Java Connector Files to the tomcat/bin folder.
Seems that all .jars from this folder are initialized at startup, and are accessible
for both tomcat system modules (as realms) and web-applications.

Regards
Ralf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Common classloader Tomcat 7 versus 6, using SAP JCO library