Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Classpath entry will not be exported or published.
Classpath entry will not be exported or published. [message #191698] Mon, 23 April 2007 21:49 Go to next message
Ivan Biddles is currently offline Ivan BiddlesFriend
Messages: 22
Registered: July 2009
Junior Member
Hi,

I have an Eclipse project that I have converted over to be a dynamic web
project. Now I have 100s of warnings that were not there before (we have a
"no warnings" policy).

The warning is of the form:

Classpath entry /XXX/xxx.jar will not be exported or published.
Runtime ClassNotFoundException may result.

I have googled for parts of that warning without finding any hits.

The problem seem to occur when I have a project that has a JAR file
included in the project.

1. How can I get the included JAR files exported correctly (without having
to explode the JARs within their respective projects).

and

2. Is there any way to override these warnings and change them to "ignore"
as you can do with the Java or Javadoc compiler settings?

Does anyone have any suggestions?

Best wishes, Ivan
Re: Classpath entry will not be exported or published. [message #191707 is a reply to message #191698] Mon, 23 April 2007 23:12 Go to previous messageGo to next message
Rob Frost is currently offline Rob FrostFriend
Messages: 64
Registered: July 2009
Member
hi Ivan,

WTP 2.0 M6 includes a new feature that allows you to add "J2EE module"
dependencies to classpath entries (cp containers and libraries) so that the
resolved contributions from these entries will be included in
published/exported structure of the module (will be added to the root of the
EAR or the WEB-INF/lib directory of web modules, depending on the type of
dependency).

Management of these dependencies can all be handled through the standard
"J2EE Module Dependencies" UI (there is also a programmatic API).

Part of this support is a validator that adds errors for various conditions
as well as the warning you have encountered. The motivation behind that
warning is that you may have a potential runtime problem if there is
something on the project classpath which is not included in the published
structure of the module and is not part of the standard WTP cp containers
that expose classes available on the server (these "standard" cp containers
are not selectable within the "J2EE Module Dependencies" UI and do not
trigger the warning).

The answer to #1 is to select these cp entries as J2EE module dependencies
(this will also cause the warning to disappear).

I have recently made the following change in this area:

-An extension point has been added (will be in the next I-build) that allows
adopters to register additional cp containers that should not be considered
as potential dependencies (associated cp container entries will therefore
not be available for selection in the J2EE Module Dependencies UI and the
warning will not be generated).

-Rob

"Ivan Biddles" <ivanb@scientology.net> wrote in message
news:98e38c6aee9e1c21ac0a78d79ccfc940$1@www.eclipse.org...
> Hi,
>
> I have an Eclipse project that I have converted over to be a dynamic web
> project. Now I have 100s of warnings that were not there before (we have a
> "no warnings" policy).
>
> The warning is of the form:
>
> Classpath entry /XXX/xxx.jar will not be exported or published.
> Runtime ClassNotFoundException may result.
>
> I have googled for parts of that warning without finding any hits.
>
> The problem seem to occur when I have a project that has a JAR file
> included in the project.
>
> 1. How can I get the included JAR files exported correctly (without having
> to explode the JARs within their respective projects).
>
> and
>
> 2. Is there any way to override these warnings and change them to "ignore"
> as you can do with the Java or Javadoc compiler settings?
> Does anyone have any suggestions?
>
> Best wishes, Ivan
>
Re: Classpath entry will not be exported or published. [message #191723 is a reply to message #191707] Tue, 24 April 2007 17:32 Go to previous messageGo to next message
Ivan Biddles is currently offline Ivan BiddlesFriend
Messages: 22
Registered: July 2009
Junior Member
Dear Rob,

Thank you for your quick reply and all the good data.

I just want to make sure I understand what you are saying and that I am
doing this right.

I have some projects that run on both the server and in an RCP client.
One, for example, has a dependency on commons-codec and commons-httpclient
so, for client purposes, I bundled those two JAR files into the project.

That works fine on the client.

My overall master server project was originally defined as an ordinary
Java project and the deployment was pieced together by exporting the main
WAR file (via Sysdeo's plug-in) and then the dependent projects were
exported to Tomcat/lib as JAR files separately.

This had several problems not least of which was that I was not building a
comprehensive WAR file with all the dependent JAR files in it. That was
when I switched to making it a dynamic web project and ran into these
warnings.

The reason that it all builds correetly, BTW, is that I also have the
codec and httpclient JARs defined in the server project.

The ideal would be if the JAR files included in the common project could
get deployed into the WAR file automatically without having to specify
them also in the server project. I take it that is not a possibility
though.

So with the next I-build, if I understand you correctly, I will be able to
keep the embedded JAR files in the common project, so that it works on the
client, but also in the server project and build the server project
without getting these warnings.

Is that about right?

Best wishes, Ivan
Re: Classpath entry will not be exported or published. [message #191730 is a reply to message #191723] Tue, 24 April 2007 17:40 Go to previous messageGo to next message
Rob Frost is currently offline Rob FrostFriend
Messages: 64
Registered: July 2009
Member
Hi Ivan

> The ideal would be if the JAR files included in the common project could
> get deployed into the WAR file automatically without having to specify
> them also in the server project. I take it that is not a possibility
> though.

Assuming I understand the use case correctly, this is possible now (using
M6) and is exactly what will happen if you select these Jar cp entries as
dependencies in the "J2EE Module Dependencies" UI: they will get deployed in
the WEB-INF/lib dir of the WAR. Once you select them as module dependencies,
the warnings will disappear (since WTP now knows that they will be available
at runtime).

Let me know how that works.

-Rob
Re: Classpath entry will not be exported or published. [message #191739 is a reply to message #191730] Wed, 25 April 2007 03:52 Go to previous messageGo to next message
Ivan Biddles is currently offline Ivan BiddlesFriend
Messages: 22
Registered: July 2009
Junior Member
Dear Rob,

> Assuming I understand the use case correctly, this is possible
> now (usingM6) and is exactly what will happen if you select these
> Jar cp entries as dependencies in the "J2EE Module Dependencies"
> UI: they will get deployed in the WEB-INF/lib dir of the WAR.
> Once you select them as module dependencies, the warnings will
> disappear (since WTP now knows that they will be available at
> runtime).

This sounds great. I apologize that this a long post but it seems that
there may be something wrong so I have documented everything I did and my
conclusions.

I do want to run through my use case one more time as this seems an
important capability and this discussion may help others reading this.

Using just two projects to keep it simple (I actually have 8 to 10 common
projects plus a server project):

1. I have a common project (let's call it "base", because it contains some
common base classes) that is to run as a plug-in in an RCP client but it
is also needed as a JAR file on the server. It includes two other jar
files -- commons-httpclient.jar and commons-codec.jar.

2. The server project (let's call it "server") is a project that is to
create a WAR file for deployment in Tomcat 6.0.10.

3. Originally, "server" was just a plain old Java project which I
converted to a dynamic web project because I wanted a more direct way of
exporting a WAR file. (Previously I had to remember to export "base" and
the others each time as well as the WAR file.)

4. I opened the properties for "server" and marked "base" as a dependency
in the J2EE Module Dependencies tab.

5. This is when I first got the warnings:

Classpath entry /base/commons-codec.jar will not be exported
or published.
Classpath entry /base/commons-httpclient.jar will not be exported
or published.

6. It wasn't a problem (except that there were close to 100 such warnings)
because I put the two JAR files in the "server" project to ensure they
were included in the WAR file, and they were.

So that is the basic use case. I need the "base" project to be included in
the "server" project without the warnings and to also be deployable as a
plug-in JAR file for the client.

Here is the new problem -- I modified a class in "base" and had to
redeploy.

The new WAR file generated from the "server" project was fine and included
"base" and its changes. However, when I exported "base" as a "deployable
plugin or fragment" it is no longer recognized by Eclipse as a plug-in.
When I looked into it I found that the MANIFEST.MF file is no longer
exported in plug-in manifest format but as a two-line plain JAR manifest
(just Manifest-version and Class-Path). Naturally, Eclipse ignores it as a
plug-in.

The only thing I have done to "base", other than the one or two-line
source code change, was to make it a dependency of "server". When I did
that several things appeared to happen:

a. A META-INF directory and MANIFEST.MF file (of the two-line variety)
were added to my src directory
b. A .settings directory was added with three files in it:

- org.eclipse.wst.common.component file
- org.eclipse.wst.common.project.facet.core.xml
- org.eclipse.jdt.core.prefs

The existing plug-ins that I did not add as a "server" dependency still
work as plug-ins and do not have a .settings directory nor a META-INF in
the src directory.

I suspected that the new MANIFEST.MF file (in src) overwrites the plug-in
manifest in the exported plug-in JAR file, so I renamed the new
MANIFEST.MF file to MANIFEST.MF2 and, sure enough, both appear in the
plug-in JAR file ... and the plug-in is now a plug-in once more.

If I then go back to the "server" and export it as a WAR file, with the
new file still named MANIFEST.MF2, the WAR file is generated just as
before.

So I guess one question is what is the purpose of the added manifest file?
It breaks the plug-in build but the server build works whether it is there
or not, so maybe it just be omitted when a project is added as a
dependency.

Best wishes, Ivan
Re: Classpath entry will not be exported or published. [message #191782 is a reply to message #191739] Wed, 25 April 2007 19:19 Go to previous messageGo to next message
Rob Frost is currently offline Rob FrostFriend
Messages: 64
Registered: July 2009
Member
Ivan,

I better understand now what is happening in this case.

-in 5, those warnings are valid: the version of the Jars that is on your
"server" classpath from base is not going to be included in the
exported/published WAR; the new J2EE classpath entry dependency feature will
allow you to eliminate the warnings and get these Jars deployed with your
WAR without needing to duplicate them in the "server" web project:

-remove them from "server"
-ensure they are exported from "base"
-mark them as J2EE dependencies in "base" so that they will be
exported/deployed within "server" at the same location as base.jar (i.e.
WEB-INF/lib); this step is only supported in 2.0 M6 via the programmatic API
for utility projects that are only referenced by a web project (the "J2EE
Module Dependencies" UI is not displayed for these projects) so, for now,
you'll need to add the following child element to the relevant
classpathentry elements in the .classpath file:

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

-The issues in #6 are not specifically related to this new feature of WTP:

By specifying "base" as a "J2EE Module Dependency" of your web project, it
was converted into a J2EE "Utility" project (which gets deployed as a Jar)
and thus the addition of the META-INF dir, additional settings files, etc.

Please open a bugzilla on the issues you hit trying to continue to use this
project as a "plug-in" project; other WTP committers can best comment
on/address these issues.

-Rob
Re: Classpath entry will not be exported or published. [message #191798 is a reply to message #191782] Wed, 25 April 2007 19:37 Go to previous messageGo to next message
Rob Frost is currently offline Rob FrostFriend
Messages: 64
Registered: July 2009
Member
you can track https://bugs.eclipse.org/bugs/show_bug.cgi?id=184094 if you
are interested in the status of UI support for managing j2ee cp entry
dependencies in this case.
Re: Classpath entry will not be exported or published. [message #191811 is a reply to message #191798] Wed, 25 April 2007 23:21 Go to previous messageGo to next message
Ivan Biddles is currently offline Ivan BiddlesFriend
Messages: 22
Registered: July 2009
Junior Member
Dear Rob,

Thank you for your explanations. I have added myself to the CC list of
bugzilla 184094 and will raise a bugzilla issue on the problem I
encountered as you suggest.

Best wishes, Ivan.
Re: Classpath entry will not be exported or published. [message #191831 is a reply to message #191811] Fri, 27 April 2007 16:19 Go to previous messageGo to next message
Ivan Biddles is currently offline Ivan BiddlesFriend
Messages: 22
Registered: July 2009
Junior Member
Dear Rob,

I made the changes to the various .classpath files and it appeared to be
OK. The warnings for the embedded JAR files were mostly resolved, although
I still have warnings for the "requiredPlugins" container.

However, I am not at a complete stop because I am getting two probelms
that I cannot resolve.

1. If I open the properties page for the "server" project and click on
J2EE Module Dependencies, I get an error dialog saying:

Could not accept changes
The current display page contains invalid values

Looking in the metaadata/.log file reveals:

java.lang.NoSuchFieldError: resolvedPathToRawEntries

at org.eclipse.jst.j2ee.classpathdep.ClaspathDependencyUtil.
getComponentClassPathDependencies (187)
at org.eclipse.jst.j2ee.classpathdep.ClaspathDependencyUtil.
getComponentClassPathDependencies (146)

and so on

2. When I try to export the "server" project as a WAR file, I get

Wizard Error: Export
An error has occurred when Export finished

The details button shows the same stack trace as above.

I am quite prepared to believe that I made an editing mistake but I
reverted all of the utility project and the "server" .classpath files and
the problem remains.

I get no indication of which file or which project or what might be the
problem and I really have no idea how to track the problem down at this
point.

Can you give me some pointers on how to proceed to solve this?

Thanks and best wishes, Ivan.
Re: Classpath entry will not be exported or published. [message #191837 is a reply to message #191831] Fri, 27 April 2007 16:43 Go to previous messageGo to next message
Rob Frost is currently offline Rob FrostFriend
Messages: 64
Registered: July 2009
Member
hi Ivan,

You've got incompatible versions of the platform and WTP; you need to get
the latest WTP 2.0 RC0 I-build (that no longer includes the reference to
that field; the field name was changed recently)

-Rob


"Ivan Biddles" <ivanb@scientology.net> wrote in message
news:feab891dc15a5b3bd96c68b04ede25b5$1@www.eclipse.org...
> Dear Rob,
>
> I made the changes to the various .classpath files and it appeared to be
> OK. The warnings for the embedded JAR files were mostly resolved, although
> I still have warnings for the "requiredPlugins" container.
>
> However, I am not at a complete stop because I am getting two probelms
> that I cannot resolve.
>
> 1. If I open the properties page for the "server" project and click on
> J2EE Module Dependencies, I get an error dialog saying:
>
> Could not accept changes
> The current display page contains invalid values
>
> Looking in the metaadata/.log file reveals:
>
> java.lang.NoSuchFieldError: resolvedPathToRawEntries
>
> at org.eclipse.jst.j2ee.classpathdep.ClaspathDependencyUtil.
> getComponentClassPathDependencies (187)
> at org.eclipse.jst.j2ee.classpathdep.ClaspathDependencyUtil.
> getComponentClassPathDependencies (146)
>
> and so on
>
> 2. When I try to export the "server" project as a WAR file, I get
> Wizard Error: Export
> An error has occurred when Export finished
>
> The details button shows the same stack trace as above.
>
> I am quite prepared to believe that I made an editing mistake but I
> reverted all of the utility project and the "server" .classpath files and
> the problem remains.
>
> I get no indication of which file or which project or what might be the
> problem and I really have no idea how to track the problem down at this
> point.
>
> Can you give me some pointers on how to proceed to solve this?
>
> Thanks and best wishes, Ivan.
>
>
Re: Classpath entry will not be exported or published. [message #191848 is a reply to message #191837] Sun, 29 April 2007 04:04 Go to previous messageGo to next message
Ivan Biddles is currently offline Ivan BiddlesFriend
Messages: 22
Registered: July 2009
Junior Member
Dear Rob,

You have been amazingly helpful. I upgraded to the I20070426 build of WTP
and its dependencies and the problem was fixed exactly as you said it
would be.

I really like WTP as a product, so I hope you don't mind me asking just a
few more questions so that I and others can get it working the way I/they
need.

1. How do I get rid of "classpath entry" warnings for the various
containers?

I currently have:

org.eclipse.pde.core.requiredPlugins 21 warnings
org.eclipse.jdt.junit.JUNIT_CONTAINER/3.8.1 11 warnings

I tried the same <attributes> tag trick, but that resulted in errors.

Invalid classpath component dependency ...
The associated classpath container cannot be included in the
published/exported module

2. If I wrongly mark a project as a dependency, and it is changed into a
utility project, how do I revert it back to being an ordinary project?

3. My development machine is not attached to the internet and will not be.
Now that I have turned my "server" project into a dynamic web project I
get warnings:

The file cannot be validated as the host "www....."
is currently unreachable.

How do I turn off that warning?

4. I get a similar problem with the WSDL validator. How do I turn that off?

WS-I: A problem occured while running the WS-I WSDL conformance
check:
org.eclipse.wst.wsi.internal.analyzer.WSIAnalyzerException:
The file WS-I Test Assertion Document (TAD) document was either
not found ...

5. Is there somewhere that I can read more about the way this all works,
especially the .classpath file and the classpathentry tag? I have read
through the on-line help and haven't found the depth of information you
have provided.

Thank you again for all your help. Best wishes, Ivan
Re: Classpath entry will not be exported or published. [message #191953 is a reply to message #191848] Wed, 02 May 2007 17:40 Go to previous message
Rob Frost is currently offline Rob FrostFriend
Messages: 64
Registered: July 2009
Member
hi Ivan,

See below.

-Rob

"Ivan Biddles" <ivanb@scientology.net> wrote in message
news:6045f5c0858f73f412cda8816d017738$1@www.eclipse.org...
> Dear Rob,
>
> You have been amazingly helpful. I upgraded to the I20070426 build of WTP
> and its dependencies and the problem was fixed exactly as you said it
> would be.
>
> I really like WTP as a product, so I hope you don't mind me asking just a
> few more questions so that I and others can get it working the way I/they
> need.
>
> 1. How do I get rid of "classpath entry" warnings for the various
> containers?
>
> I currently have:
>
> org.eclipse.pde.core.requiredPlugins 21 warnings
> org.eclipse.jdt.junit.JUNIT_CONTAINER/3.8.1 11 warnings
>
> I tried the same <attributes> tag trick, but that resulted in errors.

Note that as of this week's I-build, you no longer will need to manually
edit the .classpath file to add the dependency attribute for the case of a
Utility project referenced only by a dynamic web project. Although the "J2EE
Module Dependencies" UI is not yet displayed for these projects, you can
enable the dependency attribute for these cp entries via a new QuickFix on
the warning that is generated for them and you can remove them directly via
the Java Build Path UI (select the "Publish/export dependency" attribute
under the cp entry and select "Remove")

>
> Invalid classpath component dependency ...
> The associated classpath container cannot be included in the
> published/exported module
>

In this case, I think the warning is appropriate: you have a deployable
project which potentially has class dependencies on libraries that may not
be available on the server.

An extension point is now available to filter out certain classpath
containers from the set of classpath entries that are considered for
potential inclusion in the published/exported structure of the module (the
warning therefore won't be generated for these), however, this is really
only useful for adopters with custom container implementations (the PDE and
JUnit container are not among the set that are automatically filtered out by
WTP).

Aside from just disabling the "Classpath Dependency Validator" (via project
Validation preferences; not recommended since important errors would also be
lost), you cannot currently suppress that warning; I've added you to the
bugzilla that covers the addition of preferences to support that level of
validator granularity: https://bugs.eclipse.org/bugs/show_bug.cgi?id=185112

> 2. If I wrongly mark a project as a dependency, and it is changed into a
> utility project, how do I revert it back to being an ordinary project?

That is not currently possible (at least in an automated fashion via WTP;
use of source control to revert to a previous version would work), see the
following bugzilla for more information on this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=141056

> 3. My development machine is not attached to the internet and will not be.
> Now that I have turned my "server" project into a dynamic web project I
> get warnings:
>
> The file cannot be validated as the host "www....."
> is currently unreachable.
>
> How do I turn off that warning?

See the following bugzilla for more information on this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=104413; also, the JEE related
schemas and DTD were have just been bundled with WTP.

> 4. I get a similar problem with the WSDL validator. How do I turn that
> off?
>
> WS-I: A problem occured while running the WS-I WSDL conformance
> check:
> org.eclipse.wst.wsi.internal.analyzer.WSIAnalyzerException:
> The file WS-I Test Assertion Document (TAD) document was either
> not found ...
>
> 5. Is there somewhere that I can read more about the way this all works,
> especially the .classpath file and the classpathentry tag? I have read
> through the on-line help and haven't found the depth of information you
> have provided.

Documentation for the classpath entry publish/export support does not yet
exist in the WTP builds (the M6 New and Noteworthy includes an outline of
the funtionality). I've cc'd you on the following bugzilla which covers the
addition of these docs (a more detailed description is in the bugzilla
comments): https://bugs.eclipse.org/bugs/show_bug.cgi?id=185176

> Thank you again for all your help. Best wishes, Ivan
>
>
Previous Topic:customize XMl validator
Next Topic:JSP Editor no longer available for JSP files
Goto Forum:
  


Current Time: Thu Apr 25 05:19:04 GMT 2024

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

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

Back to the top