Wrox Programmer Forums
|
BOOK: Professional XML Development with Apache Tools
This is the forum to discuss the Wrox book Professional XML Development with Apache Tools: Xerces, Xalan, FOP, Cocoon, Axis, Xindice by Theodore W. Leung; ISBN: 9780764543555
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XML Development with Apache Tools section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 10th, 2004, 07:56 AM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to run XMLServlet example for FOP

Hello,

i buy the book "Professional XML Development with Apache Tools" from wrox
compiled the fop example in chapter 3 and don´t get it run in my Tomcat.

i rely on the browser, because i am engage in web development, and besides the url-pattern
in web.xml <snip value="code" src="web.xml">
<servlet-mapping>
    <servlet-name>XMLServlet</servlet-name>
    <url-pattern>/ch03/*</url-pattern>
  </servlet-mapping>
</snip>

the request send from the browser to the webserver with http://localhost:8080/ch03, nothing is happened, only showing Diretory Listing for the two files of xml and xslt on ch03, which the servlet is supposed to transform to pdf via xsl-fo.

The doctype of web.xml is the same i am using with other servlets in tomcat 4.29.

<snip value="code" src="web.xml">
 <filter>
    <filter-name>XSLT Filter</filter-name>
    <filter-class>com.sauria.apachexml.ch3.XSLTFOPServletFilte r</filter-class>
  </filter>

  <filter>
    <filter-name>FOP Filter</filter-name>
    <filter-class>com.sauria.apachexml.ch3.FOPServletFilter</filter-class>
  </filter>


  <filter-mapping>
    <filter-name>FOP Filter</filter-name>
    <servlet-name>XMLServlet</servlet-name>
  </filter-mapping>

  <filter-mapping>
    <filter-name>XSLT Filter</filter-name>
    <servlet-name>XMLServlet</servlet-name>
  </filter-mapping>
</snip>

I have never worked with filter and filter-mapping before, so maybe here lays the problem ?

Everyone knows the trick how to use the XMLServlet in chapter 3?

My log tells everthing ok by starting tomcat
2004-09-09 17:52:54 HostConfig[localhost]: Deploying web application directory ch03
2004-09-09 17:52:54 StandardHost[localhost]: Installing web application at context path /ch03 from URL file:C:\Tomcat\webapps\ch03
2004-09-09 17:52:54 WebappLoader[/ch03]: Deploying class repositories to work directory C:\Tomcat\work\Standalone\localhost\ch03
2004-09-09 17:52:54 WebappLoader[/ch03]: Deploy class files /WEB-INF/classes to C:\Tomcat\webapps\ch03\WEB-INF\classes
2004-09-09 17:52:54 WebappLoader[/ch03]: Deploy JAR /WEB-INF/lib/DPDFGen.jar to C:\Tomcat\webapps\ch03\WEB-INF\lib\DPDFGen.jar
2004-09-09 17:52:55 WebappLoader[/ch03]: Deploy JAR /WEB-INF/lib/avalon-framework-cvs-20020806.jar to C:\Tomcat\webapps\ch03\WEB-INF\lib\avalon-framework-cvs-20020806.jar
2004-09-09 17:52:55 WebappLoader[/ch03]: Deploy JAR /WEB-INF/lib/batik.jar to C:\Tomcat\webapps\ch03\WEB-INF\lib\batik.jar
2004-09-09 17:52:55 WebappLoader[/ch03]: Deploy JAR /WEB-INF/lib/fop.jar to C:\Tomcat\webapps\ch03\WEB-INF\lib\fop.jar
2004-09-09 17:52:55 WebappLoader[/ch03]: Deploy JAR /WEB-INF/lib/xalan-2.4.1.jar to C:\Tomcat\webapps\ch03\WEB-INF\lib\xalan-2.4.1.jar
2004-09-09 17:52:55 StandardManager[/ch03]: Seeding random number generator class java.security.SecureRandom
2004-09-09 17:52:55 StandardManager[/ch03]: Seeding of random number generator has been completed
2004-09-09 17:52:57 StandardWrapper[/ch03:default]: Loading container servlet default
2004-09-09 17:52:57 StandardWrapper[/ch03:invoker]: Loading container servlet invoker



Thanks,



Hans Braumüller
http://crosses.net
 
Old September 16th, 2004, 04:40 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

Filter code & this sample could be helpful to resolve

http://www.javaworld.com/javaworld/j...2-filters.html

 
Old September 16th, 2004, 04:42 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

Observe this the following filter-mapping tag contains the "url-pattern" insted your code doen't have and can you try with necessary changes.

<filter-mapping>
    <filter-name>timerFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping

 
Old September 16th, 2004, 05:41 AM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

i try xour sugestion, but it doesn´t work.

i include

 <filter-mapping>
    <filter-name>XSLT Filter</filter-name>
    <url-pattern>/ch03/*</url-pattern>
  </filter-mapping>

in the web.xml, but anyway the url-pattern it is not handled by the servlet ?

now:
<?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/dtd/web-app_2_3.dtd">

<web-app>
  <display-name>Professional XML Development with Apache Tools Examples</display-name>
  <description>
    Examples from Professional XML Development with Apache Tools.
  </description>


  <filter>
    <filter-name>XSLT Filter</filter-name>
    <filter-class>com.sauria.apachexml.ch3.XSLTFOPServletFilte r</filter-class>
  </filter>

  <filter>
    <filter-name>FOP Filter</filter-name>
    <filter-class>com.sauria.apachexml.ch3.FOPServletFilter</filter-class>
  </filter>


  <filter-mapping>
    <filter-name>FOP Filter</filter-name>
    <servlet-name>XMLServlet</servlet-name>
  </filter-mapping>

  <filter-mapping>
    <filter-name>XSLT Filter</filter-name>
    <servlet-name>XMLServlet</servlet-name>
  </filter-mapping>
 <filter-mapping>
    <filter-name>XSLT Filter</filter-name>
    <url-pattern>/ch03/*</url-pattern>
  </filter-mapping>
  <servlet>
    <servlet-name>XMLServlet</servlet-name>
    <servlet-class>com.sauria.apachexml.ch3.XMLServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>XMLServlet</servlet-name>
    <url-pattern>/ch03/*</url-pattern>
  </servlet-mapping>

</web-app>

I see only the directory Listing with http://localhost:8080/ch03/
and with http://localhost:8080/ch03/XMLServlet:
The requested resource (/ch03/XMLServlet) is not available.


Hans Braumüller
http://braumueller.crosses.net



Hans Braumüller
http://crosses.net
 
Old September 16th, 2004, 06:08 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

Hi
I have also not worked with filters
Can we find some help with url

http://www.oracle.com/technology/sam...smfilters.html

 
Old September 16th, 2004, 06:09 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

Here is the another source of defining the Filters,

http://www.roguewave.com/support/doc...catug/7-8.html

 
Old September 16th, 2004, 06:12 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

It is clear from the above that only with the particular servlet having filter statements is producing error, otherwise for the other links (other servlets in the same project) your TOMCAT works fine for you.....



 
Old September 16th, 2004, 06:39 AM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

do you have run this code sample with success?

http://media.wiley.com/product_ancil...plete_code.zip

Please try, i don´t know why i don´t get it run. I can compiled it and install it on my tomcat with the same java they use in the book.

Greetings from Hamburg, Germany

Hans Braumüller
http://crosses.net





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple FOP files to single PDF using XSL bhavanimachani XML 7 March 28th, 2008 05:59 AM
How can I run or not run Google AD in my ASP.NET w mycwcgr ASP.NET 2.0 Professional 0 November 5th, 2007 07:18 AM
XSLT FOP mckeaveney XSLT 0 July 8th, 2005 09:52 AM
changing xslt processor in FOP Tschuri XSLT 0 May 13th, 2005 07:08 AM
problem with empty block tag in xsl-fo and fop enT XSLT 0 October 14th, 2003 08:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.