Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » runtime classpath question
runtime classpath question [message #164217] Fri, 17 March 2006 13:36 Go to next message
f fred is currently offline f fredFriend
Messages: 8
Registered: July 2009
Junior Member
hlo,
the more i read about that the less I understand how it works ...
Let's take an example : suppose I want to use log4j for loggins purpose (good idea isn't it ;)
I first need to add the log4j.jar to my compilation classpath, and create its xml configuration. Nothing interesting to do with that...
It gets a little more complicated when I tried to tell it to my tomcat runtime. there are many ways to do that but no one did work ! :
- Simply run the server without carring about runtime cp : of course it didn't work and ends in an classnotfound exception.
- Create a user library, add the jar to it and the user lib to project : that work for compilation but still no result at runtime.
- Tweaking directly tomcat's runtime classpath, using the "run" dialog or by selecting "open launch configuration" in the server's properties page : still cnf exception
- Create a new java project "dependencies", add the jar to it and add the dependencies project to the main one using the "j2ee dependency" page in project's properties : still the same cnf exception
- Put directly the jar to the WEB-INF/lib directory : no more cnf but what do I have to do with that stupid log4j.xml config file ? in WEB-INF/classes ? that does not work either ...

My example was about log4j but we really got dozens of that sort of libraries and i just can't imagine adding them one by one to the WEB-INF/lib directory ...

Explain me please : did I miss something important ?
what is "the best way" to add jar and "in-classpath" config file to a tomcat runtime ?
Glad it's thursday, I'm out of idea for now :)
Thanks in advance !
Re: runtime classpath question [message #164228 is a reply to message #164217] Fri, 17 March 2006 14:04 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
For information, the following might be a good place to start:

http://tomcat.apache.org/faq/logging.html

Cheers,
Larry

ffred wrote:
> hlo,
> the more i read about that the less I understand how it works ...
> Let's take an example : suppose I want to use log4j for loggins purpose (good idea isn't it ;)
> I first need to add the log4j.jar to my compilation classpath, and create its xml configuration. Nothing interesting to do with that...
> It gets a little more complicated when I tried to tell it to my tomcat runtime. there are many ways to do that but no one did work ! :
> - Simply run the server without carring about runtime cp : of course it didn't work and ends in an classnotfound exception.
> - Create a user library, add the jar to it and the user lib to project : that work for compilation but still no result at runtime.
> - Tweaking directly tomcat's runtime classpath, using the "run" dialog or by selecting "open launch configuration" in the server's properties page : still cnf exception
> - Create a new java project "dependencies", add the jar to it and add the dependencies project to the main one using the "j2ee dependency" page in project's properties : still the same cnf exception
> - Put directly the jar to the WEB-INF/lib directory : no more cnf but what do I have to do with that stupid log4j.xml config file ? in WEB-INF/classes ? that does not work either ...
>
> My example was about log4j but we really got dozens of that sort of libraries and i just can't imagine adding them one by one to the WEB-INF/lib directory ...
>
> Explain me please : did I miss something important ?
> what is "the best way" to add jar and "in-classpath" config file to a tomcat runtime ?
> Glad it's thursday, I'm out of idea for now :)
> Thanks in advance !
Re: runtime classpath question [message #164243 is a reply to message #164217] Fri, 17 March 2006 16:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kc.baltz.yahoo.com

Jars should go in the WEB-INF/lib directory of your web root.

Resources like log4j.xml that are found at runtime via the classpath should
be placed in a Source Folder. This can be your /src/main/java folder or
another like /src/main/resources. I don't recommend having a
WEB-INF/classes directory that is part of your source. It should always be
generated as part of your build process.

K.C.


"ffred" <ffred59@gmail.com> wrote in message
news:13721222.1142602617106.JavaMail.root@cp1.javalobby.org...
> hlo,
> the more i read about that the less I understand how it works ...
> Let's take an example : suppose I want to use log4j for loggins purpose
> (good idea isn't it ;)
> I first need to add the log4j.jar to my compilation classpath, and create
> its xml configuration. Nothing interesting to do with that...
> It gets a little more complicated when I tried to tell it to my tomcat
> runtime. there are many ways to do that but no one did work ! :
> - Simply run the server without carring about runtime cp : of course it
> didn't work and ends in an classnotfound exception.
> - Create a user library, add the jar to it and the user lib to project :
> that work for compilation but still no result at runtime.
> - Tweaking directly tomcat's runtime classpath, using the "run" dialog or
> by selecting "open launch configuration" in the server's properties page :
> still cnf exception
> - Create a new java project "dependencies", add the jar to it and add the
> dependencies project to the main one using the "j2ee dependency" page in
> project's properties : still the same cnf exception
> - Put directly the jar to the WEB-INF/lib directory : no more cnf but what
> do I have to do with that stupid log4j.xml config file ? in
> WEB-INF/classes ? that does not work either ...
>
> My example was about log4j but we really got dozens of that sort of
> libraries and i just can't imagine adding them one by one to the
> WEB-INF/lib directory ...
>
> Explain me please : did I miss something important ?
> what is "the best way" to add jar and "in-classpath" config file to a
> tomcat runtime ?
> Glad it's thursday, I'm out of idea for now :)
> Thanks in advance !
Re: runtime classpath question [message #164341 is a reply to message #164243] Mon, 20 March 2006 09:05 Go to previous messageGo to next message
f fred is currently offline f fredFriend
Messages: 8
Registered: July 2009
Junior Member
I agree with that as a kind of solution.
But not the best one i think!
For example, i work actually with web-services using wtp again. I never had to deploy any axis* jar manually, the plugin automatically populate the WEB-INF directory with the necessary libs he knows and that works well !
I just imagine this type of "automatic deployment" could also be used by user defined libs, mainly the build-path ones which are already referenced by eclipse or simply "user library" already defined elsewhere too. Am i a fool ?
Isn't it the purpose of something like the j2ee module dependencies tool ?
Re: runtime classpath question [message #164413 is a reply to message #164341] Mon, 20 March 2006 18:21 Go to previous message
Eclipse UserFriend
Originally posted by: kc.baltz.yahoo.com

What I described is kind of the manual solution. Personally, I'm using
Maven2 and it placess whatever JARs I need into WEB-INF/lib at build time.
I don't think I would rely on Eclipse as the tool for building my production
deployables. I only use it for development.

K.C.

"ffred" <ffred59@gmail.com> wrote in message
news:10701089.1142845590794.JavaMail.root@cp1.javalobby.org...
>I agree with that as a kind of solution.
> But not the best one i think!
> For example, i work actually with web-services using wtp again. I never
> had to deploy any axis* jar manually, the plugin automatically populate
> the WEB-INF directory with the necessary libs he knows and that works well
> !
> I just imagine this type of "automatic deployment" could also be used by
> user defined libs, mainly the build-path ones which are already referenced
> by eclipse or simply "user library" already defined elsewhere too. Am i a
> fool ?
> Isn't it the purpose of something like the j2ee module dependencies tool ?
Previous Topic:Tomcat Port Monitoring
Next Topic:Removing Action added by an Action Contributor
Goto Forum:
  


Current Time: Thu Mar 28 20:33:04 GMT 2024

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

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

Back to the top