Hi, I'm trying to get JBoss Hibernate running, on Eclipse 3.1, on Ubuntu 6.06.
This is a detailed (and lengthy) problem description - it's very important to me to solve this.
Thank you indeed for your time and efforts. I need to resolve this, at any rate. Thanks again.
This is the Java code I'm trying to execute:
public class Test
public static void main(String args)
SessionFactory sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
When running that code, I'm getting the error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
So where could (which??) Java (there are several versions installed, but only one should be active - see below) search for that JAR? -
By default, Java on Ubuntu is started via "/usr/bin/java", which is a link that points to "/usr/lib/j2sdk1.5-sun/bin/java", in my case, and that's allright.
"/usr/lib/j2sdk1.5-sun/lib" does contain the JAR file in question, "commons-logging-1.1.jar".
Anyways, - to make sure to match a working Java Virtual Machine, I'm now starting Eclipse using a custom command: "/usr/lib/j2sdk1.5-sun/bin/java -Xms40m -Xmx256m -jar /media/hde1/home/robert/eclipse-3.1.2-wtp/startup.jar -os linux -ws gtk -arch x86 -launcher /media/hde1/home/robert/eclipse-3.1.2-wtp/eclipse -name Eclipse -showsplash 600 -exitdata 460011 -vm /usr/lib/j2sdk1.5-sun/bin/java -vmargs -Xms40m -Xmx256m -jar /media/hde1/home/robert/eclipse-3.1.2-wtp/startup.jar".
Again, "/usr/lib/j2sdk1.5-sun/lib" does contain the JAR file in question, "commons-logging-1.1.jar".
In the project's "Java Build Path", I've added (a) "/usr/lib/j2sdk1.5-sun/lib/hibernate3.jar" (otherwise, the project wouldn't compile), and (b) "/usr/lib/j2sdk1.5-sun/lib/commons-logging-1.1.jar" (containing the class that could not be found).
I've also made sure both libraries are checked to be exported.
In the project's "Java Build Path", I've also added a reference to the variable "JRE_LIB", which points to "/usr/lib/j2sdk1.5-sun/jre/lib/rt.jar". That package that cannot be found, "commons-logging-1.1.jar", does exist in "/usr/lib/j2sdk1.5-sun/jre/lib/ext".
On my Ubuntu system, there's also some dubious folder named "/usr/share/java". There, mostly links exist, but additionally, some actual JAR files. I've added the JAR file in question, "commons-logging-1.1.jar", to it.
Java (in case some application would still ask "the system" for where to find Java) should be configured allright:
robert@ubuntu:/$ sudo update-alternatives --config java
There are 6 alternatives which provide `java'.
* 2 /usr/lib/j2sdk1.5-sun/bin/java
+ 5 /usr/lib/j2se/1.4/bin/java
I don't understand what the + sign means in the above quote, anyways, I'd also placed the offending JAR into "/usr/lib/j2se/1.4/lib/ext".
At some point of time, I'd also set the CLASSPATH property accordingly, pointing to "/usr/lib/j2sdk1.5-sun/jre/lib/ext", where "commons-logging-1.1.jar" resides. - No luck.
I've searched the web for similar issues, but anything doesn't seem to help for me.
Also, I haven't had such problems when using Eclipse on Windows (using other libraries), extensively.
Still no luck!
I've spent a d*mned complete day on just trying to resolve that simple issue! And it's not going to stop! F*ck!!
- Would anyone please be so nice to get me out of here? You see, I've tried alot, and I really need some assistance to get me productive again.