Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » how does wtp add external classes and project to tomcat runtimeclasspath?
how does wtp add external classes and project to tomcat runtimeclasspath? [message #198442] Thu, 16 August 2007 00:10 Go to next message
Bruce Ho is currently offline Bruce HoFriend
Messages: 7
Registered: July 2009
Junior Member
using wtp, when you set up a launch configuration, you are able to add
dependent projects and external jars. at runtime, the application server,
such as tomcat, would know to find dependent classes based on these
references. But when I look up tomcat classpath setting, there does not seem
to be any way for tomcat to pick up external dependencies without modifiying
the startup script or load dependent classes right inside the
WEB-INF/classes or lib directories.

so how does wtp achieve this with the launch configuration. I looked at all
the artifacts generated by the launch configuration, and still can not see
how this is implemented. I have a need to add dependent class path to tomcat
in the same manner. can someone enlighten me on this?
Re: how does wtp add external classes and project to tomcat runtimeclasspath? [message #198450 is a reply to message #198442] Thu, 16 August 2007 13:13 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
The "dependent projects and external jars" all result in jars added to
the WEB-INF/lib of the project's published module. The publish
operation is responsible for this "assembly". Thus, the launch
configuration isn't involved with providing these "dependencies".

Cheers,
Larry

Bruce Ho wrote:
> using wtp, when you set up a launch configuration, you are able to add
> dependent projects and external jars. at runtime, the application server,
> such as tomcat, would know to find dependent classes based on these
> references. But when I look up tomcat classpath setting, there does not seem
> to be any way for tomcat to pick up external dependencies without modifiying
> the startup script or load dependent classes right inside the
> WEB-INF/classes or lib directories.
>
> so how does wtp achieve this with the launch configuration. I looked at all
> the artifacts generated by the launch configuration, and still can not see
> how this is implemented. I have a need to add dependent class path to tomcat
> in the same manner. can someone enlighten me on this?
>
>
>
Re: how does wtp add external classes and project to tomcat runtimeclasspath? [message #198470 is a reply to message #198450] Fri, 17 August 2007 20:54 Go to previous messageGo to next message
Dave Syer is currently offline Dave SyerFriend
Messages: 95
Registered: July 2009
Member
What are the rules for what ends up in the jar file in WEB-INF? And what
class loader is used to load the resources? Is it the same as the project
that is being launched?

I tried various combinations of project info -> Java Build Path settings.
The section in the dialogue box where you select resources to export looks
like it might be significant, but sometimes things are checked one minute
and unchecked the next without me doing anything (apparently). Also the JEE
module dependencies seem like they might / should have an effect. But some
of them also "uncheck" themselves inexplicably - maybe because they are
implied by other dependencies that are already checked? (But if so why can
I check them in the first place?)

I have an application that works fine if I package it all up as a war and
sling it in a standalone Tomcat, but it doesn't work in WTP. I'm not sure
what the problem is really, and from time to time depending on what I do it
will have different problems. But they all smell like classloader issues.
I get class path resources that disappear (config files), and sometimes also
ClassDefNotFound in weird places during start up, and also finally sometimes
a deserialization error in a Hibernate utility that I've never seen anywhere
else before.

"Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
news:fa1ii8$lnm$1@build.eclipse.org...
> The "dependent projects and external jars" all result in jars added to the
> WEB-INF/lib of the project's published module. The publish operation is
> responsible for this "assembly". Thus, the launch configuration isn't
> involved with providing these "dependencies".
>
> Cheers,
> Larry
>
> Bruce Ho wrote:
>> using wtp, when you set up a launch configuration, you are able to add
>> dependent projects and external jars. at runtime, the application server,
>> such as tomcat, would know to find dependent classes based on these
>> references. But when I look up tomcat classpath setting, there does not
>> seem
>> to be any way for tomcat to pick up external dependencies without
>> modifiying
>> the startup script or load dependent classes right inside the
>> WEB-INF/classes or lib directories.
>>
>> so how does wtp achieve this with the launch configuration. I looked at
>> all
>> the artifacts generated by the launch configuration, and still can not
>> see
>> how this is implemented. I have a need to add dependent class path to
>> tomcat
>> in the same manner. can someone enlighten me on this?
>>
>>
Re: how does wtp add external classes and project to tomcat runtimeclasspath? [message #198478 is a reply to message #198470] Fri, 17 August 2007 21:35 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
I wouldn't initially assume the difference is between the published
project and the packaged war. It's more likely that differences between
your standalone Tomcat and the Tomcat instance being used in Eclipse is
causing the unexpected. By default, these two server instances are not
the same. For details, see the Tomcat FAQ[1]. A possible source of
difference is covered in [2].

There isn't a lot of detail about what you are actually doing. It's not
going to be very efficient for me to speculate about various
possibilities that turn out not to have anything to with your situation.
It would be helpful, if the links don't provide sufficient help, to come
up with a scenario, hopefully simple, that exposes an issue and then
provide details about that scenario. That will make it easier to
respond with info that will likely be applicable to your situation.

Cheers,
Larry

[1] http://www.eclipse.org/webtools/faq/TomcatServerFAQ.php
[2] http://www.eclipse.org/webtools/faq/TomcatServerFAQ.php#trou ble_4

Dave Syer wrote:
> What are the rules for what ends up in the jar file in WEB-INF? And what
> class loader is used to load the resources? Is it the same as the project
> that is being launched?
>
> I tried various combinations of project info -> Java Build Path settings.
> The section in the dialogue box where you select resources to export looks
> like it might be significant, but sometimes things are checked one minute
> and unchecked the next without me doing anything (apparently). Also the JEE
> module dependencies seem like they might / should have an effect. But some
> of them also "uncheck" themselves inexplicably - maybe because they are
> implied by other dependencies that are already checked? (But if so why can
> I check them in the first place?)
>
> I have an application that works fine if I package it all up as a war and
> sling it in a standalone Tomcat, but it doesn't work in WTP. I'm not sure
> what the problem is really, and from time to time depending on what I do it
> will have different problems. But they all smell like classloader issues.
> I get class path resources that disappear (config files), and sometimes also
> ClassDefNotFound in weird places during start up, and also finally sometimes
> a deserialization error in a Hibernate utility that I've never seen anywhere
> else before.
>
> "Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
> news:fa1ii8$lnm$1@build.eclipse.org...
>> The "dependent projects and external jars" all result in jars added to the
>> WEB-INF/lib of the project's published module. The publish operation is
>> responsible for this "assembly". Thus, the launch configuration isn't
>> involved with providing these "dependencies".
>>
>> Cheers,
>> Larry
>>
>> Bruce Ho wrote:
>>> using wtp, when you set up a launch configuration, you are able to add
>>> dependent projects and external jars. at runtime, the application server,
>>> such as tomcat, would know to find dependent classes based on these
>>> references. But when I look up tomcat classpath setting, there does not
>>> seem
>>> to be any way for tomcat to pick up external dependencies without
>>> modifiying
>>> the startup script or load dependent classes right inside the
>>> WEB-INF/classes or lib directories.
>>>
>>> so how does wtp achieve this with the launch configuration. I looked at
>>> all
>>> the artifacts generated by the launch configuration, and still can not
>>> see
>>> how this is implemented. I have a need to add dependent class path to
>>> tomcat
>>> in the same manner. can someone enlighten me on this?
>>>
>>>
>
Re: how does wtp add external classes and project to tomcat runtimeclasspath? [message #198483 is a reply to message #198450] Fri, 17 August 2007 22:07 Go to previous messageGo to next message
Dave Syer is currently offline Dave SyerFriend
Messages: 95
Registered: July 2009
Member
A tip I used came from https://bugs.eclipse.org/bugs/show_bug.cgi?id=184094.
It gets me almost all the way there. And I also learned that the jar files
for other projects are built and dumped in the workspace .metadata
(.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\*) so you can verify
which ones are being exported correctly. Sweet.

But now I have three dependent projects, and only two of them are being
exported, so any classes or resources the web app tries to load from the
third of course are missing. I compared the .project and .classpath and
they are identical (bar project name). Everything in .settings is also
identical. So what is causing one to be exporeted and not the other?

Is there a way to force the wtpwebapps directory to be cleaned and
refreshed?

"Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
news:fa1ii8$lnm$1@build.eclipse.org...
> The "dependent projects and external jars" all result in jars added to the
> WEB-INF/lib of the project's published module. The publish operation is
> responsible for this "assembly". Thus, the launch configuration isn't
> involved with providing these "dependencies".
>
> Cheers,
> Larry
>
> Bruce Ho wrote:
>> using wtp, when you set up a launch configuration, you are able to add
>> dependent projects and external jars. at runtime, the application server,
>> such as tomcat, would know to find dependent classes based on these
>> references. But when I look up tomcat classpath setting, there does not
>> seem
>> to be any way for tomcat to pick up external dependencies without
>> modifiying
>> the startup script or load dependent classes right inside the
>> WEB-INF/classes or lib directories.
>>
>> so how does wtp achieve this with the launch configuration. I looked at
>> all
>> the artifacts generated by the launch configuration, and still can not
>> see
>> how this is implemented. I have a need to add dependent class path to
>> tomcat
>> in the same manner. can someone enlighten me on this?
>>
>>
Re: how does wtp add external classes and project to tomcat runtimeclasspath? [message #198499 is a reply to message #198483] Sun, 19 August 2007 10:33 Go to previous messageGo to next message
Dave Syer is currently offline Dave SyerFriend
Messages: 95
Registered: July 2009
Member
Well, I got it working, and you can find a simple example in the issue I
created at https://bugs.eclipse.org/bugs/show_bug.cgi?id=200451. (Bugzilla
is down for maintenance right now, but I will attach a working example when
it comes back.) It still isn't all that clear what's going on.

I added the "Utility Project" facet to my dependent (non-webapp) project.
At this point it showed up for the first time in the "J2EE Module
Dependencies" of the webapp, so I checked the box. It is unchecked when I
go back in there, presumably because it is also part of a "Maven2
Dependencies" library that is also checked. So there is a usability issue
(you can check it but it never stays checked). But the good news is that
now the webapp works.

As described in the bug comments above I also had to use the Quick Fix
workaround in the problems view to make sure the utility project was
exported to the parent.

I can't say that was an easy or intuiutive process, and.I'm not really
confident that the same recipe would work if I tried it again in another
workspace.

"Dave Syer" <david_syer@hotmail.com> wrote in message
news:fa567u$pgj$1@build.eclipse.org...
>A tip I used came from
>https://bugs.eclipse.org/bugs/show_bug.cgi?id=184094. It gets me almost all
>the way there. And I also learned that the jar files for other projects
>are built and dumped in the workspace .metadata
>(.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\*) so you can verify
>which ones are being exported correctly. Sweet.
>
> But now I have three dependent projects, and only two of them are being
> exported, so any classes or resources the web app tries to load from the
> third of course are missing. I compared the .project and .classpath and
> they are identical (bar project name). Everything in .settings is also
> identical. So what is causing one to be exporeted and not the other?
>
> Is there a way to force the wtpwebapps directory to be cleaned and
> refreshed?
>
> "Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
> news:fa1ii8$lnm$1@build.eclipse.org...
>> The "dependent projects and external jars" all result in jars added to
>> the WEB-INF/lib of the project's published module. The publish operation
>> is responsible for this "assembly". Thus, the launch configuration isn't
>> involved with providing these "dependencies".
>>
>> Cheers,
>> Larry
>>
>> Bruce Ho wrote:
>>> using wtp, when you set up a launch configuration, you are able to add
>>> dependent projects and external jars. at runtime, the application
>>> server,
>>> such as tomcat, would know to find dependent classes based on these
>>> references. But when I look up tomcat classpath setting, there does not
>>> seem
>>> to be any way for tomcat to pick up external dependencies without
>>> modifiying
>>> the startup script or load dependent classes right inside the
>>> WEB-INF/classes or lib directories.
>>>
>>> so how does wtp achieve this with the launch configuration. I looked at
>>> all
>>> the artifacts generated by the launch configuration, and still can not
>>> see
>>> how this is implemented. I have a need to add dependent class path to
>>> tomcat
>>> in the same manner. can someone enlighten me on this?
>>>
>>>
>
Re: how does wtp add external classes and project to tomcat runtimeclasspath? [message #198523 is a reply to message #198483] Mon, 20 August 2007 13:46 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Dave Syer wrote:
> A tip I used came from https://bugs.eclipse.org/bugs/show_bug.cgi?id=184094.
> It gets me almost all the way there. And I also learned that the jar files
> for other projects are built and dumped in the workspace .metadata
> (.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\*) so you can verify
> which ones are being exported correctly. Sweet.
>
> But now I have three dependent projects, and only two of them are being
> exported, so any classes or resources the web app tries to load from the
> third of course are missing. I compared the .project and .classpath and
> they are identical (bar project name). Everything in .settings is also
> identical. So what is causing one to be exporeted and not the other?
>
> Is there a way to force the wtpwebapps directory to be cleaned and
> refreshed?

You can right-click on the server in the Servers view and select
"Clean...". To do this for individual projects, remove the project,
publish the server, then re-add the project.

Larry

>
> "Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
> news:fa1ii8$lnm$1@build.eclipse.org...
>> The "dependent projects and external jars" all result in jars added to the
>> WEB-INF/lib of the project's published module. The publish operation is
>> responsible for this "assembly". Thus, the launch configuration isn't
>> involved with providing these "dependencies".
>>
>> Cheers,
>> Larry
>>
>> Bruce Ho wrote:
>>> using wtp, when you set up a launch configuration, you are able to add
>>> dependent projects and external jars. at runtime, the application server,
>>> such as tomcat, would know to find dependent classes based on these
>>> references. But when I look up tomcat classpath setting, there does not
>>> seem
>>> to be any way for tomcat to pick up external dependencies without
>>> modifiying
>>> the startup script or load dependent classes right inside the
>>> WEB-INF/classes or lib directories.
>>>
>>> so how does wtp achieve this with the launch configuration. I looked at
>>> all
>>> the artifacts generated by the launch configuration, and still can not
>>> see
>>> how this is implemented. I have a need to add dependent class path to
>>> tomcat
>>> in the same manner. can someone enlighten me on this?
>>>
>>>
>
Previous Topic:Eclipse Web Tools Platform
Next Topic:Nested WebContent Directory for Dynamic Web Projects
Goto Forum:
  


Current Time: Fri Mar 29 00:59:29 GMT 2024

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

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

Back to the top