Spring 3.1:启动时BeanDefinitionStoreException

时间:2013-03-22 17:17:04

标签: spring-3 weblogic11g

Microsoft Windows 7专业版

WebLogic 11g

Java 1.6(带有weblogic的版本)

春季3.1

我使用WebLogic 11g和Spring 3.1在Windows XP Professional PC上进行Java Webapp开发。一切都很好。

然后我不得不迁移到运行Windows 7 Professional的新计算机。

我想我可能已经错过了设置一切以使其全部恢复工作的一步。

我的网络应用程序是" ACME",acme.war

当我尝试在计算机上导航到我的webapp时,出现以下错误:

weblogic.application.ModuleException:[HTTP:101216] Servlet: " ACME"无法在Web应用程序启动时预加载:" acme.war"。 org.springframework.beans.factory.BeanDefinitionStoreException: 从ServletContext资源[/WEB-INF/acme-servlet.xml]解析XML文档时出现意外异常; 嵌套异常是java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add (Ljava /郎/字符串; Ljava /郎/对象;)Lorg / springframework的/豆类/ MutablePropertyValues;

以下是完整的堆栈跟踪:

weblogic.application.ModuleException: [HTTP:101216]Servlet: 
"acme" failed to preload on startup in Web application: "acme.war".
org.springframework.beans.factory.BeanDefinitionStoreException: 
Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/acme-servlet.xml]; 
nested exception is java.lang.NoSuchMethodError: 
org.springframework.beans.MutablePropertyValues.add
(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;

        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader
.java:143)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader
.java:178)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader
.java:149)
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)

        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplica
tionContext.java:123)
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:4
22)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)
        at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
        at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
        at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
        at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
        at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1981)
        at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1955)
        at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1874)
        at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3154)
        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1518)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:484)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
        at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
        at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
        at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:44)
        at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
        at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:149)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
        at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCa
llbackDeliverer.java:195)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallback
Deliverer.java:13)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliv
erer.java:68)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)L
org/springframework/beans/MutablePropertyValues;
        at org.springframework.web.servlet.config.ResourcesBeanDefinitionParser.registerResourceHandler(ResourcesBeanDefinitionPar
ser.java:93)
        at org.springframework.web.servlet.config.ResourcesBeanDefinitionParser.parse(ResourcesBeanDefinitionParser.java:50)
        at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java
:1297)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java
:1287)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDoc
umentReader.java:135)
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinition
DocumentReader.java:92)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)

        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
        ... 58 more

        at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1520)
        at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:484)
        at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)L
org/springframework/beans/MutablePropertyValues;
        at org.springframework.web.servlet.config.ResourcesBeanDefinitionParser.registerResourceHandler(ResourcesBeanDefinitionPar
ser.java:93)
        at org.springframework.web.servlet.config.ResourcesBeanDefinitionParser.parse(ResourcesBeanDefinitionParser.java:50)
        at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java
:1297)
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java
:1287)
        Truncated. see log file for complete stacktrace

以下是我的acme-servlet.xml文件的副本:

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:util="http://www.springframework.org/schema/util"
  xsi:schemaLocation="http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util-3.1.xsd">

  <context:component-scan base-package="com.acme.controller" />

  <mvc:resources mapping = "/**" location = "/,file:/apps1/bea/user_projects/domains/DBS/common/"/>
  <mvc:annotation-driven/>

  <!-- define the properties file to use -->
  <util:properties id = "messages" location="classpath:/messages.properties" />

  <bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name = "prefix" value = "/jsp/"/>
    <property name = "suffix" value = ".jsp"/>
  </bean>

  <bean name="af" class="com.acme.controller.security.AuthenticationFilter"/>

  <!-- Configure the multipart resolver -->
  <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <!-- one of the properties available; the maximum file size in bytes -->
    <property name="maxUploadSize" value="100000000"/>
  </bean>
</beans>

以下是我在战争中的文件列表/ WEB-INF / lib中的acme.war:

aopalliance-1.0.jar
commons-beanutils-1.8.2.jar
commons-collections-3.2.1.jar
commons-digester-2.0.jar
commons-fileupload-1.2.2.jar
commons-io-2.4.jar
commons-jexl-2.0.1.jar
commons-lang-2.5.jar
commons-logging-1.1.1.jar
commons-validator.jar
dom4j-1.6.1.jar
geronimo-stax-api_1.0_spec-1.0.jar
hibernate-validator-4.3.0.Final.jar
jackson-core-asl-1.9.7.jar
jackson-mapper-asl-1.9.7.jar
jboss-logging-3.1.0.CR2.jar
jstl-api-1.2-rev-1.jar
jstl-impl-1.2.jar
jta-1.1.jar
log4j-1.2.16.jar
mail.jar
poi-3.7.jar
poi-ooxml-3.7.jar
poi-ooxml-schemas-3.7.jar
quartz-1.8.0.jar
quartz-all-1.8.0.jar
servlet-api.jar
slf4j-api-1.5.10.jar
slf4j-log4j12-1.5.10.jar
spring-aop-3.0.6.RELEASE.jar
spring-asm-3.1.1.RELEASE.jar
spring-beans-3.1.1.RELEASE.jar
spring-context-3.1.1.RELEASE.jar
spring-context-support-3.1.1.RELEASE.jar
spring-core-3.1.1.RELEASE.jar
spring-expression-3.1.1.RELEASE.jar
spring-jdbc-3.0.6.RELEASE.jar
spring-ldap-core-1.3.1.RELEASE.jar
spring-security-acl-3.1.0.RELEASE.jar
spring-security-config-3.1.0.RELEASE.jar
spring-security-core-3.1.0.RELEASE.jar
spring-security-crypto-3.1.0.RELEASE.jar
spring-security-ldap-3.1.0.RELEASE.jar
spring-security-taglibs-3.1.0.RELEASE.jar
spring-security-web-3.1.0.RELEASE.jar
spring-tx-3.0.6.RELEASE.jar
spring-web-3.1.1.RELEASE.jar
spring-webmvc-3.1.1.RELEASE.jar
stax-1.2.0.jar
stax-api-1.0.1.jar
urlrewritefilter-4.0.3.jar
validation-api-1.0.0.GA.jar
xml-apis-1.0.b2.jar
xmlbeans-2.3.0.jar

我指向了我的JAVA_HOME环境变量 C:\ ORACLE \中间件\ jdk160_29 (这是关于weblogic 11g的安装)

我在PATH变量中有这条路径。

我的系统范围Windows CLASSPATH只是一个&#39;。&#39;

提前感谢任何想法

史蒂夫


更新

我创建了一个weblogic.xml文件,把它放在war_root / WEB-INF /中我得到了这个错误信息

<Mar 25, 2013 12:12:42 PM EDT> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 1 task for
 the application '_appsdir_acme_war'.>
<Mar 25, 2013 12:12:42 PM EDT> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for applicat
ion '_appsdir_acme_war'.>
<Mar 25, 2013 12:12:42 PM EDT> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: [HTTP:101216]Servlet: "acme" failed to preload on startup in Web application: "acme.war".
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext reso
urce [/WEB-INF/acme-servlet.xml]; nested exception is java.lang.ClassCastException: weblogic.xml.jaxp.RegistryDocumentBuilderFactor
y cannot be cast to javax.xml.parsers.DocumentBuilderFactory

我猜我的weblogic.xml已关闭,现在是:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
  <!-- Use the version of Spring in WEB-INF/lib, not WebLogic's -->
  <wls:container-descriptor>
    <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
  </wls:container-descriptor>
</wls:weblogic-web-app>

1 个答案:

答案 0 :(得分:4)

WLS 11g安装附带 Spring 3.0.5 。因此,默认情况下,Spring 3.0.5相关的jar文件位于服务器类路径中。因为服务器类加载器是应用程序类加载器的父类加载器,所以Spring 3.0.5是在运行时使用的。如果您使用在Spring 3.1中实现但在Spring 3.0.5中不可用的任何方法,那么您将获得NoSuchMethodError是可以理解的。

解决方案是在weblogic.xml中添加以下部分

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