cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Terry Longo" <terry_lo...@hotmail.com>
Subject xalan/xerces/xml-apis "work" with init servlets but not with request servlets
Date Sun, 21 Apr 2002 18:11:11 GMT
Hello,

Please accept my apology if this turns out to be something simple.  I've 
spent countless hours in the archives for this and other email lists and am 
at my wit's end!

Environment:
- win nt 4 sp5
- j2sdk1.4.0
- Tomcat 4.0.4-b2
- Cocoon 2.0.2-dev

I can run Cocoon easily (once the xerces, xalan, and xml-apis jars are 
COPIED into %JAVA_HOME%/lib/endorsed).  Once cocoon.war was unpacked, I 
stopped tomcat, renamed webapps/ROOT to something else, renamed 
webapps/cocoon to webapps/ROOT, and restarted tomcat and cocoon.  This works 
fine as well.  (There may be another way to have cocoon run as the root app, 
but this seems to work as well.)

HERE is the problem: I have configured several initialization servlets in 
web.xml, and those servlets load and parse certain XML configuration files 
to initialize some static members of singleton instances for my application. 
  Those init classes work fine, and there is ample debugging output to show 
it.

Specifically, I have written a form manager that reads form layouts from 
forms.xml into a Document instance whose root element is "<forms>".  Each 
child element of "<forms>" is a distinct form definition.  When a request 
servlet wants to instantiate a form for rendering, it invokes my 
FormsManager.getForm(String formName), which finds the correct child Element 
in the initial "<forms>" document and imports it into a new Document via 
importNode.  The new Document contains only the desired form and belongs 
only to the request's session.

This all works in my development / test environment (netbeans 3.3.1).  It 
also works if I invoke the installed servlet (i.e., within %TOMCAT_HOME%), 
in which case of course cocoon is not part of the picture.  The test code 
initializes FormsManager from the same forms.xml file and also exercises 
getForm() properly.  Since this code works within netbeans and invoked as an 
independent servlet, I am confident of the code.

However, when a servlet invoked via cocoon attempts the getForm(), it fails 
on an invocation of a NodeList.getLength(), which is called within getForm() 
to see if any nodes were returned when looking up the Element matching the 
given form name.

I have been assuming that this problem is due to either the presence of two 
instances of the XML libraries (xalan-2.3.1.jar, xercesImpl-2.0.0.jar, and 
xml-apis.jar) or something missing in the way I am telling the environment 
to resolve class references.

Here are a couple of observations:
- When the XML libraries are present in the endorsed folder but NOT in 
cocoon's WEB-INF/lib folder, the init servlets work fine but my app's 
request handling servlet reports "class not found" for 
org.apache.xerces.parsers.SAXParser.  In THIS case the getLength() problem 
mentioned above does not happen, because it does not even get that far.
- When the XML libraries are present in both the endorsed folder and 
cocoon's WEB-INF/lib folder, the init classes do not fail, but the debug 
output is not correct: searches for attributes for any elements with the 
"<forms>" structure are shown as null.
- When the XML libraries are present in only cocoon's WEB-INF/lib folder, 
the same behavior results.

I have tried so many different things with library placement, CLASSPATH, 
<extra-classpath>, etc. (I like to learn by troubleshooting).  I have a 
feeling this issue is related to classloaders, order of resolution of class 
references, or the like, and this admittedly puts me out of my zone of 
knowledge.  I also realize this is not necessarily a cocoon issue per se and 
that I could have posted to a Java or Xerces list, but I thought the cocoon 
list would be best because you have the correct context.  Because I am not 
certain of the exact nature of the problem, I have tried to limit the info 
above to what I think is relevant to

I cannot thank you enough for taking the time to read this and helping me 
through!

Terry Longo

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Mime
View raw message