【问题标题】:Spring MVC | IBM Websphere Application Server | Server Startup Error春季MVC | IBM Websphere 应用服务器 |服务器启动错误
【发布时间】:2013-07-17 12:57:38
【问题描述】:

在 IBM WAS 6.1 上部署 Spring MVC 应用程序时出现以下错误。

[17/07/13 12:31:55:466 BST] 0000001a WebApp        E   Exception caught while initializing context 
org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0':
Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: 
Could not instantiate bean class [org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter]:
Constructor threw exception; nested exception is java.lang.ClassCastException:
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl incompatible 
with javax.xml.transform.TransformerFactory
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
            at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:917)
            at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:378)
            at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:338)
            at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:93)
            at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:162)
            at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:673)
            at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:626)
            at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:395)
            at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:611)
            at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1274)
            at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1164)
            at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:591)
            at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:831)
            at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:945)
            at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:2120)
            at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:342)
            at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1551)

相同的应用程序在 Tomcat + Eclipse 上运行良好。但是当我使用 Rational Application Developer 在 IBM WAS 6.1 上部署它时,我在服务器启动期间遇到了这个错误。

谁能帮我解决这个错误。

提前致谢!

【问题讨论】:

标签: java spring-mvc websphere


【解决方案1】:

这是一个类加载器问题,与XSLT ClassCastException in WebSphere when Spring tries to create an AnnotationMethodHandlerAdapter 非常相似

所以尝试将类加载器策略设置为 PARENT_LAST 并从您的应用程序中删除对 xml-apis / xerces / javax.xml jar 的所有依赖项。

【讨论】:

  • 我只是在使用 xalan.jar,如果我删除它,我会开始收到 Provider for com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl is not found 错误。
  • 您是否直接在应用程序中使用 xalan.jar 中的类?如果是这样,请确保您正确地实例化所有内容(通过TransformerFactory 等)否则,您可以通过设置javax.xml.transform.TransformerFactory 系统属性来更改默认的TransformerFactory 实现。
  • 你知道如何在 Websphere 应用服务器中设置系统属性 javax.xml.transform.TransformerFactory 以及哪个实现与 javax.xml.transform.TransformerFactory 兼容
  • 尝试将此添加到您的 web.xml <system-property javax.xml.transform.TransformerFactory="org.apache.xalan.processor.TransformerFactoryImpl"/>
  • 我刚刚检查了com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl 的类层次结构。它扩展了javax.xml.transform.sax.SAXTransformerFactory,而后者又扩展了javax.xml.transform.TransformerFactory ,那么为什么服务器会抛出ClassCastException?
猜你喜欢
  • 2018-10-10
  • 1970-01-01
  • 1970-01-01
  • 2012-05-06
  • 1970-01-01
  • 1970-01-01
  • 2011-12-30
  • 1970-01-01
  • 2018-02-28
相关资源
最近更新 更多