Honza Hejzl
Honza Hejzl

Reputation: 884

How to update Apache FOP in eXist-db?

Aside my question about commercial processors, I would like to test the newest version of Apache FOP. However, I met problems whilst trying to do that according to this article.

There are some parts which are different in the last dev versions of eXist but the overall idea should work, I think.

I had:

# XSL FO transformations (Uses Apache FOP)
include.module.xslfo = true
include.module.xslfo.url = http://apache.cs.uu.nl/xmlgraphics/fop/binaries/fop-1.1-bin.zip

Changed to:

# XSL FO transformations (Uses Apache FOP)
include.module.xslfo = true
include.module.xslfo.url = http://apache.cs.uu.nl/xmlgraphics/fop/binaries/fop-2.1-bin.zip

I removed the old fop.jar file from $EXIST_HOME/extensions/modules/libs/.

After these steps I ran build.sh. Strange thing was it did not seem to download the new package (I was not able to track that in the log of the build.sh process. However, in the $EXIST_HOME/extensions/modules/libs/ there was new fop.jar present (not sure of what version).

As for $EXIST_HOME/extensions/modules/build.xml, this is what differs most from the original article I mentioned. There is no specific information about the version of FOP used.

After starting the app and trying to produce a pdf, I got this error from Jetty:

HTTP ERROR 500

Problem accessing /exist/apps/karolinum-x/modules/create-ebook.xq. Reason:

    Server Error

Caused by:

javax.servlet.ServletException: An error occurred: org.apache.fop.apps.FopFactory.newInstance()Lorg/apache/fop/apps/FopFactory;
    at org.exist.http.servlets.EXistServlet.doGet(EXistServlet.java:237)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:575)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:229)
    at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:103)
    at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:50)
    at org.exist.http.urlrewrite.XQueryURLRewrite.doRewrite(XQueryURLRewrite.java:557)
    at org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:357)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1496)
    at de.betterform.agent.web.filter.XFormsFilter.doFilter(XFormsFilter.java:171)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1476)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:370)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.apache.fop.apps.FopFactory.newInstance()Lorg/apache/fop/apps/FopFactory;
    at org.exist.xquery.modules.xslfo.ApacheFopProcessorAdapter.<init>(ApacheFopProcessorAdapter.java:25)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.exist.xquery.modules.xslfo.XSLFOModule.getProcessorAdapter(XSLFOModule.java:85)
    at org.exist.xquery.modules.xslfo.RenderFunction.eval(RenderFunction.java:135)
    at org.exist.xquery.BasicFunction.eval(BasicFunction.java:70)
    at org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:56)
    at org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:100)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.BindingExpression.eval(BindingExpression.java:165)
    at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:155)
    at org.exist.xquery.DynamicCardinalityCheck.eval(DynamicCardinalityCheck.java:74)
    at org.exist.xquery.Atomize.eval(Atomize.java:67)
    at org.exist.xquery.DynamicTypeCheck.eval(DynamicTypeCheck.java:61)
    at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:330)
    at org.exist.xquery.FunctionCall.eval(FunctionCall.java:234)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
    at org.exist.xquery.BindingExpression.eval(BindingExpression.java:165)
    at org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:100)
    at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:58)
    at org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:102)
    at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:58)
    at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:65)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:189)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.BindingExpression.eval(BindingExpression.java:165)
    at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
    at org.exist.xquery.PathExpr.eval(PathExpr.java:267)
    at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
    at org.exist.xquery.XQuery.execute(XQuery.java:280)
    at org.exist.xquery.XQuery.execute(XQuery.java:200)
    at org.exist.http.RESTServer.executeXQuery(RESTServer.java:1498)
    at org.exist.http.RESTServer.doGet(RESTServer.java:509)
    at org.exist.http.servlets.EXistServlet.doGet(EXistServlet.java:204)
    ... 45 more

Caused by:

java.lang.NoSuchMethodError: org.apache.fop.apps.FopFactory.newInstance()Lorg/apache/fop/apps/FopFactory;
    at org.exist.xquery.modules.xslfo.ApacheFopProcessorAdapter.<init>(ApacheFopProcessorAdapter.java:25)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.exist.xquery.modules.xslfo.XSLFOModule.getProcessorAdapter(XSLFOModule.java:85)
    at org.exist.xquery.modules.xslfo.RenderFunction.eval(RenderFunction.java:135)
    at org.exist.xquery.BasicFunction.eval(BasicFunction.java:70)
    at org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:56)
    at org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:100)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.BindingExpression.eval(BindingExpression.java:165)
    at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:155)
    at org.exist.xquery.DynamicCardinalityCheck.eval(DynamicCardinalityCheck.java:74)
    at org.exist.xquery.Atomize.eval(Atomize.java:67)
    at org.exist.xquery.DynamicTypeCheck.eval(DynamicTypeCheck.java:61)
    at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:330)
    at org.exist.xquery.FunctionCall.eval(FunctionCall.java:234)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:142)
    at org.exist.xquery.BindingExpression.eval(BindingExpression.java:165)
    at org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:100)
    at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:58)
    at org.exist.xquery.ConditionalExpression.eval(ConditionalExpression.java:102)
    at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:58)
    at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:65)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:189)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:187)
    at org.exist.xquery.BindingExpression.eval(BindingExpression.java:165)
    at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
    at org.exist.xquery.PathExpr.eval(PathExpr.java:267)
    at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71)
    at org.exist.xquery.XQuery.execute(XQuery.java:280)
    at org.exist.xquery.XQuery.execute(XQuery.java:200)
    at org.exist.http.RESTServer.executeXQuery(RESTServer.java:1498)
    at org.exist.http.RESTServer.doGet(RESTServer.java:509)
    at org.exist.http.servlets.EXistServlet.doGet(EXistServlet.java:204)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:575)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:229)
    at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:103)
    at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:50)
    at org.exist.http.urlrewrite.XQueryURLRewrite.doRewrite(XQueryURLRewrite.java:557)
    at org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:357)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1496)
    at de.betterform.agent.web.filter.XFormsFilter.doFilter(XFormsFilter.java:171)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1476)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:370)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:745)

What am I missing? I would expect fop.jar figures there as a library only and build.sh could fix everything else, if necessary.

Upvotes: 1

Views: 178

Answers (1)

DiZzZz
DiZzZz

Reputation: 656

the upcoming v3.0 release supports FOP2.1 ; this should work OK, though a few issues are reported.

Note that Apache changed the directory structure for FOP a bit, you might want to verify the new location....

see

Upvotes: 1

Related Questions