Spring整合web时,tomcat提示ClassNotFound(使用dbcp可以忽略)
原文链接:https://www.iteye.com/blog/showlike-1931032
web.xml配置ContextLoaderListener属性时,在context-param标签下配置:
<param-value>classpath:applicationContext.xml</param-value>
提示ClassNotFoundException.
查了很多资料。最后解决方案为在service的bean标签内添加属性parent属性,将dao类设置为service的父类:依赖关系为:dao被service依赖。具体操作(红字变化):
<bean id="userDao" class="com.hebeu.dao.impl.UserDaoImpl">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- service -->
<bean id="userService" class="com.hebeu.service.impl.UserServiceImpl" >
<property name="userDao" ref="userDao" ></property>
</bean>
|
|
<bean id="userDao" class="com.hebeu.dao.impl.UserDaoImpl">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- service -->
<bean id="userService" class="com.hebeu.service.impl.UserServiceImpl" parent="userDao">
<property name="userDao" ref="userDao" ></property>
</bean>
- 点赞
- 收藏
- 分享
- 文章举报
- 使用MyEclipse整合Struts+Spring+Hibernate时,在“applicationContext.xml”中提示class"org.apache.commons.dbcp.Basi
- 使用MyEclipse整合Struts+Spring+Hibernate时,在“applicationContext.xml”中提示class"org.apache.commons.dbcp.Basi
- tomcat启动提示端口被占用 maven项目 java.lang.ClassNotFoundException: org.springframework.web.servlet.Dispatche
- 使用Maven构建javaWeb项目时,启动tomcat出错:严重: Error configuring application listener of class org.springframewo
- 使用maven整合ssm框架,提示找不到 org.springframework.web.servlet.DispatcherServlet
- eclipse 在使用spring-jdbc时,Maven已经配置,jar包也在WEB-INF/lib里,但是就是出现CLASSNOTFOUND错误
- Idea中tomcat(ssm整合)启动项目:ClassNotFoundException:org.springframework.web.context.ContextLoaderListener
- 使用Maven构建javaWeb项目时,启动tomcat出错:严重: Error configuring application listener of class org.springframewo
- tomcat启动报错ClassNotFoundExceptiion:org.springframework.web.context.ContextLoaderListener
- 使用SpringBoot整合Jersey 实现Restful webservice.可以同时使用springmvc。
- 使用Maven构建javaWeb项目时,启动tomcat出错:严重: Error configuring application listener of class org.springframewo
- eclipse使用maven,启动工程tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.Contex
- eclipse发布到tomcat提示java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLis
- spring整合jbpm Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
- webwork+spring+ibatis整合使用
- Tomcat配置JNDI提示:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle
- Eclipse使用问题—Tomcat部署ClassNotFound问题
- tomcat无法启动 ClassNotFoundException org.springframework.web.context.ContextLoaderListener
- 部署Maven项目到tomcat报错:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderLi
- Web项目中使用Spring整合CXF发布Web Services