[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] [Home]

Re: ApJServAction v/s AddAction & ghost classes


Hi Eric,

"Eric B. Ridge" wrote:
> APJservAction v/s AddAction:
> 
> Which is the prefered method of calling .jsp's?  Using the ApJServAction
> of ApacheJServ, or using the AddAction of Apache?
> 
> I just upgraded from .9.11 Apache JServ to 1.01b2 Apache JServ and I kept
> the old method of AddAction.

Both should work now. However, when Apache JServ supports extension
mapping as defined in Servlet API 2.1, I can imagine that only to work
with ApJServAction, and not with AddAction. Therefore, it may the worth
the small trouble of switching now.

> ------------
> Ghost Classes
> (NOTE: This situation occues w/ GNUJSP .96 & ApacheJServ .9.11 AND w/
> GNUJSP .97 & APacheJServ 1.01b2)
> 
> We have a lot of custom classes/packages stored in
> /var/lib/classes/package/name/ and we keep the compiled .jsp pages in
> /tmp/jsp/
> 
> At some undetermined time while the webserver is running, 'ghost' copies
> of our custom classes are created in their proper package directories
> under /tmp/jsp/. And when this happens STRANGE things occur . . .
> sometimes.  Usually, but not always, the same class gets copied.
> Sometimes the filesize of the ghost class(es) is/are the same as the real
> class, sometimes not.
> 
> I hope I'm not being vague, but this situation is really hard to explain
> as we have no idea why it's happening.
> 
> Any thoughts on why ghost classes would be created under the compiled JSP
> directory tree?

The java compiler is called with a command line like
javac -classpath ...:/tmp/jsp -d /tmp/jsp file.java
where ... is your system classpath and file.java is the java file to
compile. When javac encounters java files that are newer than the
corresponding class files, javac will compile those. It will place the
new class files below /tmp/jsp because of the -d flag.

This can mess things up because the JSP class loader will load the class
files below /tmp/jsp while the servlet classloader will load the class
files from /var/lib/classes, causing ClassCastException. My plan is to
modify the JSP class loader to only load classes whose name starts with
"_jsp", and to call the servlet class loader (or the system class
loader) for other classes.

This will not prevent the ghost classes from appearing, but will prevent
them from being loaded. If you do not want them to appear, the -d flag
should be removed, but that means that compiling a JSP page could cause
class files somewhere else on the disk to be changed. In any case, the
javac command line will be configurable in the next version of GNUJSP,
allowing you to decide for yourself.

Regards, Vincent.