eXist-db / exist

eXist Native XML Database and Application Platform
https://exist-db.org
GNU Lesser General Public License v2.1
429 stars 179 forks source link

error in XFormsFilter blocks deployment of eXist WAR in Tomcat-8.5 #1352

Closed rvdb closed 6 years ago

rvdb commented 7 years ago

What is the problem

Deploying an eXist-3.1.0 WAR build in Tomcat-8.5 fails due to errors caused by the XFormsFilter filter. Following errors are being reported:

14-Mar-2017 14:26:53.792 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter XFormsFilter
 javax.servlet.ServletException: de.betterform.xml.config.XFormsConfigException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerConfigurationException: net.sf.saxon.s9api.SaxonApiException: I/O error reported by XML parser processing file:/F:/ctb/CTB_webapps/CTBapps_dev/active/exist-3.1.0/WEB-INF/classes/META-INF/resources/xhtml.xsl: F:\tomcat-8.5.12\webapps\exist-3.1.0\WEB-INF\classes\META-INF\resources\xhtml.xsl (The system cannot find the path specified)
  at de.betterform.agent.web.filter.XFormsFilter.init(XFormsFilter.java:76)
  at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
  at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
  at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
  at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4599)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5242)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
  at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1107)
  at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1841)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
Caused by: de.betterform.xml.config.XFormsConfigException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerConfigurationException: net.sf.saxon.s9api.SaxonApiException: I/O error reported by XML parser processing file:/F:/ctb/CTB_webapps/CTBapps_dev/active/exist-3.1.0/WEB-INF/classes/META-INF/resources/xhtml.xsl: F:\tomcat-8.5.12\webapps\exist-3.1.0\WEB-INF\classes\META-INF\resources\xhtml.xsl (The system cannot find the path specified)
  at de.betterform.agent.web.WebFactory.initTransformerService(WebFactory.java:206)
  at de.betterform.agent.web.filter.XFormsFilter.init(XFormsFilter.java:72)
  ... 16 more
Caused by: javax.xml.transform.TransformerException: javax.xml.transform.TransformerConfigurationException: net.sf.saxon.s9api.SaxonApiException: I/O error reported by XML parser processing file:/F:/ctb/CTB_webapps/CTBapps_dev/active/exist-3.1.0/WEB-INF/classes/META-INF/resources/xhtml.xsl: F:\tomcat-8.5.12\webapps\exist-3.1.0\WEB-INF\classes\META-INF\resources\xhtml.xsl (The system cannot find the path specified)
  at de.betterform.xml.xslt.impl.CachingTransformerService.getTransformer(CachingTransformerService.java:156)
  at de.betterform.agent.web.WebFactory.initTransformerService(WebFactory.java:188)
  ... 17 more
Caused by: javax.xml.transform.TransformerConfigurationException: net.sf.saxon.s9api.SaxonApiException: I/O error reported by XML parser processing file:/F:/ctb/CTB_webapps/CTBapps_dev/active/exist-3.1.0/WEB-INF/classes/META-INF/resources/xhtml.xsl: F:\tomcat-8.5.12\webapps\exist-3.1.0\WEB-INF\classes\META-INF\resources\xhtml.xsl (The system cannot find the path specified)
  at net.sf.saxon.jaxp.SaxonTransformerFactory.newTemplates(SaxonTransformerFactory.java:155)
  at de.betterform.xml.xslt.impl.CachingTransformerService.getTransformer(CachingTransformerService.java:150)
  ... 18 more
Caused by: net.sf.saxon.s9api.SaxonApiException: I/O error reported by XML parser processing file:/F:/ctb/CTB_webapps/CTBapps_dev/active/exist-3.1.0/WEB-INF/classes/META-INF/resources/xhtml.xsl: F:\tomcat-8.5.12\webapps\exist-3.1.0\WEB-INF\classes\META-INF\resources\xhtml.xsl (The system cannot find the path specified)
  at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:546)
  at net.sf.saxon.jaxp.SaxonTransformerFactory.newTemplates(SaxonTransformerFactory.java:152)
  ... 19 more
Caused by: net.sf.saxon.trans.XPathException: I/O error reported by XML parser processing file:/F:/ctb/CTB_webapps/CTBapps_dev/active/exist-3.1.0/WEB-INF/classes/META-INF/resources/xhtml.xsl: F:\tomcat-8.5.12\webapps\exist-3.1.0\WEB-INF\classes\META-INF\resources\xhtml.xsl (The system cannot find the path specified)
  at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:467)
  at net.sf.saxon.event.Sender.send(Sender.java:171)
  at net.sf.saxon.style.StylesheetModule.loadStylesheetModule(StylesheetModule.java:128)
  at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:131)
  at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:94)
  at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:543)
  ... 20 more
Caused by: java.io.FileNotFoundException: F:\tomcat-8.5.12\webapps\exist-3.1.0\WEB-INF\classes\META-INF\resources\xhtml.xsl (The system cannot find the path specified)
  at java.io.FileInputStream.open0(Native Method)
  at java.io.FileInputStream.open(FileInputStream.java:195)
  at java.io.FileInputStream.<init>(FileInputStream.java:138)
  at java.io.FileInputStream.<init>(FileInputStream.java:93)
  at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
  at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
  at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
  at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
  at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
  at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:440)
  ... 25 more

I'm not sure if this missing file at \WEB-INF\classes\META-INF\resources\xhtml.xsl is the root of the error, but initialization of the eXist-3.1.0 WAR file is stopped, and eXist is not accessible in Tomcat.

Yet, when the XFormsFilter sections are commented out in web.xml, eXist is deployed correctly. Hence, the problem most likely lies with XFormsFilter.

What did you expect

Deployment without errors of the eXist WAR file in Tomcat.

Describe how to reproduce or add a test

  1. create an eXist WAR build on a fresh 3.1.0 installation by the build dist-war command
  2. unpack the generated .war file in an exist-3.1.0 folder inside the webapps folder of Tomcat-8.5.12
  3. start Tomcat-8.5.12

Context information

joewiz commented 7 years ago

@rvdb Was this issue new in 3.1.0? If not, do you remember how far back you experienced this issue?

rvdb commented 7 years ago

I think it's new, IIRC I got a 3.0 WAR working. Will check and report back.

rvdb commented 7 years ago

Sorry, I've been confused in my previous comment. Apparently, it's the Tomcat version that is the determining factor. All eXist versions since 3.0-RC1 up to 3.1.0 behave the same, so no difference there. Here's a summary:

So, most likely something has changed in Tomcat that the BetterForm JAR is not prepared for. I think these specs might be useful:

Combined with these observations:

Perhaps something in the Betterform JAR should be updated to Java Servlet Spec version 4.0? Could there have been a change to Java Servlet Spec version 4.0 in the way paths are interpreted inside JARs that causes BetterForm to look for that file in the wrong location? Just an uneducated guess, though...

dizzzz commented 7 years ago

@JoernT ?

adamretter commented 7 years ago

@JoernT Any comments on this please?

karljacuncha commented 7 years ago

Ran into the same problem here, and this is what I did to resolve it:

Following their notes from here: https://betterform.wordpress.com/deploying-a-dev-version-to-exist/

Clone & build betterFORM from github: https://github.com/betterFORM/betterFORM

ant -f build-XRX.xml update-betterFORM

Then replace: exist/WEB-INF/lib/betterform-exist-5.1-SNAPSHOT-20160615.jar with betterFORM/web/target/betterform.jar

And copy the contents of betterFORM/web/target/classes/META-INF/ to: exist/WEB-INF/classes/META-INF/

There is an xhtml.xsl file in META-INF/resources/xsl/ so I just copied that to META-INF/resources/ and that seems to be working enough to start Tomcat 8.5, get to the eXist dashboard and use the apps.

dizzzz commented 7 years ago

@JoernT ? looks like a smart thing?

JoernT commented 7 years ago

sorry guys - miss my notifications too often.

Yes, this seems to be nice workaround to me.

Most likely there a problem with loading the resources from the jar so putting them by the side lets Tomcat resolve them correctly.