cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Christmann <pchristm...@gmail.com>
Subject CompilingClassLoader problems inside a WAR
Date Mon, 27 Dec 2004 22:30:24 GMT
I am attempting (for my first time) to build a cocoon web application
and deploy it as a WAR to Tomcat.  However, I am encountering a
problem that occurs *only* when I deploy my app as a WAR.  If I deploy
it as an expanded folder (either myself, or by using Tomcat's
unpackWARS attribute) then the app works fine.

Versions:

Cocoon: 2.2-dev checked out today
Tomcat: 5.0.30-beta installed as a Service
Windows 2000

The problem:

I have a javascript file that includes this as the first two lines:

cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
importClass(com.priorartisans.ticketing.reports.DomainList)

Somehow (via some sufficiently advanced Cocoon magic that is well
beyond my current understanding), this second line turns into a call
to org.apache.cocoon.components.flow.javascript.fom.CompilingClassLoader
to resolve the imported class.

(Note: Based on mails I found in the archive, I tried
importClass(Packages.com.priorartisans.....) but nothing changed.)

The problem is that the compile method of CompilingClassLoader gets as
its class name "com.priorartisans" - not the full class name.  The
getSource method is able to turn that into a
org.apache.excalibur.source.impl.URLSource (via an
org.apache.excalibur.source.SourceResolver) with a URI of
jndi:/localhost/reports/com/priorartisans.java (note: "reports" is the
name of my webapplication).

Then at line 162 of CompilingClassLoader, the URLSource reports that
it exists, so it is returned.  But later - the URLSource cannot be
read (since it doesn't exist) so compilation fails.

Eventually, this means that if I try to view (in a browser) on of my
web pages that requires that javascript file, I instead see the
"Internal Server Error" page that shows an
org.mozilla.javascript.EvaluatorException thrown by the
ComplingClassLoader inside the compile method.

If I unpack the WAR, then the resolved source is an
org.apache.excalibur.source.impl.FileSource with a URI of 
file:/c:/program files/apache software foundation/tomcat
5.0/webapps/reports/com/priorartisans.java.  With this Source, line
162 reports that the source doesn't exist, so no attempts are made to
compile it, and the webapp works fine.

(When I run as an unpacked WAR, the CompilingClassLoader is called
first with "com.priorartisans", then with
"com.priorartisans.ticketing", then with
"com.priorartisans.ticketing.reports" - something is parsing the
chunks of the importClass statement.)

I've found bug #27484
(http://issues.apache.org/bugzilla/show_bug.cgi?id=27484) which seems
to describe the same problem and its marked as "RESOLVED WONTFIX", but
I don't see any description of why it won't be fixed, what the problem
is, or what a work around is.

Also - when I started doing this, I was using Cocoon 2.1.5.  In that
version, this error manifested as a NullPointerException.  With the
latest code, the NPE is gone (I've seen mailing list traffic
discussing a patch) but the underlying problem still remains.

I'm not sure if this is a bug with the Excalibur URLSource.  But with
the recent shutdown of Avalon, I couldn't find the appropriate set of
source for the excalibur components (the Cocoon API docs don't include
it; the Excalibur API docs reference packages with an "avalon" in them
- org.apache.avalon.excalibur - so that source appears to be
different).

Help!  I'm very new to cocoon, but I hope I've described my problem
sufficiently and accurately.  Thanks in advance for any pointers or
info.

-- 
PC

Paul Christmann
Prior Artisans, LLC
mailto:paul@priorartisans.com
504-587-9072

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message