10 Replies Latest reply: Oct 14, 2008 8:21 PM by 807589 RSS

    Xslt-FO to PDF

    807589
      hi guys
      i am using XSLT-FO to convert an XML file to PDF .. i am using Apache FOP jar to do this conversion
      i a normal java application the conversion goes well .. but while i am using it in a servlet the following error occurs

      Exception thrown : java.lang.VerifyError: return bytecode incompatible with return type (class: org/apache/fop/fo/ElementMappingRegistry method: findFOMaker(Ljava/lang/String;Ljava/lang/String;Lorg/xml/sax/Locator;)Lorg/apache/fop/fo/ElementMapping$Maker;) at pc: 164

      i have searched for a while and found out that it is probably a bug in teh FOP .. so is there any solution to this bug? or is there another jar i can use to make this conversion?

      thanks in advance
        • 1. Re: Xslt-FO to PDF
          807589
          Your logic escapes me. Apache FOP works in a normal Java application but not in a Servlet so it must be a problem with Apache FOP!

          I would have thought it more likely that environmental differences between your executing in the application and executing in the Servlet are more likely to be the cause of your problem. Looking at the exception it would seem that it is a Java version difference problem.
          • 2. Re: Xslt-FO to PDF
            807589
            check this link
            http://www.mail-archive.com/fop-dev@xmlgraphics.apache.org/msg05965.html
            • 3. Re: Xslt-FO to PDF
              807589
              i forgot to mention out that i am using java 1.4 and FOP 0.94
              • 4. Re: Xslt-FO to PDF
                807589
                whitenight541 wrote:
                check this link
                http://www.mail-archive.com/fop-dev@xmlgraphics.apache.org/msg05965.html//www.mail-archive.com/fop-dev@xmlgraphics.apache.org/msg05965.html
                Nothing in this changes my view that it is more likely that it is an environmental issue, not a FOP issue but I could be wrong. The Bug report (which you could have posted in your original post) is now 18 months old with no apparent progress and I can see no response from the FOP development team. The stack trace in the Bug report indicates that that user is working with Struts - are you? If so, is this the feature of your environment is causing the problem since you certainly won't be using Struts in your applications that use FOP.

                I would never use FOP in a Servlet since it is very memory hungry and means that it only takes a few simultaneous users to make the Servlet engine run out of memory.
                • 5. Re: Xslt-FO to PDF
                  807589
                  and in conclusion what's the solution do u suggest? what would u use in ur servlet if u didn't use FOP?
                  • 6. Re: Xslt-FO to PDF
                    807589
                    whitenight541 wrote:
                    and in conclusion what's the solution do u suggest? what would u use in ur servlet if u didn't use FOP?
                    I don't have a good solution. If you needs FO from XSLT then FOP is the only solution that I am aware of but I would do as much as possible outside of a Servlet so as not to starve normal Servlet users of memory. In an RMI application I was involved with we used a separate machine (a server) to run FOP and throttled that machine based on remaining memory. Since the FOP was used only for fairly infrequent reports (20 or so an hour) this worked reasonably well and stopped the RMI server from having to throttle normal requests.
                    • 7. Re: Xslt-FO to PDF
                      807589
                      Hi, I have the same exception on my project. I have no solution for it. But it works on our production server, but not on my local machine, so I guess it has something to do with java runtime.
                      • 8. Re: Xslt-FO to PDF
                        807589
                        Hi! I upgraded FOP from 0.20 to 0.95 and I am getting the same error. Is there a workaround for this? How do we narrow down the root cause? Do you have any suggestions? I looked at the source code and it looked straight forward to me unless I am missing something here.
                        I would appreciate any help/suggestions.
                        Thanks.
                        coderiyer
                        • 9. Re: Xslt-FO to PDF
                          796254
                          the error suggests a version problem with one or more JARs. you need to upgrade such that the required method signature is available.

                          i'd check to see if somebody added a JAR to the jre/lib/ext directory. if you find anything unusual in that directory, remove it.

                          %
                          • 10. Re: Xslt-FO to PDF
                            807589
                            Thanks for the tip. But, I downloaded the entire FOP package and copied the supporting packages to the web application's lib folder. Is there anything apart from this that I need to copy or for that matter remove from the lib path. All I did was update from JDK 1.3 to JDK 1.6 and upgraded FOP from 0.20 to 0.95.