spring web 启动报错

问题描述

web.xml 配置如下<?xml version="1.0" encoding="UTF-8"?><web-app version="2.5" 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_2_5.xsd"> <display-name></display-name> <!-- log4配置 --> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/classes/log4j.properties</param-value> </context-param> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener><!-- 字符编码过滤器 --><filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 载入spring --><context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/classes/applicationContext.xml</param-value> <!--可载入多个配置文件分隔符 , ; t n --> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list></web-app>主配置如下:<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property> <property name="url"> <value>jdbc:mysql://192.168.1.222:3306/aaa</value> </property> <property name="username"> <value>root</value> </property> <property name="password"> <value>nws</value> </property> </bean> <!-- 配置事务管理器 --><bean id="transcationManager"class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource" /></bean><tx:advice id="txAdvice" transaction-manager="transcationManager"><tx:attributes><tx:method name="insert*" propagation="REQUIRED" /><tx:method name="del*" propagation="REQUIRED" /><tx:method name="update*" propagation="REQUIRED" /><tx:method name="*" read-only="true" /></tx:attributes></tx:advice><!-- 配置AOP切入点 --><aop:config><aop:pointcut id="allManagerMethod"expression="execution(* com.scxxs.dao.*.*(..))" /><aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod" /></aop:config><bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource"> <ref local="dataSource"/> </property> </bean><bean id="springDemoDao" class="com.scxxs.dao.impl.SpringDaoDemoImpl"><property name="jdbcTemplate" ref="jdbcTemplate" /></bean> </beans> 引用的jar 如图:我试过 引用 我原来 项目的老包的话 项目启动是没问题的,但是 换上 图上的新包后我的项目启动 报错:报错信息如下:java.lang.NoSuchMethodError: org.springframework.web.context.support.XmlWebApplicationContext.getEnvironment()Lorg/springframework/core/env/ConfigurableEnvironment;at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:87)at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:495)at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)at org.apache.catalina.core.StandardService.start(StandardService.java:516)at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)at org.apache.catalina.startup.Catalina.start(Catalina.java:583)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)2012-12-14 15:38:34 org.apache.catalina.core.StandardContext listenerStart严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerjava.lang.NoSuchMethodError: org.springframework.web.context.support.XmlWebApplicationContext.getEnvironment()Lorg/springframework/core/env/ConfigurableEnvironment;at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:87)at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:495)at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)at org.apache.catalina.core.StandardService.start(StandardService.java:516)at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)at org.apache.catalina.startup.Catalina.start(Catalina.java:583)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)2012-12-14 15:38:34 org.apache.catalina.core.StandardContext start严重: Error listenerStart2012-12-14 15:38:34 org.apache.catalina.core.StandardContext start严重: Context [/springdemo] startup failed due to previous errors2012-12-14 15:38:34 org.apache.catalina.core.ApplicationContext log信息: Closing Spring root WebApplicationContext2012-12-14 15:38:34Closing Root WebApplicationContext: startup date [Fri Dec 14 15:38:34 CST 2012]; root of context hierarchy2012-12-14 15:38:34Exception thrown from ApplicationListener handling ContextClosedEventjava.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Fri Dec 14 15:38:34 CST 2012]; root of context hierarchyat org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:316)at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1007)at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:970)at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:556)at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142)at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3973)at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4577)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4474)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:495)at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)at org.apache.catalina.core.StandardService.start(StandardService.java:516)at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)at org.apache.catalina.startup.Catalina.start(Catalina.java:583)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)2012-12-14 15:38:34Exception thrown from LifecycleProcessor on context closejava.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Fri Dec 14 15:38:34 CST 2012]; root of context hierarchyat org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:329)at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1015)at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:970)at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:556)at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142)at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3973)at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4577)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4474)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:495)at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)at org.apache.catalina.core.StandardService.start(StandardService.java:516)at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)at org.apache.catalina.startup.Catalina.start(Catalina.java:583)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)2012-12-14 15:38:34 org.apache.catalina.core.StandardContext listenerStop严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListenerjava.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContextat org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171)at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1048)at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1022)at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:970)at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:556)at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142)at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3973)at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4577)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4474)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:495)at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)at org.apache.catalina.core.StandardService.start(StandardService.java:516)at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)at org.apache.catalina.startup.Catalina.start(Catalina.java:583)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)我就没明白 这是少包呢 还是怎么?我网上 找遍了 没找到解诀方案,不清楚原因啊 求接 谢谢 了!项目 只用了 spring

解决方案

ava.lang.NoSuchMethodError: org.springframework.web.context.support.XmlWebApplicationContext.getEnvironment()Lorg/springframework/core/env/ConfigurableEnvironment;at 缺org.springframework.context.support-3.1.1.RELEASE.jar
解决方案二:

解决方案三:
包冲突了。。。删掉com.springsource.org.apache.commons.logging-1.1.1.jar试试

时间: 2024-11-05 23:35:30

spring web 启动报错的相关文章

spring 项目启动报错org.springframework.beans.factory.annotation.InjectionMetadata

问题描述 我用的是myeclipse+hibernate+springMVC错误信息:2013-03-2210:55:15,806ERROR[org.springframework.web.context.ContextLoader]-Contextinitializationfailedjava.lang.NoSuchMethodError:org.springframework.beans.factory.annotation.InjectionMetadata.<init>(Ljava/

spring jdbctemplate 启动报错(oracle驱动bug)

javax.management.MalformedObjectNameException: Invalid character '' in value part of property 发现原来是ojdbc6.jar包的原因,我的机子上是11g 11.1.0.6版本的驱动,于是换了一下驱动, 解决办法 换成oracle 11g 11.2的jar包,一切都ok了.看来oracle的驱动bug还是很多的.

spring mvc-springmvc项目启动报错

问题描述 springmvc项目启动报错 报错如上 我按照网上的方法清空了 好多缓存文件之列的 但是没有用啊!! 上图自动咋生成了 spring_mvc.xml文件呢? 有没有知道的大神!!! 解决方案 后来重新试了一下 原来是 Dynastic web project 的名称命名问题 项目发布到tomcat上后 在 config/Catalina/localhost/目录下会生成和 项目名称一样的xml文件哦 错就错在我之前 给springMVC项目起名字的时候 写成了 spring MVC

tomcat6 spring 启动报错

问题描述 tomcat6 spring 启动报错 java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Mon Jun 09 13:43:08 CST 2014]; root of context

spring-Myeclipse Web工程启动报错

问题描述 Myeclipse Web工程启动报错 2015-12-14 10:38:51 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.OutOfMem

【报错】spring整合activeMQ,pom.xml文件缺架包,启动报错:Caused by: java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler

spring版本:4.3.13 ActiveMq版本:5.15 ======================================================== spring整合activeMQ,pom.xml文件缺架包,启动报错: [springDemo][INFO] [2017-12-11 14:54:57] org.springframework.web.context.ContextLoader.initWebApplicationContext(304) | Root

jboss-JBoss部署web项目启动报错

问题描述 JBoss部署web项目启动报错 JBoss6.0 final,没有项目时正常启动,部署项目就会报错 20:07:12,070 INFO [AbstractJBossASServerBase] Server Configuration: JBOSS_HOME URL: file:/F:/DevelopTools/jboss-6.0.0.Final/ Bootstrap: $JBOSS_HOMEserver/default/conf/bootstrap.xml Common Base:

java-jboss7部署web项目启动报错,劳驾高手指点

问题描述 jboss7部署web项目启动报错,劳驾高手指点 16:25:27,433 ERROR org.jboss.msc.service.fail MSC0000 1: Failed to start service jboss.deployment.unit."edup.war".POST_MODULE: org.jbo ss.msc.service.StartException in service jboss.deployment.unit."edup.war&qu

eclipse使用debug模式启动web服务报错

问题描述 eclipse使用debug模式启动web服务报错,使用run方式就正常.报错异常如下:SEVERE: Catalina.start: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)at org.apache.cata