PDA

View Full Version : Help With Eclipse Development ??



chalu
25 Aug 2010, 8:23 AM
Hello folks, I am moving my GWT/GXT development from Netbeans to Eclipse (Helios), but I am still struggling to find my way around. I have read some tutorials and watched some videos on eclipse but I still have issues in some areas, for example, I added the Hibernate Tools plugin because my GXT app uses persistence provided with Hibernate-JPA, and then I was able to create a "Hibernate Configuration" . In Netbeans, this automatically adds the required libraries to my project (Hibernate/JPA) but in eclipse my @Entity and other persistence annotations are marked "red" as errors, the code offers no solution, and manually typing "import javax.persistence.*;" does nothing as it is itself marked as unresolved.

It is very clear that my project can't find the required libraries, please how do I fix this, is there some thing I am missing. I'll really appreciate your suggestions.

chalu
25 Aug 2010, 4:32 PM
Ok, I've been able to add the hibernate and jpa library jars as a User Library, and then also add them to my Eclipse project. However, when I try to run it I get a java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory which is Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory

A little investigation reveals that the SLF4J library (which is already part of my project and therefore in my build path) contains the org.slf4j.LoggerFactory class, I can actually "browse" the SLF4J package structure from my project and see the LoggerFactory right there yet I am getting a java.lang.ClassNotFoundException because of it.

I am just starting out with Eclipse, these may be trivial to U guys but I really need your suggestions concerning this. Thanks

sven
26 Aug 2010, 4:15 AM
Setting up hibernate manually is a bit, crazy. There are many depencies ;)

http://www.slf4j.org/manual.html

next to the slf4j-api-1.X.X.jar you also need another one for the implemtation (if i remember right).

chalu
26 Aug 2010, 7:59 AM
Many thanks seven, the SLF4J docs says we have to add an implementation binding e.g Log4J, this however does not stop the java.lang.ClassNotFoundException from been thrown. After some fiddling, I made the SLF4J library a "system library" (it will be added to the boot path ... , see the attached thumbnail) and that solved it for org.slf4j.LoggerFactory, but now I have others, coming out one after the other, first it was Log4J, and now this from the Gilead library I am using :


java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer
.....
Caused by: java.lang.ClassNotFoundException: net.sf.cglib.proxy.Enhancer


Do I have to make all my user libraries be a "system library" ?? Also, looking at my eclipse "console" view, I see stuff like this :


[WARN] Server class 'net.sf.gilead.gwt.PersistentRemoteService' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/C:/Java/javalibs/gilead/gilead4gwt-1.3.0.1169.jar' to the web app classpath for this session
For additional info see: file:/C:/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.0.4_2.0.4.v201006301309/gwt-2.0.4/doc/helpInfo/webAppClassPath.html


The page indicated by ..../webAppClassPath.html just simply says it is recommended I put libraries into WEB-INF/lib folder and gives the following tip :


The most common reason to encounter this problem with a new project is using RPC, which tries to load com.google.gwt.user.client.rpc.RemoteService. The solution to is copy gwt-servlet.jar from the GWT install directory into your web app's war/WEB-INF/lib/ directory.

Fortunately, my app's war/WEB-INF/lib/ folder already has the said gwt-servlet.jar file.

One would expect that after adding a library to a project, the library's jars should be in the project's "path".

In an attempt to force the libraries jars into the project's lib/ folder I decided to compile the app, but nothing changed within the lib/ folder, it still only contained gwt-servlet.jar.


How did U guys handle this please ?????

sven
27 Aug 2010, 2:21 AM
I dont have a full list of libs required. In the Hibernate download there was always some required and some optional directories. Isnt that the case anymore?

chalu
28 Aug 2010, 5:11 AM
Yeah, I added the jars and all in the "required" folder.

chalu
6 Jan 2011, 4:49 AM
Since I've resumed my GXT-Eclipse development, felt it nice to post how I handled this. I copied the jars of the libraries used by the project to the war/WEB-INF/lib folder and it solved all the "class not found" errors.