RCP Classloader cannot find hibernate classes; NoClassDefFoundError [Eclipse RCP & Hibernate] [message #378492] |
Thu, 09 September 2004 13:34 |
Eclipse User |
|
|
|
Originally posted by: hardtt.gmx.de
Hi folks,
I'm working on a time-tracking software and decided - instead of working
from scratch - to build upon eclipse rcp.
But after I decided to use Hibernate I get a classloader error:
---------[snip]---------
!SESSION Sep 09, 2004 15:03:40.921
---------------------------------------------
eclipse.buildId=unknown
java.version=1.4.2_03
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments: -product RCPProjektmanagement.RCPProjektmanagement
!ENTRY org.eclipse.core.runtime 4 2 Sep 09, 2004 15:03:40.937
!MESSAGE Problems occurred when invoking code from plug-in:
"org.eclipse.core.runtime".
!STACK 0
java.lang.NoClassDefFoundError: org/hibernate/Session
at
de.thardt.ptracker.rcp.views.ViewKunde.createPartControl(Vie wKunde.java:49)
at org.eclipse.ui.internal.PartPane$2.run(PartPane.java:137)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at org.eclipse.ui.internal.PartPane.createChildControl(PartPane .java:133)
at org.eclipse.ui.internal.ViewPane.createChildControl(ViewPane .java:131)
at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:3 37)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:615)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
[.....]
---------[snip]---------
I am not using the referenced class org.hibernate.Session in my source
except as a returntype of a function (which is not called at all, but
whose object gets instantiated at ViewKunde.java:49).
Of course I added the necessary jars (hibernate3.jar + all in the
hibernate-3.0alpha/lib) to the classpath:
(1) added the jar's to the plugin-projects Java Build Path (project
properties). This did not solve the problem.
(2) I added the jar's to a wrapper-plugin instead. I exported the
jar's, created a plugin-dependency from the rcp-plugin to the wrapper
plugin. This did not solve the problem.
(3) I added them to the jvm's boot classpath instead (-Xbootclasspath
jvm option). This did solve the problem neither.
(4) Next I tried to get Hibernate to work in a simple, clean
environment. I created a new project, added the jar's to the Java Build
Path (as I did in (1)). This worked perfectly.
(5) ... (x)
I tried all possible combinations of jre 1.4.2._03, jre 1.5.0.rc,
hibernate 2.1.6, hibernate 3.0.alpha, eclipse sdk 3.0 and M20040805 on
win xp. Nothing worked.
I searched the eclipse and hibernate mailing-list-archives and the
various newsgroups & faqs, but could not find anything that seem to be
helpfull.
I think there is a classpath-problem anywhere but I cannot find it. I
don`t know where to look or search next.
If only one of you could give me a hint?
--
bye
Torben Hardt
|
|
|
Re: RCP Classloader cannot find hibernate classes; NoClassDefFoundError [Eclipse [message #378496 is a reply to message #378492] |
Thu, 09 September 2004 14:55 |
Rafael Chaves Messages: 362 Registered: July 2009 |
Senior Member |
|
|
The regular classpath specified for running Java applications is not
available to plugins. The boot classpath is. But the preferred way of
doing this (in this case) is to wrap the code you need into a new or
existing plug-in.
(1) only affects the classpath at compile time. It is not what you are
looking for.
(2) is the way to go: affects classpath at both compile and runtime. If is
not working, something else must be wrong. Check it carefully. You won't
get any error messages if the JAR files in the runtime section do not
match the ones you have. Did you choose to have an OSGi manifest
(<your-plugin>/META-INF/MANIFEST.MF)? You should not need one.
Rafael
Torben Hardt wrote:
> Hi folks,
> I'm working on a time-tracking software and decided - instead of working
> from scratch - to build upon eclipse rcp.
> But after I decided to use Hibernate I get a classloader error:
> ---------[snip]---------
> !SESSION Sep 09, 2004 15:03:40.921
> ---------------------------------------------
> eclipse.buildId=unknown
> java.version=1.4.2_03
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
> Command-line arguments: -product RCPProjektmanagement.RCPProjektmanagement
> !ENTRY org.eclipse.core.runtime 4 2 Sep 09, 2004 15:03:40.937
> !MESSAGE Problems occurred when invoking code from plug-in:
> "org.eclipse.core.runtime".
> !STACK 0
> java.lang.NoClassDefFoundError: org/hibernate/Session
> at
> de.thardt.ptracker.rcp.views.ViewKunde.createPartControl(Vie wKunde.java:49)
> at org.eclipse.ui.internal.PartPane$2.run(PartPane.java:137)
> at
>
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:615)
> at org.eclipse.core.runtime.Platform.run(Platform.java:747)
> at org.eclipse.ui.internal.PartPane.createChildControl(PartPane .java:133)
> at org.eclipse.ui.internal.ViewPane.createChildControl(ViewPane .java:131)
> at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:3 37)
> at
>
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:615)
> at org.eclipse.core.runtime.Platform.run(Platform.java:747)
> [.....]
> ---------[snip]---------
> I am not using the referenced class org.hibernate.Session in my source
> except as a returntype of a function (which is not called at all, but
> whose object gets instantiated at ViewKunde.java:49).
> Of course I added the necessary jars (hibernate3.jar + all in the
> hibernate-3.0alpha/lib) to the classpath:
> (1) added the jar's to the plugin-projects Java Build Path (project
> properties). This did not solve the problem.
> (2) I added the jar's to a wrapper-plugin instead. I exported the
> jar's, created a plugin-dependency from the rcp-plugin to the wrapper
> plugin. This did not solve the problem.
> (3) I added them to the jvm's boot classpath instead (-Xbootclasspath
> jvm option). This did solve the problem neither.
> (4) Next I tried to get Hibernate to work in a simple, clean
> environment. I created a new project, added the jar's to the Java Build
> Path (as I did in (1)). This worked perfectly.
> (5) ... (x)
> I tried all possible combinations of jre 1.4.2._03, jre 1.5.0.rc,
> hibernate 2.1.6, hibernate 3.0.alpha, eclipse sdk 3.0 and M20040805 on
> win xp. Nothing worked.
> I searched the eclipse and hibernate mailing-list-archives and the
> various newsgroups & faqs, but could not find anything that seem to be
> helpfull.
> I think there is a classpath-problem anywhere but I cannot find it. I
> don`t know where to look or search next.
> If only one of you could give me a hint?
|
|
|
Re: RCP Classloader cannot find hibernate classes; NoClassDefFoundError [solved] [message #378903 is a reply to message #378496] |
Thu, 09 September 2004 20:28 |
Eclipse User |
|
|
|
Originally posted by: hardtt.gmx.de
Hi Rafael!
Rafael Chaves wrote:
> The regular classpath specified for running Java applications is not
> available to plugins. The boot classpath is. But the preferred way of
> doing this (in this case) is to wrap the code you need into a new or
> existing plug-in.
Your hint helped me solving my problem. Thank you so much!
I re-did everything by hand (without eclipse ide) in a way based on the
org.apache.ant wrapper-plugin. It was not complicated but I cannot
remember if I found any documentation or hint how to accomplish the
wrapping.
Maybe we (I?) should write a short tutorial/howto and post it here so
one can find it by searching the eclipse.org site...
> (2) is the way to go: affects classpath at both compile and runtime. If is
> not working, something else must be wrong. Check it carefully. You won't
> get any error messages if the JAR files in the runtime section do not
> match the ones you have. Did you choose to have an OSGi manifest
> (<your-plugin>/META-INF/MANIFEST.MF)? You should not need one.
[...]
>>(2) I added the jar's to a wrapper-plugin instead. I exported the
>>jar's, created a plugin-dependency from the rcp-plugin to the wrapper
>>plugin. This did not solve the problem.
--
Torben Hardt
|
|
|
|
Powered by
FUDForum. Page generated in 0.02963 seconds