-3

IDE:Idea FrameWork:Spring+SringMVC+Mybatis+MongoDB+ActiveMQ Please give me a hand,thanks.

I add others error infomation. It's strange that while I use "mvn tomcat7:run" to start the project ,it started success! but using debug/run in idea , it occurs these errors.

java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.doWithLocalFields(Ljava/lang/Class;Lorg/springframework/util/ReflectionUtils$FieldCallback;)V
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:418)

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Wed Aug 24 15:09:35 CST 2016]; root of context hierarchy

[2016-08-24 15:09:36] --- [WARN] --- [AbstractApplicationContext.java:887] --- [Exception thrown from LifecycleProcessor on context close] --- at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:357) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:884) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:843) at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:581) at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5124) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5786) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1836) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$256(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

This is My pom.xml Please have a look, thank u.

 <spring.version>4.3.2.RELEASE</spring.version>
    <mybatis.version>3.4.1</mybatis.version>
    <mybatis-spring.version>1.3.0</mybatis-spring.version>


    <aspectjweaver.version>1.8.9</aspectjweaver.version>
    <persistence-api.version>1.0.2</persistence-api.version>


    <junit.version>4.12</junit.version>
    <mysql-connector.version>5.1.21</mysql-connector.version>
    <druid.version>1.0.4</druid.version>


    <spring-mongodb.version>1.9.1.RELEASE</spring-mongodb.version>
    <spring-boot.version>1.3.3.RELEASE</spring-boot.version>
    <mongodb.version>3.2.0</mongodb.version>

    <activemq.version>5.13.2</activemq.version>
    <spring-jms.version>4.2.5.RELEASE</spring-jms.version>
  • Looks like you have incompatible versions in your pom.xml somewhere: `java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.doWithLocalFields(...)` – Florian Schaetz Aug 24 '16 at 06:11
  • yes,you are right,but could u tell me what wrong with my versin config?please. – Niko Belic Aug 24 '16 at 06:17
  • That's not your complete POM. Run a `mvn dependency:tree` and post the output. – dunni Aug 24 '16 at 06:41
  • @dunni Sorry,there is something wrong with my maven... `[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:3.0 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-dependency-plugin:jar:3.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]` – Niko Belic Aug 24 '16 at 07:12
  • And it's very strange that I use mvn tomcat:run,the project started success. That make me crazy.... – Niko Belic Aug 24 '16 at 07:15

1 Answers1

0

It is a conflict with different versions of the same library. Run:

mvn dependency:tree > dep.txt

and check which libraries are duplicated. Then exclude conflicting libraries (preferably older version) in pom.xml, by:

        <dependency>
            <groupId>test</groupId>
            <artifactId>test-art</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>conf-test</groupId>
                    <artifactId>conf-test-err</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

when "conf-test-err" is the older version to exclude. In your case it will be probably "org.springframework.orm".

Fr333du
  • 191
  • 13
  • I use mvn:dependency:tree , but show this..... `[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:3.0 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-dependency-plugin:jar:3.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]` – Niko Belic Aug 24 '16 at 07:10
  • And it's very strange that I use mvn tomcat:run,the project started success. That make me crazy.... – Niko Belic Aug 24 '16 at 07:14
  • Try http://stackoverflow.com/questions/12533885/could-not-calculate-build-plan-plugin-org-apache-maven-pluginsmaven-resources – Fr333du Aug 24 '16 at 09:17