繁体   English   中英

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

[英]java.lang.NoClassDefFoundError: org/hibernate/mapping/MappedSuperclass

同样,我是JPA和休眠的新手。 我正在尝试在Web应用程序中使用JPA技术。 在stackoverflow用户的帮助下,我清除了许多错误。 凭着这种经验和信心,我认为自己可以做得更好。 但是,当前的错误有所不同。 我无法在Google本身中找到它。

它看起来像

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

供您参考的错误和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)

我的IDE是eclipse,使用JPA 2.0是Hibernate作为提供程序。

我对控制台的完整跟踪。

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)

有什么建议么!!

谢谢!

将休眠模式放在您的课​​程路径上。 当您的应用程序需要它时,这将允许“休眠”。 这是一个简短教程的链接: Eclipse中的类路径

使用JPA,Hibernate不会直接与您的代码关联。 但是在运行时,仍然需要Hibernate中的类,因此您仍然需要将它们放在类路径中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM