You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Gary Bauer <ga...@bigfoot.com> on 2002/07/08 21:40:25 UTC

RE: Newbie getting (another) NoClassDefFoundError when running servlet

Thanks for the response Mark.  I moved the fop.jar into fop/web-inf/lib and got as far as the next missing class.  I gave up trying to locate it and started trying old versions of FOP.  I can only imagine that I am doing something fundamentally wrong, because I know that loads of you have this working, but every installintion I tried has reported problems with the provided web.xml and, once that is fixed, with missing classes before they get as far as looking for the FO file that I specify in the URL.

Finally with FOP 1.9 I got as far as FOP reporting that the FO file specified in the URL could not be found (I had put a dummy name just to check if FOP was getting as far as looking for my file).  I then used the correct file name, thinking that it was finally working, but lo and behold, got another missing class error:

    java.lang.NoClassDefFoundError: org/apache/fop/apps/Driver

Anyone have any ideas wherein which jar I can find this class, and how I can get the jar?  I'd really like to get past this and to the next missing class error :-)  I have spent hours on this.  No doubt its really simple, but its not happening for me.

Gary


-------------------------------------------------------------------------------------------------
------_=_NextPart_001_01C22673.2B802C70
Content-Type: text/plain; charset="windows-1252"

The .war is incomplete. You will need to add fop.jar (plus others) to the
WEB-INF/lib directory.
I also had problems with batik.jar, and ended up removing some of the sax
classes.
 
Good luck
 
Mark

-----Original Message-----
From: Gary Bauer [mailto:gary.bauer@bigfoot.com]
Sent: 08 July 2002 13:20
To: fop-user@xml.apache.org
Subject: Newbie getting NoClassDefFoundError when running servlet


I am getting the error message "java.lang.NoClassDefFoundError:
org/apache/fop/apps/XSLTInputHandler" when I try to run fop as a servlet.
 
Operating System: Windows 98
FOP Version:        fop-0.20.4
Tomcat Version:    4.04
 
I have copied the file fop.jar (that contains "XSLTInputHandler" class) to
directories on my path, and to several Tomcat subdirectories all to no
avail.
 
The story:
 
1. Downlaoded fop-0.20.4 & unzipped it into a sundry directory.  Got fop.bat
to convert a FO to PDF
2. Copied fop.war to Tomacat/webapps
3. Started Tomcat.  Tomcat reported a problem:
"org.xml.sax.SAXParseException:The content of element type "servlet-mapping"
must match "<servlet-name,url-pattern>"".  I found the problem in the
web.xml supplied with this relase (see below for the solution if you have
the same issue)
4. Fixed web.xml and started Tomcat again
5. In my browser, tried opening http://localhost:8080/fop/fop?fo=/article.fo
<http://localhost:8080/fop/fop?fo=/article.fo>   ("article.fo" is my FO file
located in Tomcat/webapps/Root)
6.  Got a ton of error messages, at the root of which seems to be
"java.lang.NoClassDefFoundError: org/apache/fop/apps/XSLTInputHandler".
Attempting the same url again, Tomcat tells me the servlet is currently
unavailable.  I have to restart Tomcat to try again.
 
Can anyone tell me where I am going wrong?
 
Thanks!
 
Gary Bauer
 
 
ps Here is the solution to the web.xml problem:
 
The error message is saying that in a <servlet-mapping> element it is
expecting to see one <servlet-name> and one <url-pattern>.  In the web.xml
that installed itself on my system, I had the entry:
 

<servlet-mapping>
    <servlet-name>
        Fop
    </servlet-name>
    <url-pattern>
        /fop
    </url-pattern>
    <url-pattern>
        /servlet/fop
    </url-pattern>
</servlet-mapping>
 

There are two <url-patterns>'s for one servlet name.  The solution is
simple.  Create an additional <servlet-mapping> and put one of the
<url-patterns> in it as below:


<servlet-mapping>
    <servlet-name>
        Fop
    </servlet-name>
     <url-pattern>
        /fop
    </url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>
        Fop
    </servlet-name>
    <url-pattern>
        /servlet/fop
    </url-pattern>
</servlet-mapping>