Re: FOP code runs standalone, but not in a Servlet
Mike, On my machine at work (Win NT), I'm using J2SDK 1.4.1 and Tomcat 4.1. Currently: I have *no* xerces/xalan libraries in the j2sdk\jre\lib\ext directory. (Perhaps not a wise idea as Joerg was saying--the libraries with the Sun JDK may be out-of-date) Also, I have *no* xerces/xalan libraries in my tomcat4.1\common\lib directory. Within my (Struts) webapp, in Web-inf\lib (also make sure your Web-inf is spelled exactly Web-inf, I believe it's case-sensitive), again, no xerces\xalan jars. It is here--and only here--that I placed the fop.jar, batik.jar and avalon.jar libraries. (Where you are placing these three libraries may also be part of the problem for you.) None of these--FOP or XML--libraries are on my classpath. FOP runs fine under these circumstances on my machine--hope this helps for you! Thanks, Glen --- Mike Kellstrand [EMAIL PROTECTED] wrote: OK, I downloaded the latest xalan xerces, and installed the jars in the lib/endorsed dir. I ran the servlet and got: null:4:80 fo:flow must contain block-level children Does the endorsed dir get loaded first, or are there some parsers build into one of the Tomcat core jars that are running instead? Thanks, Mike __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Solution: FOP code runs standalone, but not in a Servlet
Here is how I got FOP to run from a servlet. I did also have a subtle syntax error in my xslt file that was causing some of my troubles and leading me down the wrong path. I think this would be a good entry for the FAQ. Although I searched the web extensively, I never found this issue discussed. Several of you gave some very good ideas that led me to the correct answer. Thanks! This was for Tomcat 4.1.24 ... 1) I replaced the 2 existing jars in common/endorsed/ (xercesImpl.jar xmlParserAPIs.jar) with those from the latest Xerces release, 2.5.0 2) I also added xalan.jar from the latest Xalan release, 2.5.1 to common/endorsed/ 3) I added the FOP jars from fop-0.20.5 to shared/lib (fop.jar, batik.jar, avalon-framework-cvs-20020806.jar) Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FOP code runs standalone, but not in a Servlet
I'm assuming you're using Tomcat 4.0 (Tomcat 3.2 appears to rely on its own XML parser, one that individual webapps can't override--see http://marc.theaimsgroup.com/?l=tomcat-userm=99849943408731w=2) From the link above, *perhaps* copying the xalan xerces you are placing in the jre/ext directory *also* into tomcat\lib directory might be of help--from what the link is suggesting above. (Grasping at straws--there is also an xml-apis.jar file that needs copying, correct? You should be moving three files if I'm not mistaken.) I've used FOP at work with Servlets--when I return to work I'll see if there's anything useful I can report on my library setup. When successful, please let us know what you did--our website may need updating somewhere so others don't have to suffer so much after you! ;-) Glen --- Mike Kellstrand [EMAIL PROTECTED] wrote: OK, I downloaded the latest xalan xerces, and installed the jars in the lib/endorsed dir. I ran the servlet and got: null:4:80 fo:flow must contain block-level children Does the endorsed dir get loaded first, or are there some parsers build into one of the Tomcat core jars that are running instead? Thanks, Mike - Original Message - From: Mike Kellstrand [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 12, 2003 3:43 PM Subject: Re: FOP code runs standalone, but not in a Servlet Thanks for the reply. I would think this would be a VFAQ, but I have seached the web extensively and not found a good definitive answer. I'm downloading the latest releases of xerces and xalan. I'll put the appropriate jars in the lib/endorsed dir and see if it works. Although there is still the very interesting question of why do the jars I have work from a stand-alone java program when placed in the jre\ext dir, but don't work from a servlet when placed in the lib\endorsed dir? Thanks, Mike - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 12, 2003 3:05 PM Subject: Re: FOP code runs standalone, but not in a Servlet Mike Kellstrand wrote: I have FOP code that runs great from the command line if I put the fop, batik, avalon, and xalan jars in the JAVA_HOME\jre\lib\ext dir. You should put the xerces and xalan jars in the lib/endorsed directory in order to override the buggy xalan release coming with older JDK 1.4 distributions. Getting the latest 1.4 release and disposing of the Xalan jar completely should work too. Also, make sure you have a recent Xalan jar in the FOP lib directory, pre 0.20.5rc3 FOP distributions came with Xalan releases which pretended to work for some buggy style sheets, causing problems with more recent Xalans. This all is a VFAQ. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FOP code runs standalone, but not in a Servlet
Check also the text at the bottom of this page (Tomcat guide)--it may provide more pointers: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html --- Glen Mazza [EMAIL PROTECTED] wrote: I'm assuming you're using Tomcat 4.0 (Tomcat 3.2 appears to rely on its own XML parser, one that individual webapps can't override--see http://marc.theaimsgroup.com/?l=tomcat-userm=99849943408731w=2) From the link above, *perhaps* copying the xalan xerces you are placing in the jre/ext directory *also* into tomcat\lib directory might be of help--from what the link is suggesting above. (Grasping at straws--there is also an xml-apis.jar file that needs copying, correct? You should be moving three files if I'm not mistaken.) I've used FOP at work with Servlets--when I return to work I'll see if there's anything useful I can report on my library setup. When successful, please let us know what you did--our website may need updating somewhere so others don't have to suffer so much after you! ;-) Glen --- Mike Kellstrand [EMAIL PROTECTED] wrote: OK, I downloaded the latest xalan xerces, and installed the jars in the lib/endorsed dir. I ran the servlet and got: null:4:80 fo:flow must contain block-level children Does the endorsed dir get loaded first, or are there some parsers build into one of the Tomcat core jars that are running instead? Thanks, Mike - Original Message - From: Mike Kellstrand [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 12, 2003 3:43 PM Subject: Re: FOP code runs standalone, but not in a Servlet Thanks for the reply. I would think this would be a VFAQ, but I have seached the web extensively and not found a good definitive answer. I'm downloading the latest releases of xerces and xalan. I'll put the appropriate jars in the lib/endorsed dir and see if it works. Although there is still the very interesting question of why do the jars I have work from a stand-alone java program when placed in the jre\ext dir, but don't work from a servlet when placed in the lib\endorsed dir? Thanks, Mike - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 12, 2003 3:05 PM Subject: Re: FOP code runs standalone, but not in a Servlet Mike Kellstrand wrote: I have FOP code that runs great from the command line if I put the fop, batik, avalon, and xalan jars in the JAVA_HOME\jre\lib\ext dir. You should put the xerces and xalan jars in the lib/endorsed directory in order to override the buggy xalan release coming with older JDK 1.4 distributions. Getting the latest 1.4 release and disposing of the Xalan jar completely should work too. Also, make sure you have a recent Xalan jar in the FOP lib directory, pre 0.20.5rc3 FOP distributions came with Xalan releases which pretended to work for some buggy style sheets, causing problems with more recent Xalans. This all is a VFAQ. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FOP code runs standalone, but not in a Servlet
This is a followup to a question earlier today. I have FOP code that runs great from the command line if I put the fop, batik, avalon, and xalan jars in the JAVA_HOME\jre\lib\ext dir. If I put this code in a servlet under Tomcat 4.1.24, I get transform errors. I have tried putting the FOP jars in various Tomcat lib dirs, in webapps with the servlet, etc. Everywhere I move these jars I get different amusing transform exceptions, but it doesn't run. 1) Where do the jars need to go? 2) Are there any parser jars that come with Tomcat that need to get removed. I tried removing the 2 jars that are in /common/endorsed, but that didn't help. Are there more hiding or embedded somewhere? This is driving me nuts! Many thanks! Mike
Re: FOP code runs standalone, but not in a Servlet
Mike Kellstrand wrote: I have FOP code that runs great from the command line if I put the fop, batik, avalon, and xalan jars in the JAVA_HOME\jre\lib\ext dir. You should put the xerces and xalan jars in the lib/endorsed directory in order to override the buggy xalan release coming with older JDK 1.4 distributions. Getting the latest 1.4 release and disposing of the Xalan jar completely should work too. Also, make sure you have a recent Xalan jar in the FOP lib directory, pre 0.20.5rc3 FOP distributions came with Xalan releases which pretended to work for some buggy style sheets, causing problems with more recent Xalans. This all is a VFAQ. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FOP code runs standalone, but not in a Servlet
Thanks for the reply. I would think this would be a VFAQ, but I have seached the web extensively and not found a good definitive answer. I'm downloading the latest releases of xerces and xalan. I'll put the appropriate jars in the lib/endorsed dir and see if it works. Although there is still the very interesting question of why do the jars I have work from a stand-alone java program when placed in the jre\ext dir, but don't work from a servlet when placed in the lib\endorsed dir? Thanks, Mike - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 12, 2003 3:05 PM Subject: Re: FOP code runs standalone, but not in a Servlet Mike Kellstrand wrote: I have FOP code that runs great from the command line if I put the fop, batik, avalon, and xalan jars in the JAVA_HOME\jre\lib\ext dir. You should put the xerces and xalan jars in the lib/endorsed directory in order to override the buggy xalan release coming with older JDK 1.4 distributions. Getting the latest 1.4 release and disposing of the Xalan jar completely should work too. Also, make sure you have a recent Xalan jar in the FOP lib directory, pre 0.20.5rc3 FOP distributions came with Xalan releases which pretended to work for some buggy style sheets, causing problems with more recent Xalans. This all is a VFAQ. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FOP code runs standalone, but not in a Servlet
Mike Kellstrand wrote: Although there is still the very interesting question of why do the jars I have work from a stand-alone java program when placed in the jre\ext dir, but don't work from a servlet when placed in the lib\endorsed dir? This is indeed baffling. I guess you were taking the jars from somewhere else. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FOP code runs standalone, but not in a Servlet
OK, I downloaded the latest xalan xerces, and installed the jars in the lib/endorsed dir. I ran the servlet and got: null:4:80 fo:flow must contain block-level children Does the endorsed dir get loaded first, or are there some parsers build into one of the Tomcat core jars that are running instead? Thanks, Mike - Original Message - From: Mike Kellstrand [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 12, 2003 3:43 PM Subject: Re: FOP code runs standalone, but not in a Servlet Thanks for the reply. I would think this would be a VFAQ, but I have seached the web extensively and not found a good definitive answer. I'm downloading the latest releases of xerces and xalan. I'll put the appropriate jars in the lib/endorsed dir and see if it works. Although there is still the very interesting question of why do the jars I have work from a stand-alone java program when placed in the jre\ext dir, but don't work from a servlet when placed in the lib\endorsed dir? Thanks, Mike - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 12, 2003 3:05 PM Subject: Re: FOP code runs standalone, but not in a Servlet Mike Kellstrand wrote: I have FOP code that runs great from the command line if I put the fop, batik, avalon, and xalan jars in the JAVA_HOME\jre\lib\ext dir. You should put the xerces and xalan jars in the lib/endorsed directory in order to override the buggy xalan release coming with older JDK 1.4 distributions. Getting the latest 1.4 release and disposing of the Xalan jar completely should work too. Also, make sure you have a recent Xalan jar in the FOP lib directory, pre 0.20.5rc3 FOP distributions came with Xalan releases which pretended to work for some buggy style sheets, causing problems with more recent Xalans. This all is a VFAQ. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FOP code runs standalone, but not in a Servlet
Mike Kellstrand wrote: I ran the servlet and got: null:4:80 fo:flow must contain block-level children This is not an error messages from the XSLT processor, this means FOP doesn't accept the result of your transformation. Most likely the template responsible for generating the flow content doesn't match, youi can insert some xsl:message there and check the servlet container's stderr log. Probably you don't use exactly the same XML and XSLT source in the servlet as in the command line application, even if you think you do. There's also the slight possiblity that you have namespace problems. All in all there are lots of things which can go wrong with servlets and which you are probably completely unaware of. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]