1 Hibenate异常汇总:java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger
2 Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/BasicLogger
3 at java.lang.ClassLoader.defineClass1(Native Method)
4 at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
5 at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
6 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
7 at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
8 at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
9 at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
10 at java.security.AccessController.doPrivileged(Native Method)
11 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
12 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
13 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
14 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
15 at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:175)
16 at hibernate.conn.HibernateUitl.<clinit>(HibernateUitl.java:16)
17 at hibernate.conn.UserDAOImpl.saveUser(UserDAOImpl.java:112)
18 at hibernate.conn.TestDAO.main(TestDAO.java:26)
19 Caused by: java.lang.ClassNotFoundException: org.jboss.logging.BasicLogger
20 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
21 at java.security.AccessController.doPrivileged(Native Method)
22 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
23 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
24 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
25 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
26 ... 16 more
27
28 使用Hibernate4.0后,需要引入jboss-logging.GA.jar。
29
30
31 Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/SystemException
32 at java.lang.Class.forName0(Native Method)
33 at java.lang.Class.forName(Class.java:247)
34 at org.jboss.logging.Logger.getMessageLogger(Logger.java:2248)
35 at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
36 at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:175)
37 at hibernate.conn.HibernateUitl.<clinit>(HibernateUitl.java:16)
38 at hibernate.conn.UserDAOImpl.saveUser(UserDAOImpl.java:112)
39 at hibernate.conn.TestDAO.main(TestDAO.java:26)
40 Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException
41 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
42 at java.security.AccessController.doPrivileged(Native Method)
43 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
44 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
45 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
46 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
47 ... 8 more
48 添加/jboss-transaction-api_1.1_spec-1.0.0.Final.jar
49
50
51
52 3.Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
53 at org.hibernate.cfg.annotations.reflection.JPAMetadataProvider.getDefaults(JPAMetadataProvider.java:97)
54 at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.getDefaults(JavaReflectionManager.java:226)
55 at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1313)
56 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1727)
57 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1778)
58 at hibernate.conn.HibernateUitl.<clinit>(HibernateUitl.java:18)
59 at hibernate.conn.UserDAOImpl.saveUser(UserDAOImpl.java:112)
60 at hibernate.conn.TestDAO.main(TestDAO.java:26)
61 Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityListeners
62 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
63 at java.security.AccessController.doPrivileged(Native Method)
64 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
65 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
66 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
67 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
68 ... 8 more
69
70 解决方法:从hibernate的lib/jpa/下拷入hibernate-jpa-2.0-api-1.0.0.Final.jar包,OK,问题解决!
71
72 4.Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
73 at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185)
74 at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135)
75 at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:367)
76 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1740)
77 at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1778)
78 at hibernate.conn.HibernateUitl.<clinit>(HibernateUitl.java:18)
79 ... 2 more
80 Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
81 at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:138)
82 at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188)
83 at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:341)
84 at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:502)
85 at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:144)
86 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
87 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
88 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
89 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
90 at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163)
91 ... 7 more
92 Caused by: java.lang.reflect.InvocationTargetException
93 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
94 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
95 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
96 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
97 at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135)
98 ... 16 more
99 Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter
100 at org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl.getProxyFactoryFactory(BytecodeProviderImpl.java:56)
101 at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactoryInternal(PojoEntityTuplizer.java:241)
102 at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:219)
103 at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:212)
104 at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:82)
105 ... 21 more
106 Caused by: java.lang.ClassNotFoundException: javassist.util.proxy.MethodFilter
107 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
108 at java.security.AccessController.doPrivileged(Native Method)
109 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
110 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
111 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
112 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
113 ... 26 more
114 添加javassist-3.15.0-GA.jar包
115
116 5.Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ReferenceMap
117 at org.hibernate.engine.internal.StatefulPersistenceContext.<init>(StatefulPersistenceContext.java:167)
118 at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:230)
119 at org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1801)
120 at org.hibernate.internal.SessionFactoryImpl.openSession(SessionFactoryImpl.java:1009)
121 at hibernate.conn.HibernateUitl.getSession(HibernateUitl.java:37)
122 at hibernate.conn.UserDAOImpl.saveUser(UserDAOImpl.java:112)
123 at hibernate.conn.TestDAO.main(TestDAO.java:26)
124 Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.map.ReferenceMap
125 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
126 at java.security.AccessController.doPrivileged(Native Method)
127 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
128 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
129 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
130 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
131 ... 7 more
132 添加commons-collections-3.2.1.jar包
133
134 6.Exception in thread "main" java.lang.NoClassDefFoundError: antlr/SemanticException
135 at java.lang.ClassLoader.defineClass1(Native Method)
136 at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
137 at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
138 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
139 at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
140 at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
141 at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
142 at java.security.AccessController.doPrivileged(Native Method)
143 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
144 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
145 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
146 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
147 at org.hibernate.loader.criteria.CriteriaQueryTranslator.<init>(CriteriaQueryTranslator.java:109)
148 at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:84)
149 at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1516)
150 at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
151 at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
152 at hibernate.conn.UserDAOImpl.findUserByName(UserDAOImpl.java:43)
153 at hibernate.conn.TestDAO.main(TestDAO.java:34)
154 Caused by: java.lang.ClassNotFoundException: antlr.SemanticException
155 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
156 at java.security.AccessController.doPrivileged(Native Method)
157 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
158 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
159 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
160 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
161 ... 19 more
162 我的异常网推荐解决方案:java.lang.ClassNotFoundException: javax.persistence.EntityListeners,http://www.myexception.cn/j2ee/182645.html
163 我的异常网推荐解决方案:Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer],http://www.myexception.cn/eclipse/174629.html