Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.
(Answer) (Category) Java Apache Project : (Category) Apache JServ 1.0 : (Category) Programming and Misc. Tidbits :
Dynamically loading classes from servlets
Many users complained about the fact that after placing a certaing set of files in a repository, these files were not accessed via Class.forName() or equivalent methods. Others also noticed that, moving the same entry from the "repository=" property in file zone.properties to the "wrapper.classpath=" in jserv.properties file, resulted in successfully restoring this capability.

In other words:
   [jserv.properties]
   wrapper.classpath=/usr/java/lib/jsdk20.jar

   [zone.properties]
   repository=/usr/java/servlets,/usr/java/lib/foo.jar
Class.forName("org.foo.Bar") doesn't work (where class "org.foo.Bar" is contained in "/usr/java/lib/foo.jar") while
   [jserv.properties]
   wrapper.classpath=/usr/java/lib/jsdk20.jar:/usr/java/lib/foo.jar

   [zone.properties]
   repository=/usr/java/servlets
Class.forName("org.foo.Bar") works.

This happens because repositories are NOT merged with the JVM class path, and, so, unaccessible from the system ClassLoader.

But why that? Because, to be able to give to JServ the ability of autoreloading servlet classes when these were changed, we had to create a different ClassLoader, and to use a different ClassLoader for each servlet zone.

This also gives other benefits, expecially about security, in fact a certain zone cannot access classes and servlets specified in a different zone, and so a servlet in zone "Foo" cannot access to the servlet "MyServlet" specified in zone "Bar" when these two zones have different "repository=" entries in the two zone.properties files.


pierATapacheDOTorg
[Append to This Answer]
Previous: (Answer) Blackdown jdk1.2 and RH6.0
Next: (Answer) Why Single Thread Model is a BAD thing...
This document is: http://java.apache.org/faq/?file=163
[Search] [Appearance] [Show Expert Edit Commands]
This is a Faq-O-Matic 2.709.
Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.