tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmk...@earthlink.net (David M. Karr)
Subject Problems getting "jspc" to completely work
Date Thu, 11 Apr 2002 18:43:09 GMT
I recently set up a "jspc" task in my build.xml, but only for verification.  I
wasn't bothering to use the output.  That was working ok.

Now, I'm trying to set it up to really pregenerate the JSP code, compile the
generated sources, put the compiled servlet classes into my "classes"
directory, and use an entity declaration in my "web.xml" file to include the
generated servlet mappings.  This isn't working quite right, in several areas.

I'll try to include all the relevant file pieces and output messages.  Sorry
this is somewhat long, but I'm trying to include all the relevant information.

Here is the top of my "web.xml":
----------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"
[
<!ENTITY webinc PUBLIC "webinc" "file:./webinc.xml">
]
>
<web-app>
 &webinc;
 ...
----------------------

Following this is the section of my "build.xml" that uses "jspc".  I don't
actually have a separate task for this, I just do it "inline" for now.  This is
inside my "build-war" target.  Before this part, I copy into the "build"
directory all but my "classes" directory.  After this part, I copy in the
"classes" directory.

-----------------------
  <delete dir="jspc"/>
  <mkdir dir="jspc"/>
  <java classname="org.apache.jasper.JspC" fork="yes">
   <arg line="-v -d jspc -p org.apache.jsp
              -uriroot build
              -webinc build/WEB-INF/webinc.xml -webapp build "/>
   <classpath>
    <pathelement location="${catalina.home}/lib/jasper-compiler.jar"/>
    <pathelement location="${catalina.home}/lib/jasper-runtime.jar"/>
    <pathelement location="weblib/servlet.jar"/>
   </classpath>
  </java>
  <javac srcdir="jspc" destdir="classes" debug="on" optimize="off"
         deprecation="on">
   <classpath>
    <pathelement location="${catalina.home}/lib/jasper-compiler.jar"/>
    <pathelement location="${catalina.home}/lib/jasper-runtime.jar"/>
    <fileset dir="weblib">
     <include name="*.jar"/>
    </fileset>
   </classpath>
   <include name="**/*.java"/>
  </javac>
-----------------------

The following is an excerpt of the output when I run "ant build-war" with this:

-------------------------
Copying 2 files to C:\cygwin\home\dmkarr\java\strutstest\build\WEB-INF
Copying 16 files to C:\cygwin\home\dmkarr\java\strutstest\build\WEB-INF\tlds
Copying 12 files to C:\cygwin\home\dmkarr\java\strutstest\build\WEB-INF\lib
Copying 5 files to C:\cygwin\home\dmkarr\java\strutstest\build
Deleting directory C:\cygwin\home\dmkarr\java\strutstest\jspc
Created dir: C:\cygwin\home\dmkarr\java\strutstest\jspc
2002-04-11 11:27:14 - Exception initializing TldLocationsCache: XML parsing error on file
/WEB-INF/web.xml: Invalid PUBLIC ID: webinc
Compiling 5 source files to C:\cygwin\home\dmkarr\java\strutstest\classes
Copying 3 files to C:\cygwin\home\dmkarr\java\strutstest\build\WEB-INF\classes
Building jar: C:\cygwin\home\dmkarr\java\strutstest\deploy\strutstest.war
-------------------------

The parse error is the first problem I see.  However, I'm not certain whether
this is really causing a problem, as it does complete writing the "webinc.xml"
file, which looks ok, and which begins like this:

--------------------------
<!--
Automatically created by Tomcat JspC.
Place this fragement in the web.xml before all icon, display-name,
description, distributable, and context-param elements.
-->

	<servlet>
		<servlet-name>org.apache.jsp.doImport</servlet-name>
		<servlet-class>org.apache.jsp.doImport</servlet-class>
	</servlet>
--------------------------

After this point in the build, I use a class that interfaces to the Manager app
to stop and start the application, which works most of the time.  However, I
see this in the output when it gets to this point:

--------------------------
Processing URL "http://admin:@localhost:8080/manager/stop?path=/strutstest".
FAIL - Encountered exception java.lang.NullPointerException
--------------------------

In the Tomcat "localhost_log" file, I found this:
--------------------------
java.lang.NullPointerException
	at java.util.Hashtable.remove(Hashtable.java:427)
	at org.apache.naming.ContextBindings.unbindClassLoader(ContextBindings.java:336)
	at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3465)
	at org.apache.catalina.core.StandardHost.stop(StandardHost.java:889)
	at org.apache.catalina.servlets.ManagerServlet.stop(ManagerServlet.java:631)
--------------------------

Now is when the build process copies in the WAR file.  After that, it tries to
run the "start" operation, which gives me this output:

--------------------------
Processing URL "http://admin:@localhost:8080/manager/start?path=/strutstest".
FAIL - Application at context path /strutstest could not be started
--------------------------

Again, in the log file, I saw this:
--------------------------
2002-04-11 11:13:00 ContextConfig[/strutstest] Parse error in application web.xml
org.xml.sax.SAXParseException: File "file:./webinc.xml" not found.
	at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1219)
	at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalEntity(DefaultEntityHandler.java:793)
	at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromEntity(DefaultEntityHandler.java:663)
	at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1264)
	at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
--------------------------

In the console output of Tomcat, I also see this:
--------------------------
Resolve: webinc file:./webinc.xml
XmlMapper: Can't find resource for entity: webinc --> file:./webinc.xml "null"
PARSE error at line 0 column 0
org.xml.sax.SAXParseException: File "file:./webinc.xml" not found.
--------------------------

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message