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:
Code:
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
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:
Quote:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:116)
at hibernate.generatedcode.postgres.world.Test.main(Test.java:11)
|
So where could (which??) Java (there are several versions installed, but only one should be active - see below) search for that JAR? -
1. 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".
2. 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".
3. 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.
4. 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".
5. 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.
6. Java (in case some application would still ask "the system" for where to find Java) should be configured allright:
Quote:
robert@ubuntu:/$ sudo update-alternatives --config java
Password:
There are 6 alternatives which provide `java'.
Selection Alternative
-----------------------------------------------
1 /etc/alternatives/kaffe-system/bin/java
* 2 /usr/lib/j2sdk1.5-sun/bin/java
3 /usr/bin/gij-wrapper-4.1
4 /usr/lib/jvm/java-gcj/jre/bin/java
+ 5 /usr/lib/j2se/1.4/bin/java
6 /usr/lib/j2sdk1.5-sun/jre/bin/java
|
7. 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".
8. 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.
9. 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.
Sincerely
robbbert