Apusic和tomcat下无法同时部署两个应用

 

      在金蝶Apusic 5.1下部署门户和oa系统,发现同时部署始终有一个会出现500错误,无法访问,而另外一个则正常。个深层错误原因如下:

2009-06-13 10:38:33 警告 [apusic.web.qjoa./qjoa] 无法转载过滤器 'Struts2'。
javax.servlet.ServletException: Caught exception while loading file struts-default.xml - [unknown location]
        at com.apusic.web.container.WebComponent.create(Unknown Source)
        at com.apusic.web.container.WebComponent.getComponent(Unknown Source)
        at com.apusic.web.container.WebComponent.init(Unknown Source)
        at com.apusic.web.container.WebContainer.loadFilter(Unknown Source)
        at com.apusic.web.container.WebContainer.loadFilters(Unknown Source)
        at com.apusic.web.container.WebContainer.start(Unknown Source)
        at com.apusic.web.http.VirtualHost.addContext(Unknown Source)
        at com.apusic.web.http.HttpServer.loadWebModule(Unknown Source)
        at com.apusic.web.WebService.loadWebModule(Unknown Source)
        at com.apusic.deploy.runtime.WebModule.load(Unknown Source)
        at com.apusic.deploy.runtime.J2EEApplication.loadModules(Unknown Source)
        at com.apusic.deploy.runtime.J2EEApplication.startApplication(Unknown Source)
        at com.apusic.deploy.runtime.J2EEApplication.startService(Unknown Source)
        at com.apusic.service.Service.start(Unknown Source)
        at com.apusic.deploy.runtime.J2EEDeployer.startUserApplications(Unknown Source)
        at com.apusic.deploy.runtime.J2EEDeployer.startService(Unknown Source)
        at com.apusic.service.Service.start(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.apusic.jmx.MBeanDescriptor.invoke(Unknown Source)
        at com.apusic.jmx.DynamicMBeanSupport.invoke(Unknown Source)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
        at com.apusic.server.J2EEServer.start(Unknown Source)
        at com.apusic.server.J2EEServer.startup(Unknown Source)
        at com.apusic.server.Main.main(Unknown Source)
Caused by: Caught exception while loading file struts-default.xml - [unknown location]
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:839)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
        at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
        at com.apusic.web.container.FilterComponent.initializeComponent(Unknown Source)
        at com.apusic.web.container.FilterComponent.initializeComponent(Unknown Source)
        ... 27 more
Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
        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 com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.<init>(SAX2DOM.java:69)
        at com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory.getSerializationHandler(TransletOutputHandlerFactory.java:187)
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(TransformerImpl.java:392)
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerHandlerImpl.setResult(TransformerHandlerImpl.java:137)
        at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.setup(DomHelper.java:213)
        at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:198)
        at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:189)
        at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:175)
        at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:830)
        ... 36 more
2009-06-13 10:38:33 信息 [apusic.web.qjoa./qjoa] Context Root [/qjoa]

 

        初一看,还让人以为是无法加载stuts2的默认配置文件struts-default.xml的问题。但是单独均部署成功的测试让我打消了这方面的疑虑。看来应该是个conflict了。

  

        问题的真正原因在这里:

 

Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
        at org.apache.xerces.parsers.DOMParser

 

       正是由于这里的冲突,导致无法加载解析struts2的xml文件。最终定为在xerces.jar 冲突的原因。查看了两个project,确实均有xerces.jar 包,任意删除一个项目中的一个,只要两个project不同时存在xerces.jar ,发布成功。

  联想到不久前在tomcat下同时部署碰到的同样问题。原因肯定也在这里了。只是当时并没有深究。

  参考自国外的同样问题讨论,详见:

http://www.nabble.com/org.apache.xerces.parsers.XML11Configuration-cannot-be-cast-to-org.apache.xerces.xni.parser.XMLParserConfiguration-td14108368.html

你可能感兴趣的:(java,apache,tomcat,Web,struts)