Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums.classpath question: org.eclipse.jst.j2ee.internal.web.container
https://www.eclipse.org/forums/index.php/mv/msg/487643/1059097/#msg_1059097
I need a specific version of two jars in order to run a driver (Selenium) from inside of Eclipse:
httpclient-4.2.1,
httpcore-4.2.1
I have required projects on my classpath which specify an older version of these jars (4.0). I can't modify these projects to reference the newer jars without refactoring / requiring regression testing, etc.
When I run my Selenium driver inside of Eclipse I get NoSuchMethodError because the older jar versions (4.0) are being selected by the classloader.
The only solution that I've stumbled upon is to move the .classpath entries for the desired jars ABOVE the org.eclipse.jst.j2ee.internal.web.container declaration like this:
This appears to automagically allow eclipse to load the 4.2.1 versions, when otherwise the 4.0 versions would be loaded.
Can someone please explain exactly how and why this works?
To recap: when running an application inside of eclipse, specifying specific jars via a classpathentry above the internal.web.container entry appears to allow the specified version to trump other jar versions on the classpath.
Thanks very much in advance; I would love to be able to sell this solution to my team by explaining how the heck it works ]]>Craig Whynot2013-05-16T16:31:12-00:00Re: .classpath question: org.eclipse.jst.j2ee.internal.web.container
https://www.eclipse.org/forums/index.php/mv/msg/487643/1059801/#msg_1059801
Craig Whynot2013-05-21T16:21:15-00:00Re: .classpath question: org.eclipse.jst.j2ee.internal.web.container
https://www.eclipse.org/forums/index.php/mv/msg/487643/1060463/#msg_1060463
Your fix works simply because the order of entries in your Java Build Path affects their order in the runtime classpath.]]>Nitin Dahyabhai2013-05-24T20:16:08-00:00Re: .classpath question: org.eclipse.jst.j2ee.internal.web.container
https://www.eclipse.org/forums/index.php/mv/msg/487643/1060826/#msg_1060826
Basically I have two eclipse projects which are common code repositories. These two projects use the 4.0 versions of httpclient / core jars. Several dynamic web projects reference these two common projects, pulling in their class paths.
It sounds like my fix is simply allowing me to give specific jar versions higher priority by moving them before the jars pulled in from the referenced projects' classpaths.