Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Classpath validator issue: Projects must be referenced by an EAR or WAR(Projects must be referenced by an EAR or a WAR to use classpath publish/export dependencies whose runtime path (../) maps into the parent component.)
Classpath validator issue: Projects must be referenced by an EAR or WAR [message #550080] Thu, 29 July 2010 05:40 Go to next message
Gerry Kaplan is currently offline Gerry Kaplan
Messages: 8
Registered: July 2010
Junior Member
Updated to Helios and started getting this annoying warning. After 3 hours of tinkering with this, I give up and assume it is a bug.

I created an empty dynamic web project. Then I added one user library that contains a single Jar in it. After fixing up the deployment assembly, I am left with this one message that won't go away. The project runs fine, but I want a clean project.

Projects must be referenced by an EAR or a WAR to use classpath publish/export dependencies whose runtime path (../) maps into the parent component.

Anyone know what to do about this?
Re: Classpath validator issue: Projects must be referenced by an EAR or WAR [message #550210 is a reply to message #550080] Thu, 29 July 2010 14:14 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1310
Registered: July 2009
Senior Member
On 7/29/2010 1:40 AM, Gerry Kaplan wrote:
> Updated to Helios and started getting this annoying warning. After 3
> hours of tinkering with this, I give up and assume it is a bug.
>
> I created an empty dynamic web project. Then I added one user library
> that contains a single Jar in it. After fixing up the deployment
> assembly, I am left with this one message that won't go away. The
> project runs fine, but I want a clean project.
>
> Projects must be referenced by an EAR or a WAR to use classpath
> publish/export dependencies whose runtime path (../) maps into the
> parent component.
>
> Anyone know what to do about this?

I believe this is one of the confusing aspects of the Deployment
Assembly page. I believe "fixing up the deployment assembly" means you
used the "Referenced Projects Classpath Entries" to indicate that the
user library's jars should be included in project's WEB-INF/lib. This
use is incorrect. The "Referenced Projects Classpath Entries" works
correctly only for referenced projected. This means you've marked the
library as a dependency of the web project, which has meaning only to an
EAR project which references this web project.

The official way to correct this error is to go to the Libraries tab of
the Java Build Path page and expand the user library item. Select the
"Publish/export dependency: Added to parent module" subitem and click
Remove and Apply. Switch to the Deployment Assembly page, select the
"Pull in classpath elements from referenced projects" item, and click
Remove and OK. This undoes the incorrect "fixing up the deployment
assembly". Now switch to the Problems view and look for the slightly
different warning about the user library not being exported. It should
say "Runtime ClassNotFoundExceptions may result." Right click on this
warning and select Quick Fix and then Finish. This will mark the user
library appropriately to include it in WEB-INF/lib.

I quicker way to accomplish the above, excluding the removal of the
"Pull in classpath elements..." item (which is optional), is to modify
the ".classpath" file in the project to change:

<attribute name="org.eclipse.jst.component.dependency" value="../"/>

to:

<attribute name="org.eclipse.jst.component.dependency"
value="/WEB-INF/lib"/>

Cheers,
Larry
Re: Classpath validator issue: Projects must be referenced by an EAR or WAR [message #550286 is a reply to message #550210] Thu, 29 July 2010 18:41 Go to previous messageGo to next message
Gerry Kaplan is currently offline Gerry Kaplan
Messages: 8
Registered: July 2010
Junior Member
Thank you VERY much. That solved the problem. You are right, it is completely unclear how this is supposed to work, and I would have never thought about the quick fix.

I removed all of the library references from the deployment assembly and did what you said, but unfortunately I could not seem to get rid of the error about the "Projects must be..". To solve it, I ended up creating a completely new project, followed your instructions, and it worked. Maybe somehow my old project got corrupted.

Thank you again. I wish that was clearer, as I was up so late trying to figure out what was wrong.
Re: Classpath validator issue: Projects must be referenced by an EAR or WAR [message #741834 is a reply to message #550210] Thu, 20 October 2011 00:03 Go to previous message
Diana Diaz is currently offline Diana Diaz
Messages: 1
Registered: October 2011
Junior Member
Thank You, Works to me too Very Happy
Previous Topic:Can't run tomcat 7 on eclipse helios 3.6
Next Topic:Running tomcat 7.0.22 on Eclipse Helios 3.6.1
Goto Forum:
  


Current Time: Thu Oct 23 19:25:25 GMT 2014

Powered by FUDForum. Page generated in 0.05129 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software