spring 4.1.6发布版本问题

时间:2015-04-25 06:59:24

标签: java spring maven spring-mvc

我正在尝试使用spring 4.1.6建立一个项目。我试过AbstractAnnotationConfigDispatcherServletInitializer with servlet 3.0但没有运气。我正在使用websphere version 8.5.5.

经过大量搜索后,我发现了以下帖子中的类似问题,我一定会使用基于web.xml的配置。

Cannot deploy Spring App to Websphere

根据宝贵的建议,我更新了websphere的类加载器属性,并从web.xml中删除了条目,之后我面临以下错误。

[4/26/15 22:44:09:390 GST] 00000047 AppManagement W   ADMA0116W: Unable to start: SpringSiteEAR using: WebSphere:name=ApplicationManager,process=server1,platform=proxy,node=OICTCSPRJ15Node01,version=8.5.5.0,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=OICTCSPRJ15Node01Cell,spec=1.0 exception is: javax.management.MBeanException: Exception thrown in RequiredModelMBean while trying to invoke operation startApplication
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1299)
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1088)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:831)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:804)
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
    at com.ibm.ws.management.application.AppManagementImpl._startApplication(AppManagementImpl.java:1482)
    at com.ibm.ws.management.application.AppManagementImpl.startApplication(AppManagementImpl.java:1371)
    at com.ibm.ws.management.application.AppManagementImpl.startApplication(AppManagementImpl.java:1320)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:613)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:804)
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
    at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:613)
    at com.ibm.ws.management.connector.soap.SOAPConnector.invoke(SOAPConnector.java:478)
    at com.ibm.ws.management.connector.soap.SOAPConnector.service(SOAPConnector.java:312)
    at com.ibm.ws.management.connector.soap.SOAPConnection.handleRequest(SOAPConnection.java:65)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:733)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:532)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer could not be instantiated: java.lang.VerifyError: JVMVRFY013 class loading constraint violated&#59&#59; class=org/springframework/web/SpringServletContainerInitializer, method=onStartup&#40&#59;Ljava/util/Set&#59&#59;Ljavax/servlet/ServletContext&#59&#59;&#41&#59;V, pc=0
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:432)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1175)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1266)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:613)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:68)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:613)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:287)
    at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1256)
    at java.security.AccessController.doPrivileged(AccessController.java:252)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1250)
    ... 40 more
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer could not be instantiated: java.lang.VerifyError: JVMVRFY013 class loading constraint violated&#59&#59; class=org/springframework/web/SpringServletContainerInitializer, method=onStartup&#40&#59;Ljava/util/Set&#59&#59;Ljavax/servlet/ServletContext&#59&#59;&#41&#59;V, pc=0
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:759)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
    ... 73 more
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer could not be instantiated: java.lang.VerifyError: JVMVRFY013 class loading constraint violated&#59; class=org/springframework/web/SpringServletContainerInitializer, method=onStartup(Ljava/util/Set&#59;Ljavax/servlet/ServletContext&#59;)V, pc=0
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:176)
    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
    ... 75 more
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer could not be instantiated: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=org/springframework/web/SpringServletContainerInitializer, method=onStartup(Ljava/util/Set;Ljavax/servlet/ServletContext;)V, pc=0
    at java.util.ServiceLoader.fail(ServiceLoader.java:235)
    at java.util.ServiceLoader.access$100(ServiceLoader.java:192)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:388)
    at java.util.ServiceLoader$1.next(ServiceLoader.java:456)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:535)
    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
    ... 76 more
Caused by: java.lang.VerifyError: JVMVRFY013 class loading constraint violated; class=org/springframework/web/SpringServletContainerInitializer, method=onStartup(Ljava/util/Set;Ljavax/servlet/ServletContext;)V, pc=0
    at java.lang.J9VMInternals.verifyImpl(Native Method)
    at java.lang.J9VMInternals.verify(J9VMInternals.java:93)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:170)
    at java.lang.J9VMInternals.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1600)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:384)
    ... 81 more
启用类加载器属性并删除servlet配置后的

web.xml内容。

  <?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    metadata-complete="false">
    <servlet>
        <display-name>SpringSite</display-name>
        <display-name>SpringSiteStartup</display-name>
        <servlet-name>SpringSiteStartup</servlet-name>
        <servlet-class>main.java.springsite.startup.SpringSiteStartup</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <security-role>
        <role-name>User</role-name>
    </security-role>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>secure connection</web-resource-name>
            <url-pattern>/*</url-pattern>
            <http-method>DELETE</http-method>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>PUT</http-method>
            <http-method>HEAD</http-method>
        </web-resource-collection>
        <user-data-constraint>
            <description>SSL or MSSL not required</description>
            <transport-guarantee>NONE</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

请找到以下pom.xml我正在使用

    <repositories>
    <repository>
        <id>spring-snasphot</id>
        <url>https://repo.spring.io/snapshot</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>1.8.0.RELEASE</version>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <artifactId>aspectjrt</artifactId>
                <groupId>org.aspectj</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-expression</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-instrument</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-oxm</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.thymeleaf.extras</groupId>
        <artifactId>thymeleaf-extras-tiles2-spring4</artifactId>
        <version>2.1.1.RELEASE</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.thymeleaf</groupId>
        <artifactId>thymeleaf-spring4</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <scope>compile</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>servlet-api</artifactId>
        <version>3.0.20100224</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>jstl-api</artifactId>
        <version>1.2</version>
        <exclusions>
            <exclusion>
                <artifactId>servlet-api</artifactId>
                <groupId>javax.servlet</groupId>
            </exclusion>
        </exclusions>
        <scope>provided</scope>
    </dependency>       
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>${cglib.version}</version>
    </dependency>
    <dependency>
        <groupId>aopalliance</groupId>
        <artifactId>aopalliance</artifactId>
        <version>1.0</version>
    </dependency>
</dependencies>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.spring.platform</groupId>
            <artifactId>platform-bom</artifactId>
            <version>1.1.2.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

为我的项目找到以下mvn dependency:tree输出

[INFO] +- org.springframework.data:spring-data-jpa:jar:1.8.0.RELEASE:compile
[INFO] |  +- org.springframework.data:spring-data-commons:jar:1.9.2.RELEASE:compile (version managed from 1.10.0.RELEASE)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 4.0.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 4.0.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.slf4j:slf4j-api:jar:1.7.11:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] |  |  \- (org.slf4j:jcl-over-slf4j:jar:1.7.11:runtime - version managed from 1.7.10; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-orm:jar:4.1.6.RELEASE:compile - version managed from 4.0.9.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-aop:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-tx:jar:4.1.6.RELEASE:compile - version managed from 4.0.9.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.11:compile
[INFO] |  \- (org.slf4j:jcl-over-slf4j:jar:1.7.11:compile - version managed from 1.7.6; scope updated from runtime; omitted for duplicate)
[INFO] +- org.springframework.security:spring-security-config:jar:3.2.7.RELEASE:compile
[INFO] |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] |  +- org.springframework.security:spring-security-core:jar:3.2.7.RELEASE:compile
[INFO] |  |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-aop:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-expression:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-aop:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- org.springframework.security:spring-security-web:jar:3.2.7.RELEASE:compile
[INFO] |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] |  +- (org.springframework.security:spring-security-core:jar:3.2.7.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-expression:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-web:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-aop:jar:4.1.6.RELEASE:compile
[INFO] |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-aspects:jar:4.1.6.RELEASE:compile
[INFO] |  \- org.aspectj:aspectjweaver:jar:1.8.5:compile
[INFO] +- org.springframework:spring-beans:jar:4.1.6.RELEASE:compile
[INFO] |  \- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-context:jar:4.1.6.RELEASE:compile
[INFO] |  +- (org.springframework:spring-aop:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-expression:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-context-support:jar:4.1.6.RELEASE:compile
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-core:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework:spring-expression:jar:4.1.6.RELEASE:compile
[INFO] |  \- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-instrument:jar:4.1.6.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.1.6.RELEASE:compile
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-tx:jar:4.1.6.RELEASE:compile - version managed from 4.0.9.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-jms:jar:4.1.6.RELEASE:compile
[INFO] |  +- (org.springframework:spring-aop:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- org.springframework:spring-messaging:jar:4.1.6.RELEASE:compile
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-tx:jar:4.1.6.RELEASE:compile - version managed from 4.0.9.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-orm:jar:4.1.6.RELEASE:compile
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-jdbc:jar:4.1.6.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-tx:jar:4.1.6.RELEASE:compile - version managed from 4.0.9.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-oxm:jar:4.1.6.RELEASE:compile
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-test:jar:4.1.6.RELEASE:compile
[INFO] |  \- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.3:test
[INFO] |  +- ch.qos.logback:logback-core:jar:1.1.3:test
[INFO] |  \- (org.slf4j:slf4j-api:jar:1.7.11:test - version managed from 1.7.7; omitted for duplicate)
[INFO] +- junit:junit:jar:4.11:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.springframework.security:spring-security-taglibs:jar:3.2.7.RELEASE:compile
[INFO] |  +- org.springframework.security:spring-security-acl:jar:3.2.7.RELEASE:compile
[INFO] |  |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] |  |  +- (org.springframework.security:spring-security-core:jar:3.2.7.RELEASE:compile - omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-aop:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-jdbc:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-tx:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework.security:spring-security-core:jar:3.2.7.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework.security:spring-security-web:jar:3.2.7.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-aop:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-expression:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-web:jar:4.1.6.RELEASE:compile - version managed from 3.2.13.RELEASE; omitted for duplicate)
[INFO] +- org.mortbay.jetty:servlet-api:jar:3.0.20100224:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- javax.servlet:jstl:jar:1.2:provided
[INFO] +- javax.servlet.jsp.jstl:jstl-api:jar:1.2:provided
[INFO] |  \- (javax.servlet.jsp:jsp-api:jar:2.1:provided - omitted for duplicate)
[INFO] +- cglib:cglib:jar:3.1:compile
[INFO] |  \- org.ow2.asm:asm:jar:4.2:compile
[INFO] \- aopalliance:aopalliance:jar:1.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

过去几天我一直坚持这个,没有任何运气。

1 个答案:

答案 0 :(得分:1)

嘿伙计们,问题在于默认的websphere servlet容器。当我使用父级的类加载器策略时,最后一个websphere在加载spring webmvc类之后加载了servlet类。因此,在验证阶段(Details Here)加载启动器类时弹簧失败。

我已将“servlet”和“servlet jsp”jar范围更改为“已编译”而不是“已提供”以使解决方案正常工作。在下面找到我修改过的依赖项:

    <repositories>
        <repository>
            <id>spring-snasphot</id>
            <url>https://repo.spring.io/snapshot</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.8.0.RELEASE</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <artifactId>aspectjrt</artifactId>
                    <groupId>org.aspectj</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-instrument</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-oxm</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-tiles2-spring4</artifactId>
            <version>2.1.1.RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity4</artifactId>
            <version>2.1.2.RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf-spring4</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>servlet-api</artifactId>
            <version>3.0.20100224</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp.jstl</groupId>
            <artifactId>jstl-api</artifactId>
            <version>1.2</version>
            <exclusions>
                <exclusion>
                    <artifactId>servlet-api</artifactId>
                    <groupId>javax.servlet</groupId>
                </exclusion>
            </exclusions>
            <scope>compile</scope>
        </dependency>       
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>${cglib.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>aopalliance</groupId>
            <artifactId>aopalliance</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-core</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-servlet</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-template</artifactId>
            <version>3.0.5</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>spring-js</artifactId>
            <scope>compile</scope>
        </dependency>       
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.spring.platform</groupId>
                <artifactId>platform-bom</artifactId>
                <version>1.1.2.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

如果您包含AOP功能,也可以安装已知websphere issue的修订包。

感谢各位朋友帮我解决此问题。提供的建议非常有用。