Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (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 KaplanFriend
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 IsaacsFriend
Messages: 1354
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 KaplanFriend
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 DiazFriend
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: Wed Apr 24 22:37:36 GMT 2024

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

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

Back to the top