I'm writing a plugin for Eclipse which uses Hibernate. After making some changes (which I will discuss in a moment), whenever I try to run the plugin, I get ClassCircularityErrors thrown immediately when the plugin starts up.
The changes I made was to define my own usertype. I was following the example located at
http://www.hibernate.org/272.html to try to persist my enums (I did not exactly copy and paste the code, but rather used it as a guideline for my own code).
I tried looking up as much information as I could about ClassCircularityError. Most of the sites I ran across mentioned it may come from class files getting recompile during runtime to change class hiearchy directions, but I'm fairly confident that's not happening (at least not in my own code). I also found this thread from the newsgroups, which mentions that the Error can also get thrown if a class is loaded in one class loader, and then gets loaded again in another class loader later on. I suspect this is what it happening to me:
http://groups.google.ca/group/comp.lang ... 3a786d08b8
I noticed that in the stack trace that gets dumped, Eclipse seems to be manually invoking the class loader to load some classes, and then, later on, Hibernate also manually invokes the class loader to load some classes, which is why I suspect that the "twice loaded class" is the cause of my problem rather than a circular class hierarchy.
Eclipse seems to have a bug with class loading, but it has been essentially closed with no intention of fixing it:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=5875
I'm not sure how to proceed from here on. I haven't completely ruled out the possibility that the problem may be with my own code, but my own code never shows up anywhere in the stack trace. I'm wondering if this is something that could be easily fixed in Hibernate, since it sounds like it would be very difficult to fix in Eclipse. Any advice would be greatly appreciated.
Hibernate version: 3.1.rc3
Full stack trace of any exception that occurs:
java.lang.ClassCircularityError: org/hibernate/exception/ExceptionUtils
at org.hibernate.exception.NestableDelegate.printStackTrace(NestableDelegate.java:325)
at org.hibernate.exception.NestableRuntimeException.printStackTrace(NestableRuntimeException.java:195)
at org.eclipse.core.runtime.adaptor.EclipseLog.getStackTrace(EclipseLog.java:414)
at org.eclipse.core.runtime.adaptor.EclipseLog.writeStack(EclipseLog.java:496)
at org.eclipse.core.runtime.adaptor.EclipseLog.writeLog(EclipseLog.java:443)
at org.eclipse.core.runtime.adaptor.EclipseLog.log(EclipseLog.java:286)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass(EclipseClassLoader.java:119)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:337)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:389)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at org.hibernate.exception.NestableDelegate.printStackTrace(NestableDelegate.java:325)
at org.hibernate.exception.NestableRuntimeException.printStackTrace(NestableRuntimeException.java:195)
at org.eclipse.core.runtime.adaptor.EclipseLog.getStackTrace(EclipseLog.java:414)
at org.eclipse.core.runtime.adaptor.EclipseLog.writeStack(EclipseLog.java:496)
at org.eclipse.core.runtime.adaptor.EclipseLog.writeLog(EclipseLog.java:443)
at org.eclipse.core.runtime.adaptor.EclipseLog.log(EclipseLog.java:286)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass(EclipseClassLoader.java:119)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:337)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:389)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:275)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1246)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:152)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:142)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:129)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:48)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:243)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:239)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:99)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:267)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:180)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552)
at org.eclipse.ui.internal.WorkbenchPage$ActivationList.setActive(WorkbenchPage.java:3601)
at org.eclipse.ui.internal.WorkbenchPage.restoreState(WorkbenchPage.java:2686)
at org.eclipse.ui.internal.WorkbenchWindow.restoreState(WorkbenchWindow.java:1822)
at org.eclipse.ui.internal.Workbench.doRestoreState(Workbench.java:2622)
at org.eclipse.ui.internal.Workbench.access$14(Workbench.java:2571)
at org.eclipse.ui.internal.Workbench$19.run(Workbench.java:1534)
at org.eclipse.ui.internal.Workbench.runStartupWithProgress(Workbench.java:1243)
at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1532)
at org.eclipse.ui.internal.Workbench.access$12(Workbench.java:1511)
at org.eclipse.ui.internal.Workbench$17.run(Workbench.java:1394)
at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
at org.eclipse.core.runtime.Platform.run(Platform.java:783)
at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1338)
at org.eclipse.ui.internal.WorkbenchConfigurer.restoreState(WorkbenchConfigurer.java:183)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:700)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1020)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1688)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:368)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:377)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338)
at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)