嗨,我在运行我的应用程序和我的applicationContext.xml时遇到以下异常
<?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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url" value="jdbc:mysql://localhost/SureshDB"></property>
<property name="username" value="root"></property>
<property name="password" value="root"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/jsfcompref/register/UserTa.hbm.xml</value></list>
</property></bean>
<bean id="UserTaDAO" class="com.jsfcompref.register.UserTaDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="UserTaService" class="com.jsfcompref.register.UserTaServiceImpl">
<property name="userTaDao">
<ref bean="UserTaDAO"/>
</property>
</bean>
</beans>
在类路径资源[applicationContext.xml]中定义名称为'sessionFactory'的bean时出错:init方法的调用失败;嵌套异常是java.lang.NoSuchMethodError:org.objectweb.asm.ClassVisitor.visit(IILjava / lang / String; Ljava / lang / String; [Ljava / lang / String; Ljava / lang / String;)V
任何建议都是有益的
1 回答
你的例外
Hibernate依赖于asm
转到以下文件夹中的Spring安装目录和 include all of jars
我希望现在运行正常
如果您不想看到新的异常,请不要忘记包含MySQL驱动程序