hi i am getting the following exception while running my application and my applicationContext.xml is
<?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>
Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
any sug开发者_如何学Pythongestion would be heplful
Your exception
nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit
Hibernate depends on asm
Go to Spring installation directory and include all of jars in the following folders
<SPRING_HOME>/lib/asm/
<SPRING_HOME>/lib/dom4j/
<SPRING_HOME>/lib/antlr/
<SPRING_HOME>/lib/jakarta-commons/
<SPRING_HOME>/lib/javassist
<SPRING_HOME>/lib/cglib/
<SPRING_HOME>/lib/hibernate // without hibernate-entitymanager.jar
<SPRING_HOME>/lib/slf4j/
<SPRING_HOME>/lib/j2ee/persistence.jar
<SPRING_HOME>/lib/j2ee/jta.jar
I hope now it runs ok
Do not forget include MySQL driver if you do not want to see a new exception
精彩评论