It took me a while, but I found the IllegalAccessError is caused when
you create separate Eclipse plug-ins for hibernate and hibernate-
annotations. The reason is they share a common package
(org.hibernate.cfg) and Eclipse will load them with separate class
loaders. In this case, a superclass cannot be accessed because it was
loaded in a different class loader.
My fix was to place both hibernate and hibernate-annotations into a
single Eclipse plug-in.
If you're using Eclipse 3.3+, you'll get another error regarding
javax/management/MBeanServer which is caused because hibernate
includes the JMX jars which are part of Eclipse. Remove them from your
hibernate plug-in. |