I started a new dynamic web project in eclipse helios. I integrated glassfish into eclipse and it works fine so far. Except one thing: I place my libraries (jdbc, log4j etc.) in WEB-INF/lib. Eclips开发者_如何学Pythone deploys that files correctly to glassfish, but glassfish does not include that directory in its classpath, so my app won't run (because it can't find the jars).
When I edit the server's "launch configuration" in eclipse, I can manually add the libs under "Classpath", but that don't change a thing.
Only when I manully copy the jars to glassfish's lib/ext folder, the libs are included.
When I used tomcat as a server it works, the libs are in tomcat's classpath. But I want to use glassfish without copying the libs manually.
Any idea?
Not sure how do you add the libs in your project. Try to show the project properties tab, select the Deployment Assembly node section, and click the add button. Select archives from file system or project (if your lib i also an Eclipse j2se project). This should work. Hoping you use the latest Eclipse 3.6 SR1 and the latest glassfish plugin from the update Center: http://download.java.net/glassfish/eclipse/helios
My servlet did not find the jdbc driver, so I thought it was a lib missing. Calling “ClassForName“ solved the problem. This seems strange to me, as this is not needed when used in the SE context. So eclipse is correctly deploying the libs, just a little extra code is needed.
精彩评论