同样,我是JPA&休眠模式。我想在我的网络应用程序中使用JPA技术。在stackoverflow用户的帮助下,我清除了许多错误。凭借这种经验和信心,我认为自己可以做得更远。但是,目前的错误是不同的。我无法在谷歌本身找到它。
看起来很像,
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,Hibernate是提供者,使用JPA 2.0。
我的完整控制台......
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)
任何建议!!
谢谢!
答案 0 :(得分:3)
将hibernate放在类路径上。这将允许在应用程序需要时“找到”hibernate。以下是简短教程的链接:Classpath in Eclipse
答案 1 :(得分:2)
使用JPA,Hibernate不会直接与您的代码相关联。但是在运行时,仍然需要来自Hibernate的类,所以你仍然需要将它们放在类路径上。