在Weblogic 9.2上运行Spring应用程序的ClassCastException

时间:2010-10-22 22:27:57

标签: java spring weblogic

我正在尝试将Spring 3应用程序部署到Weblogic 9.2。 JDK是JRockit 1.5。我正在使用jaxb 2.1并在战争中包括那些罐子。

我已经尝试将此添加到weblogic.xml中,因为我在包含的内容与我正在运行的环境之间存在冲突。

<wls:container-descriptor>
  <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
</wls:container-descriptor>

仍然没有运气。我做了一些禁止的事情,或者只是错过了一个关键的配置?

如果我遗漏了相关内容,请询问。提前谢谢。

这是错误:

 [wldeploy] java.lang.ClassCastException: weblogic.xml.jaxp.RegistryDocumentBuilderFactory
 [wldeploy]   at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
 [wldeploy]   at org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:87)
 [wldeploy]   at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:68)
 [wldeploy]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:361)
 [wldeploy]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
 [wldeploy]   at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
 [wldeploy]   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
 [wldeploy]   at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
 [wldeploy]   at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
 [wldeploy]   at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
 [wldeploy]   at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
 [wldeploy]   at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:394)
 [wldeploy]   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:324)
 [wldeploy]   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
 [wldeploy]   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
 [wldeploy]   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
 [wldeploy]   at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:376)
 [wldeploy]   at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
 [wldeploy]   at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
 [wldeploy]   at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:82)
 [wldeploy]   at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1608)
 [wldeploy]   at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2750)
 [wldeploy]   at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:889)
 [wldeploy]   at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:333)
 [wldeploy]   at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
 [wldeploy]   at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
 [wldeploy]   at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
 [wldeploy]   at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
 [wldeploy]   at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
 [wldeploy]   at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
 [wldeploy]   at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
 [wldeploy]   at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
 [wldeploy]   at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
 [wldeploy]   at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
 [wldeploy]   at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
 [wldeploy]   at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
 [wldeploy]   at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
 [wldeploy]   at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
 [wldeploy]   at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:566)
 [wldeploy]   at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:136)
 [wldeploy]   at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:104)
 [wldeploy]   at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:320)
 [wldeploy]   at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:815)
 [wldeploy]   at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1222)
 [wldeploy]   at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:433)
 [wldeploy]   at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:161)
 [wldeploy]   at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
 [wldeploy]   at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
 [wldeploy]   at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
 [wldeploy]   at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
 [wldeploy]   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
 [wldeploy]   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)

1 个答案:

答案 0 :(得分:0)

似乎这样ClassCastException是类加载冲突的结果。

你说你正在用你的Web应用程序捆绑一些JAR文件(我假设在WEB-INF/lib);我怀疑发生的事情是weblogic.xml.jaxp.RegistryDocumentBuilderFactory,它是WebLogic的DocumentBuilderFactory实现,由一个不同的类加载器加载,而不是加载其中一个接口(或它的超类,即JAXP的{{1} })。

让我们知道您在DocumentBuilderFactory内打包的JAR文件;我很确定罪魁祸首就在那里。