Saxon XMLBeans Tomcat

只愿长相守 提交于 2019-12-08 04:13:19

问题


We recently updated our Tomcat web service. The only things we really updated were that we updated XMLBeans to version 2.4 and Saxon to version 9.

Running it Netbeans and eclipse, our project now works fine, but when trying to deploy to tomcat we get the following.

We tried updating JAXEN to version 1.1.1 but no joy.

Any ideas?

The error we get in deployment is:

java.lang.IllegalArgumentException: dom4j-core,jdom,xml-apis,xerces,junit-Extension-Name
        at java.util.jar.Attributes$Name.(Attributes.java:440)
        at java.util.jar.Attributes.getValue(Attributes.java:99)
        at org.apache.catalina.util.ManifestResource.getRequiredExtensions(ManifestResource.java:186)
        at org.apache.catalina.util.ManifestResource.processManifest(ManifestResource.java:155)
        at org.apache.catalina.util.ManifestResource.(ManifestResource.java:52)
        at org.apache.catalina.util.ExtensionValidator.validateApplication(ExtensionValidator.java:186)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4154)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:511)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1220)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
        at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
        at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
        at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1458)
        at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:820)
        at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:348)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:196)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)

回答1:


The problem is being caused by a JAR file whose MANIFEST.MF file contains a value for the Extension-List attribute that Tomcat doesn't like. Tomcat expects this attribute's value to be a space-separated list of extension names (see the ManifestResource source), but it appears one of your JARs has the comma-separated list dom4j-core,jdom,xml-apis,xerces,junit instead. There are no spaces in this list, so Tomcat thinks it's all one big extension name.

Extension names are also used to prefix names of further attributes within the manifest. For example, here's part of a valid manifest:

Extension-List: ant qdox commons-attributes-api javadoc
ant-Extension-Name: ant
ant-Implementation-Version: 1.5
ant-Implementation-URL: http://www.ibiblio.org/maven/ant/jars/ant-1.5.
 jar
qdox-Extension-Name: qdox
qdox-Implementation-Version: 1.5

Attribute names can only contain letters, numbers, hyphens and underscores, and so extension names must also follow the same rules. An extension name with a comma in it is clearly not valid, and this is why you are getting the exception above.

I've had a look at the official JAR file specification, but that appears not to state how these extension names should be delimited.

I can't say which JAR has this comma-separated Extension-List attribute in its manifest. However, I would check the JAR files within the latest versions of XMLBeans and Saxon first. If your project worked before the upgrade, then it's likely that the problem has been caused by something that has changed recently.

The fix is of course to edit the offending manifest file to use spaces instead of commas in its Extension-List attribute.

Good luck!



来源:https://stackoverflow.com/questions/854711/saxon-xmlbeans-tomcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!