我有一个使用Java javax.xml.transform.Template
来缓存静态XSLT的Web应用程序,我正在使用Saxon HE处理器来使用这些模板转换XML。
我的问题是,每次我在Glassfish上重新部署我的应用程序时,我都会在进行转换时遇到此异常:
[2014-07-24T11:14:19.579+0200] [glassfish 4.0] [SEVERE] [] [com.sun.xml.ws.server.sei.TieHandler] [tid: _ThreadID=23 _ThreadName=http-listener-1(4)] [timeMillis: 1406193259579] [levelValue: 1000] [[
This web container has not yet been started
java.lang.IllegalStateException: This web container has not yet been started
at org.glassfish.web.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:2819)
at org.glassfish.web.loader.WebappClassLoader.findResource(WebappClassLoader.java:1288)
at org.glassfish.web.loader.WebappClassLoader.findResource(WebappClassLoader.java:1272)
at org.glassfish.web.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1506)
at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
at net.sf.saxon.dom.DOMObjectModel.getDocumentBuilder(DOMObjectModel.java:208)
at net.sf.saxon.lib.SerializerFactory.getReceiver(SerializerFactory.java:251)
at net.sf.saxon.lib.SerializerFactory.getReceiver(SerializerFactory.java:104)
at net.sf.saxon.Controller.openResult(Controller.java:2290)
at net.sf.saxon.Controller.transformDocument(Controller.java:2043)
at net.sf.saxon.Controller.transform(Controller.java:1903)
... my own packages start here
我唯一能做的就是重新启动Glassfish(它上面有几个应用程序,所以需要一段时间),然后再试一次。这真令人讨厌并妨碍我的开发周期。
有什么想法吗?
发现问题和解决方法
问题在于在Glassfish的背书目录中使用Saxon lib。我试图变得聪明,让Saxon为所有应用程序处理javax XSLT,而不是安装任何默认变换器。用我的应用程序打包Saxon lib解决了这个问题。