问题描述
各位大侠我在Spring.xml文件里配置了两个datasource,然后项目启动就报如下错误了,求帮助!org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:227)-Contextinitializationfailedorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'org.springframework.jmx.export.MBeanExporter#0'definedinURL[jar:file:portal-config-2.2.28.jar!/applicationContext.xml]:Invocationofinitmethodfailed;nestedexceptionisorg.springframework.jmx.export.UnableToRegisterMBeanException:UnabletoregisterMBean[{CreateTime:"2015-02-2818:02:23",ActiveCount:0,PoolingCount:5,CreateCount:5,DestroyCount:0,CloseCount:0,ConnectCount:0,Connections:[{ID:838794668,ConnectTime:"2015-02-2818:02:26",UseCount:0,LastActiveTime:"2015-02-2818:02:26"},{ID:2012626361,ConnectTime:"2015-02-2818:02:27",UseCount:0,LastActiveTime:"2015-02-2818:02:27"},{ID:117686720,ConnectTime:"2015-02-2818:02:31",UseCount:0,LastActiveTime:"2015-02-2818:02:31"},{ID:1626639887,ConnectTime:"2015-02-2818:02:32",UseCount:0,LastActiveTime:"2015-02-2818:02:32"},{ID:648088608,ConnectTime:"2015-02-2818:02:34",UseCount:0,LastActiveTime:"2015-02-2818:02:34"}]}[{ID:838794668,poolStatements:[]},{ID:2012626361,poolStatements:[]},{ID:117686720,poolStatements:[]},{ID:1626639887,poolStatements:[]},{ID:648088608,poolStatements:[]}]]withkey'pageDataSource';nestedexceptionisjavax.management.InstanceAlreadyExistsException:QOSS:type=DruidDataSourceatorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)atcom.cnc.portal.web.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:52)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)atorg.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1558)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:483)atorg.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)atcom.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)atcom.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)atorg.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:620)atorg.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:567)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:483)atorg.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)atcom.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)atcom.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)atjavax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)atjavax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)atjavax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)atjavax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)atjavax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:828)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:483)atsun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)atsun.rmi.transport.Transport$1.run(Transport.java:178)atsun.rmi.transport.Transport$1.run(Transport.java:175)atjava.security.AccessController.doPrivileged(NativeMethod)atsun.rmi.transport.Transport.serviceCall(Transport.java:174)atsun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:557)atsun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:812)atsun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:671)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)atjava.lang.Thread.run(Thread.java:745)Causedby:org.springframework.jmx.export.UnableToRegisterMBeanException:UnabletoregisterMBean[{CreateTime:"2015-02-2818:02:23",ActiveCount:0,PoolingCount:5,CreateCount:5,DestroyCount:0,CloseCount:0,ConnectCount:0,Connections:[{ID:838794668,ConnectTime:"2015-02-2818:02:26",UseCount:0,LastActiveTime:"2015-02-2818:02:26"},{ID:2012626361,ConnectTime:"2015-02-2818:02:27",UseCount:0,LastActiveTime:"2015-02-2818:02:27"},{ID:117686720,ConnectTime:"2015-02-2818:02:31",UseCount:0,LastActiveTime:"2015-02-2818:02:31"},{ID:1626639887,ConnectTime:"2015-02-2818:02:32",UseCount:0,LastActiveTime:"2015-02-2818:02:32"},{ID:648088608,ConnectTime:"2015-02-2818:02:34",UseCount:0,LastActiveTime:"2015-02-2818:02:34"}]}[{ID:838794668,poolStatements:[]},{ID:2012626361,poolStatements:[]},{ID:117686720,poolStatements:[]},{ID:1626639887,poolStatements:[]},{ID:648088608,poolStatements:[]}]]withkey'pageDataSource';nestedexceptionisjavax.management.InstanceAlreadyExistsException:QOSS:type=DruidDataSourceatorg.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:602)atorg.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:527)atorg.springframework.jmx.export.MBeanExporter.afterPropertiesSet(MBeanExporter.java:413)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)...56moreCausedby:javax.management.InstanceAlreadyExistsException:QOSS:type=DruidDataSourceatcom.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)atcom.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)atcom.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)atcom.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)atcom.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)atcom.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)atorg.springframework.jmx.support.MBeanRegistrationSupport.doRegister(MBeanRegistrationSupport.java:169)atorg.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:647)atorg.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:592)...60more