Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Shared classes across webapps when running Tomcat from Eclipse
Shared classes across webapps when running Tomcat from Eclipse [message #163524] Thu, 09 March 2006 23:46 Go to next message
Eclipse UserFriend
Originally posted by: noone.noone.org

I have Tomcat runtime installed at /opt/jakarta-tomcat-4.1.31

I also have a Dynamic Web Project ( let's call it projectW ) that uses the
above runtime. This dynamic Web Project requires / depends on classes on
another project under "Other Projects" ( let's call it projectO ).
Basically, I want classes in project0 to be shared across webapps.

Thus, in projectW's Build Path, I have projectO as a required project.
Compilation / building works fine.

Problem is when launching Tomcat, projectW's dependency on projectO is
"lost" ... or perhaps not actually defined when running the Tomcat server
within Eclipse.


In my Tomcat installation, I
changed /opt/jakarta-tomcat-4.1.31/shared/classes to a symlink so that it
points to projectO's bin/ directory. That is what is needed to be done
according to this:

http://tomcat.apache.org/tomcat-4.1-doc/class-loader-howto.h tml

.... if I want to share classes across webapps ( which I wanted to do ).
Problem is, within the "Open Launch" configuration of Tomcat in Eclipse,
$CATALINA_BASE is actually overriden to be:

-Dcatalina.base=" /home/jsalvo/workspace/.metadata/.plugins/org.eclipse.wst.se rver.core/tmp0 "

Thus, the classes in /opt/jakarta-tomcat-4.1.31/shared/classes are not
really used. So I have to manually create a shared/lib and shared/classes
under /home/jsalvo/workspace/.metadata/.plugins/org.eclipse.wst.se rver.core/tmp0.

Is there a better way ?
Re: Shared classes across webapps when running Tomcat from Eclipse [message #163568 is a reply to message #163524] Fri, 10 March 2006 14:05 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
If you double-click on the Tomcat server in the Servers view to open its
configuration editor, you can uncheck the "Run modules directly from the
workspace (do not modify the Tomcat installation)" setting. This will
make catalina.base and catalina.home both be set to your Tomcat
installation. However, in this configuration, Eclipse kind of "owns"
your Tomcat installation. The configuration files in the subfolder of
the Servers project in your workspace are the "master" files. They will
be used to overwrite those in your Tomcat installation each time you
start the server. Otherwise, I think what you have done is the best you
can do for Tomcat 4.1.x.

However, if you can use Tomcat 5.0.x or 5.5.x, this is a configurable
setting in the catalina.properties file. Currently, Web Tools doesn't
include this file among those it imports, so you will have to copy it
manually. It will work once you do. Change the "shared.loader"
property setting as needed.

Cheers,
Larry


Jesus M. Salvo Jr. wrote:
> I have Tomcat runtime installed at /opt/jakarta-tomcat-4.1.31
>
> I also have a Dynamic Web Project ( let's call it projectW ) that uses the
> above runtime. This dynamic Web Project requires / depends on classes on
> another project under "Other Projects" ( let's call it projectO ).
> Basically, I want classes in project0 to be shared across webapps.
>
> Thus, in projectW's Build Path, I have projectO as a required project.
> Compilation / building works fine.
>
> Problem is when launching Tomcat, projectW's dependency on projectO is
> "lost" ... or perhaps not actually defined when running the Tomcat server
> within Eclipse.
>
>
> In my Tomcat installation, I
> changed /opt/jakarta-tomcat-4.1.31/shared/classes to a symlink so that it
> points to projectO's bin/ directory. That is what is needed to be done
> according to this:
>
> http://tomcat.apache.org/tomcat-4.1-doc/class-loader-howto.h tml
>
> ... if I want to share classes across webapps ( which I wanted to do ).
> Problem is, within the "Open Launch" configuration of Tomcat in Eclipse,
> $CATALINA_BASE is actually overriden to be:
>
> -Dcatalina.base=" /home/jsalvo/workspace/.metadata/.plugins/org.eclipse.wst.se rver.core/tmp0 "
>
> Thus, the classes in /opt/jakarta-tomcat-4.1.31/shared/classes are not
> really used. So I have to manually create a shared/lib and shared/classes
> under /home/jsalvo/workspace/.metadata/.plugins/org.eclipse.wst.se rver.core/tmp0.
>
> Is there a better way ?
>
>
>
>
Previous Topic:Tomcat starts okay, but doesn't work
Next Topic:Create a J2EE webproject
Goto Forum:
  


Current Time: Thu Apr 25 23:00:30 GMT 2024

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

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

Back to the top