views:

136

answers:

2

Hi all,

Again, I am new to JPA & Hibernation. I am trying to use JPA technology in my web app. With the help of stackoverflow users, I have cleared many errors. With that experience and Confidence, I thought that I can do further myself. But, the current error is something different. I am not able to find it in google itself.

Its something looks like,

java.lang.NoClassDefFoundError: org/hibernate/mapping/MappedSuperclass

For your reference the list of errors & persistence.xml,

java.lang.NoClassDefFoundError: org/hibernate/mapping/MappedSuperclass
at org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:59)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:83)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:883)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at com.pricar.JPAInteg.ExpenseDetailsManagement.<clinit>(ExpenseDetailsManagement.java:21)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)

My IDE is eclipse, Hibernate as provider, using JPA 2.0.

My Full Trace of Console....

0    [26348010@qtp-7494106-6] INFO  org.directwebremoting.impl.StartupUtil  - DWR Version 3.0.M1.RC2 starting.
0    [26348010@qtp-7494106-6] INFO  org.directwebremoting.impl.StartupUtil  - - Servlet Engine: jetty/6.1.24
0    [26348010@qtp-7494106-6] INFO  org.directwebremoting.impl.StartupUtil  - - Java Version:   1.6.0_21
0    [26348010@qtp-7494106-6] INFO  org.directwebremoting.impl.StartupUtil  - - Java Vendor:    Sun Microsystems Inc.
422  [26348010@qtp-7494106-6] INFO  org.directwebremoting.dwrp.DefaultConverterManager  - Probably not an issue: org.jdom.Document is not available so the jdom converter will not load. This is only an problem if you wanted to use it.
422  [26348010@qtp-7494106-6] INFO  org.directwebremoting.dwrp.DefaultConverterManager  - Probably not an issue: org.jdom.Element is not available so the jdom converter will not load. This is only an problem if you wanted to use it.
18312 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.Version  - Hibernate Annotations 3.4.0.CR1
18328 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.Environment  - Hibernate 3.3.0.CR1
18328 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.Environment  - hibernate.properties not found
18343 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.Environment  - Bytecode provider name : cglib
18343 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.Environment  - using JDK 1.4 java.sql.Timestamp handling
18422 [26348010@qtp-7494106-6] INFO  org.hibernate.annotations.common.Version  - Hibernate Commons Annotations 3.1.0.CR1
18422 [26348010@qtp-7494106-6] INFO  org.hibernate.ejb.Version  - Hibernate EntityManager 3.5.0-Final
    19312 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.AnnotationBinder  - Binding entity from annotated class: com.pricar.JPAInteg.Role
19375 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.EntityBinder  - Bind entity com.pricar.JPAInteg.Role on table roles
19437 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.AnnotationBinder  - Binding entity from annotated class: com.pricar.JPAInteg.User
19437 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.EntityBinder  - Bind entity com.pricar.JPAInteg.User on table users
19437 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.AnnotationBinder  - Binding entity from annotated class: com.pricar.JPAInteg.Userdetail
19437 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.EntityBinder  - Bind entity com.pricar.JPAInteg.Userdetail on table userdetails
19453 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.AnnotationBinder  - Binding entity from annotated class: com.pricar.JPAInteg.Category
19453 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.QueryBinder  - Binding Named query: allCatRecords => SELECT ct FROM Category ct
19453 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.EntityBinder  - Bind entity com.pricar.JPAInteg.Category on table category
19453 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.AnnotationBinder  - Binding entity from annotated class: com.pricar.JPAInteg.Expens
19453 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.EntityBinder  - Bind entity com.pricar.JPAInteg.Expens on table expenses
19468 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.AnnotationBinder  - Binding entity from annotated class: com.pricar.JPAInteg.Leavetable
19468 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.EntityBinder  - Bind entity com.pricar.JPAInteg.Leavetable on table leavetable
19468 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.AnnotationBinder  - Binding entity from annotated class: com.pricar.JPAInteg.Permissiontoken
19468 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.EntityBinder  - Bind entity com.pricar.JPAInteg.Permissiontoken on table permissiontokens
19468 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.AnnotationBinder  - Binding entity from annotated class: com.pricar.JPAInteg.Roletokenassociation
19468 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.annotations.EntityBinder  - Bind entity com.pricar.JPAInteg.Roletokenassociation on table roletokenassociation
19468 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.AnnotationConfiguration  - Hibernate Validator not found: ignoring
19640 [26348010@qtp-7494106-6] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - Using Hibernate built-in connection pool (not for production use!)
19656 [26348010@qtp-7494106-6] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - Hibernate connection pool size: 20
19656 [26348010@qtp-7494106-6] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - autocommit mode: true
19656 [26348010@qtp-7494106-6] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/officemgmt
19656 [26348010@qtp-7494106-6] INFO  org.hibernate.connection.DriverManagerConnectionProvider  - connection properties: {user=root, password=****, autocommit=true, release_mode=auto}
19968 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - RDBMS: MySQL, version: 5.1.49-community
19968 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.5 ( $Date: 2007-03-01 00:01:06 +0100 (Thu, 01 Mar 2007) $, $Revision: 6329 $ )
19984 [26348010@qtp-7494106-6] INFO  org.hibernate.dialect.Dialect  - Using dialect: org.hibernate.dialect.MySQLDialect
19984 [26348010@qtp-7494106-6] INFO  org.hibernate.transaction.TransactionFactoryFactory  - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.transaction.TransactionManagerLookupFactory  - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Automatic flush during beforeCompletion(): disabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Automatic session close at end of transaction: disabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - JDBC batch size: 15
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - JDBC batch updates for versioned data: disabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Scrollable result sets: enabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - JDBC3 getGeneratedKeys(): enabled
    20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Connection release mode: auto
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Maximum outer join fetch depth: 2
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Default batch fetch size: 1
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Generate SQL with comments: disabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Order SQL updates by primary key: disabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Order SQL inserts for batching: disabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.hql.ast.ASTQueryTranslatorFactory  - Using ASTQueryTranslatorFactory
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Query language substitutions: {}
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - JPA-QL strict compliance: enabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Second-level cache: enabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Query cache: disabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Optimize cache for minimal puts: disabled
20000 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Structured second-level cache entries: disabled
20015 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Echoing all SQL to stdout
20015 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Statistics: disabled
20015 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Deleted entity synthetic identifier rollback: disabled
20015 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Default entity-mode: pojo
20015 [26348010@qtp-7494106-6] INFO  org.hibernate.cfg.SettingsFactory  - Named query checking : enabled
20078 [26348010@qtp-7494106-6] INFO  org.hibernate.impl.SessionFactoryImpl  - building session factory
20468 [26348010@qtp-7494106-6] INFO  org.hibernate.impl.SessionFactoryObjectFactory  - Not binding factory to JNDI, no JNDI name configured
20468 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate  - Running hbm2ddl schema update
20468 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate  - fetching database metadata
20468 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate  - updating schema
20578 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: officemgmt.category
20578 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [cat_id, cat_name]
20578 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - foreign keys: []
20578 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - indexes: [primary]
20625 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: officemgmt.expenses
20625 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [amount, cat_id, user_name, status, expns_id, date]
20625 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - foreign keys: []
20625 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - indexes: [primary]
20703 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: officemgmt.leavetable
20703 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [reason, appr_status, to_date, leave_id, from_date, app_name]
20703 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - foreign keys: []
20703 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - indexes: [primary]
20750 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: officemgmt.permissiontokens
20750 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [id, name]
20750 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - foreign keys: []
20750 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - indexes: [primary]
20812 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: officemgmt.roles
20812 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [role_id, role_name]
20828 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - foreign keys: []
20828 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - indexes: [primary]
20859 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: officemgmt.roletokenassociation
20859 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [id, roleid, tokenid]
20859 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - foreign keys: []
20859 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - indexes: [primary]
20937 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: officemgmt.userdetails
20937 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [user_pass, id, user_name, lname, role_id, email, phoneno, fname]
20937 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - foreign keys: []
20937 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - indexes: [primary]
21000 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - table found: officemgmt.users
21000 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - columns: [user_pass, user_name, admin_access, role, user_id]
21000 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - foreign keys: []
21000 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.TableMetadata  - indexes: [primary]
21000 [26348010@qtp-7494106-6] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate  - schema update complete
2010-09-21 12:23:14.921:WARN::Error for /ExpMgmtWeb/dwr/call/plaincall/ExpenseDetailsManagement.getCategory.dwr
java.lang.NoClassDefFoundError: org/hibernate/mapping/MappedSuperclass
at org.hibernate.ejb.metamodel.MetamodelImpl.buildMetamodel(MetamodelImpl.java:59)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:83)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:883)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at com.pricar.JPAInteg.ExpenseDetailsManagement.<clinit>(ExpenseDetailsManagement.java:18)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

Any Suggestions!!

Thanks!

+2  A: 

Put hibernate on your class path. This will allow hibernate to be "found" when it is needed by your application. Here is a link to a short tutorial: Classpath in Eclipse

Woot4Moo
Thanks for your reply. I have already added the JAR files into the classpath.hibernate-annotations.jarhibernate-commons-annotations.jarhibernate-core.jarhibernate-entitymanager-3.5.0-Final.jarhibernate-jpa-2.0-api-1.0.0.Final.jarhibernate-validator-4.1.0.Final.jar
NooBDevelopeR
@Woot4Moo: These are the Jar files i have included that for hibernate.
NooBDevelopeR
How are you deployed?
Woot4Moo
Added those files into the WEB-INF/lib folder.
NooBDevelopeR
+1  A: 

With JPA, Hibernate is not directly associated from your code. On Runtime though, the classes from Hibernate are still needed so you still need to put them on your classpath.

nanda
May you tell me the exact file name. I have also included my jar list in Woot4Moo answer as Comment.
NooBDevelopeR