I never got the IllegalAccessException above, but I still had some
problems that the original post didn't solve.
In my case I was using one plugin which I'll call myPluginA (which uses
the hibernate plugin) as a plugin for another application (myPluginB) so
I didn't want to have the hibernate.cfg.xml inside the myPluginB project.
What I had to do was put the "Eclipse-BuddyPolicy: registered" line
in the manifest.mf's of both the hibernate plugin and of myPluginA
I then put the "Eclipse-RegisterBuddy: org.hibernate.eclipse, myPluginA"
in the manifest.mf of myPluginB and
"Eclipse-RegisterBuddy: org.hibernate.eclipse" in myPluginA's manifest.mf.
I then had to put the line:
URL url = HibernateUtil.class.getResource("../hibernate.cfg.xml");
inside HibernateUtil and then use the configure which takes a URL argument
sessionFactory = new Configuration().configure(url).buildSessionFactory();
instead of
sessionFactory = new Configuration().configure().buildSessionFactory(); |