java - Hibernate basic configuration in Spring 3 project - Class not found exception -
i'm trying set hibernate 3.6 in existing spring 3 mvc + spring 3 security project. nevertheless keep getting java.lang.classnotfoundexception in hibernateutil class - line return new configuration().configure().buildsessionfactory();
my project structure looks this:

hibernate.cfg.xml:
<?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.bytecode.use_reflection_optimizer">false</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.driver</property> <property name="hibernate.connection.password">password</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3049/test</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.dialect">org.hibernate.dialect.mysqldialect</property> <property name="show_sql">true</property> <mapping resource="./dbuser.hbm.xml"></mapping> </session-factory> </hibernate-configuration> dbuser.hbm.xml:
<?xml version="1.0"?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="../src/main/java/user/dbuser" table="dbuser"> <id name="userid" type="int"> <column name="user_id" precision="5" scale="0" /> <generator class="assigned" /> </id> <property name="username" type="string"> <column name="username" length="20" not-null="true" /> </property> <property name="createdby" type="string"> <column name="created_by" length="20" not-null="true" /> </property> <property name="createddate" type="date"> <column name="created_date" length="7" not-null="true" /> </property> </class> </hibernate-mapping> and relevant part of pom.xml file:
<!-- hibernate + mysql --> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.9</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>3.6.3.final</version> </dependency> edit: i've pasted here stack trace. long put right here, because make post confused.
i'd glad, if me setting thing, because i've got no idea, why can't find class.
it looks missing javaassist library. download javaassist jar , add classpath.
Comments
Post a Comment