一。运用Spring时,一启动tomcat就出错Error listenerStart,查看tomcat日志,发现错误信息如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
显然是数据源加载失败,修改数据源配置,一般即可(可参考博文http://xuthus.iteye.com/blog/85089)。Spring的数据源有JDBC方式和应用tomcat连接池方式,顺便写一下:
1.JDBC方式
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.ibm.db2.jcc.DB2Driver" />
<property name="url" value="jdbc:db2://192.168.3.186:50000/TEST" />
<property name="username" value="db2admin" />
<property name="password" value="db2admin" />
</bean>
2.使用连接池
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean" destroy-method="close">
<property name="jndiName" value="java:comp/env/jdbc/test">
</property>
</bean>
二。关于Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
是由于web.xml中配置没配对,或没配,如下
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>
分享到:
相关推荐
按照步骤来,这个问题 就会解决。你懂的。
NULL 博文链接:https://zx527291227.iteye.com/blog/1681235
错误截图 找不到出错的异常位置在哪里。解决办法:在resources目录下创建一个logging.properties的文件,然后重启 handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler ...
基于Spring的listener和Task,Spring的初始化和定时任务(Task)
Spring注入Filter与Listener的方法.png
Listener的介绍tomcat 中 Listener 分为两类, org.apache.catalina.LifecycleListener 以及 java
可用于分析spring mvc源码、spring mvc父子容器初始化流程、session和cookie机制、spring session等,也可以用于学习Java Web(servlet、filter、listener等)、spring源码等。 该项目使用servlet3.0规范,无web.xml...
SpringBoot整合Listener的两种方式: 1.通过注解扫描完成Listener组件的注册 1.创建一个类实现 ServletContextListener (具体实现哪个Listener根据情况来判断) 2.在类上加入注解 @WebListener 3.重写 context...
2015-09-12 06:59:40.263: [ CRSAPP][11046]32CheckResource error for ora.p550b.LISTENER_P550B.lsnr error code = -2 2015-09-12 07:01:00.691: [ CRSEVT][12074]32CAAMonitorHandler :: 0:Could not join /opt/...
可以直接运行,并对整合spring和struts2步骤及需要注意的事项进行类总结 整合spring和struts2总结 1.将struts2和spring中的库文件复制到项目下(可以查看WEB-INF\lib目录下的文件) 注意:struts2-spring-...
Spring使用ApplicationEvent和ApplicationListener两个核心接口实现了事件监听机制。开发者可以自定义事件类和事件监听器,并通过应用程序上下文的publishEvent方法来发布事件,Spring框架会自动分发事件给所有对该...
在web.Xml中 <param-name>contextConfigLocation <param-value>/WEB-INF/spring/*.bean.xml... <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener>
spring-kafka顺序消费。 kafka顺序消费。 主要是为博客上传完整代码
Spring内置了多种事件类型,例如,ContextRefreshedEvent在容器刷新时发布,ContextStartedEvent在容器启动时发布,而ContextClosedEvent在容器关闭时发布。除此之外,Spring也支持自定义事件,提供灵活性来处理特定...
6.8.4. 在Spring应用中使用AspectJ加载时织入(LTW) 6.9. 更多资源 7. Spring AOP APIs 7.1. 简介 7.2. Spring中的切入点API 7.2.1. 概念 7.2.2. 切入点运算 7.2.3. AspectJ切入点表达式 7.2.4. 便利的切入...
出现"Error listenerStart"一般是applicationContext.xml中的bean加载有问题。在用eclipse做webwork + spring + hibernate 的项目时一般都是用Myeclipse自动生成那些配置文件,而有些相关的jar或者文件并没有加载在...
6.8.4. 在Spring应用中使用AspectJ加载时织入(LTW) 6.9. 更多资源 7. Spring AOP APIs 7.1. 简介 7.2. Spring中的切入点API 7.2.1. 概念 7.2.2. 切入点运算 7.2.3. AspectJ切入点表达式 7.2.4. 便利的切入...
在安装SQL时遇到挂起问题,出现安装程序配置服务器失败参考服务器错误日志,运行相应文本就行,操作简单
10.2.6. Quick-start Spring CLI Example 10.3. Upgrading from an Earlier Version of Spring Boot 11. Developing Your First Spring Boot Application 11.1. Creating the POM 11.2. Adding Classpath ...
JMS与Spring之二(用message listener container异步收发消息)