ssh添加事务启动时报错

问题描述

启动tomcat时报以下错误:严重:Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'commonDao'definedinServletContextresource[/WEB-INF/spring-config/bean.xml]:Initializationofbeanfailed;nestedexceptionisjava.lang.NoClassDefFoundErrorCausedby:java.lang.NoClassDefFoundError加入tx.xml就会报错,如果没有的话就可以运行.bean.xml代码:<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.0.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.0.xsd"><beanid="commonDao"class="com.dz.dao.CommonDao"autowire="byType"/><beanid="permissionAction"class="com.dz.action.PermissionAction"scope="prototype"><propertyname="commonDao"ref="commonDao"/><!--name="commonDao"中的commonDao是PermissionAction的属性--></bean></beans>

tx.xml代码:<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.0.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.0.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.0.xsd"><beanid="transactionManager"autowire="byType"class="org.springframework.orm.hibernate3.HibernateTransactionManager"/><tx:adviceid="transactionAdvice"transaction-manager="transactionManager"><tx:attributes><tx:methodname="save*"/><tx:methodname="delete*"/><tx:methodname="update*"/><tx:methodname="*"read-only="true"/></tx:attributes></tx:advice><aop:configproxy-target-class="true"><aop:advisorpointcut="execution(*com.dz.dao.*.*(..))"advice-ref="transactionAdvice"/></aop:config></beans>

解决方案

解决方案二:
Errorcreatingbeanwithname'commonDao'definedinServletContextresource无法创建commonDaobean无法进行初始化
解决方案三:
看set注入有没有搞错
解决方案四:
NoClassDefFoundError缺少了什么类,请查看具体的异常信息
解决方案五:
引用3楼lyon_z的回复:

NoClassDefFoundError缺少了什么类,请查看具体的异常信息

+1
解决方案六:
com.dz.dao.CommonDao--检查你的源代码里面这个类对应的class文件有吗?
解决方案七:
引用1楼heardy的回复:

Errorcreatingbeanwithname'commonDao'definedinServletContextresource无法创建commonDaobean无法进行初始化

+1
解决方案八:
如果按楼主描述加入tx.xml才会报错而bean.xml是正常的,那么commonDaobean应该是可以初始化的之前我配置的时候也是一加入AOP的配置就提示某类无法初始化,而去掉了AOP的配置就正常了后面才发现少加了一个类包楼主检查一下配置AOP所需要的类包都加了吗
解决方案九:
class="com.dz.dao.CommonDao"应该注入的是对应的dao借口的实现吧,是不是class="com.dz.dao.CommonDaoImpl"

时间: 2024-08-03 14:59:02

ssh添加事务启动时报错的相关文章

项目启动时报错Element type "property" must be followed by either attri

项目启动时报错Element type "property" must be followed by either attribute specifications, ">" or "/>" 项目启动时,控制台报错,信息如下(有删减): Error creating bean with name 'supplierInfoDAO' defined in class path resource [conf/applicationCont

button-为Button添加监听时报错

问题描述 为Button添加监听时报错 package com.example.jisuanji; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.vie

tomcat启动时报错请求解决

问题描述 tomcat启动时报错请求解决 重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at java.util.concurrent.Future

ldap-关于Java操作Ldap,添加用户/用户组时报错

问题描述 关于Java操作Ldap,添加用户/用户组时报错 public static void addUser() { String parentDN = "CN=Users,DC=jovaunn,DC=com"; String childName = "lj1Group"; String childDN = "CN=" + childName + "," + parentDN; Attribute cn = new Bas

start-急求spring高手。启动时报错

问题描述 急求spring高手.启动时报错 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document

java ee-spring mvc 搭建问题求助 tomcat启动时报错

问题描述 spring mvc 搭建问题求助 tomcat启动时报错 严重: StandardWrapper.Throwableorg.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/Users/loujun/Documents/workspace/.metadata/.plugins/org.eclipse.wst.serve

rest-jersey+spring 启动时报错

问题描述 jersey+spring 启动时报错 十二月 22, 2015 3:08:29 下午 com.sun.jersey.spi.spring.container.servlet.SpringServlet initiate 严重: Exception occurred when intialization com.sun.jersey.spi.inject.Errors$ErrorMessagesException at com.sun.jersey.spi.inject.Errors.

添加引用-添加服务引用时报错,在线等。

问题描述 添加服务引用时报错,在线等. 如图那么大把红叉是怎么回事?还有我明明在数据库新建了一个视图,这里却显示未发现任何操作. 解决方案 这里正常显示有一个控件,上面是服务的说明.要么是你的web服务有问题,要么是你的开发环境有问题.这的确很少见.如果可能,换一个开发机试试看.

工具-VM虚拟机安装ubuntu-14.04-desktop-i386启动时报错,请教高手如何解决?

问题描述 VM虚拟机安装ubuntu-14.04-desktop-i386启动时报错,请教高手如何解决? 问题详细: VM虚拟机中安装ubuntu-14.04-desktop-i386.iso系统后启动时报错,屏幕一直是黑的. 详细报错信息如下: 1.The 3D features of the virtual machine will be disabled. 2.As a result, this virtual machine may experience very low graphic