Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Using java library project in dynamic web project.
Using java library project in dynamic web project. [message #182502] Sat, 11 November 2006 11:51 Go to next message
Eclipse UserFriend
Originally posted by: anish-sam.lycos.com

Hi,

I'm sure this query has been asked by many at various places, but I've
not managed to find a solution anywhere. I'm hoping that somebody has a
working solution to my problem.

Here's what I'm trying to do:
1. Created a Java project called "MyLibs" and added xalan.jar to it.
Also, marked this jar as "Exported" in project properties.
2. Created a "Dynamic Web Project", called "MyWebApp" having reference
to "MyLibs" project.
3. Created a servlet which uses the xalan.jar classes to perform some
tasks. Everything compiles fine.
4. When I try to deploy and run the servlet on Apache Tomcat 5.0, it
fails giving exception as java.lang.NoClassDefFoundError for xalan.jar.

This is because WTP's tomcat server plugin doesn't realize the jar's
I've exported in "MyLibs" project.

This kind of structure works perfectly fine in sysdeo tomcat plugin.

I do not want to place all the jar's in WEB-INF/lib folder, because I
have plenty of jars which are used across various projects. So, i need
to have a common project for having all the jars.

Can somebody suggest me a solution for this that works with WTP? I'm
sincerely trying to migration my projects from Eclipse 2.1 (with various
3rd party plugins) to Eclipse 3.2.1 with WTP. Please help.

Thanks in advance,
--
Sam.
Re: Using java library project in dynamic web project. [message #182581 is a reply to message #182502] Mon, 13 November 2006 13:20 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
Use the J2EE Module Dependencies page of the project Properties dialog
to add jars to your project that you want included in the WEB-INF/lib.
Use the "Add Jars..." button to add jars from other projects in your
workspace. I believe this will accomplish what you want.

Cheers,
Larry

Anish Sam wrote:
> Hi,
>
> I'm sure this query has been asked by many at various places, but I've
> not managed to find a solution anywhere. I'm hoping that somebody has a
> working solution to my problem.
>
> Here's what I'm trying to do:
> 1. Created a Java project called "MyLibs" and added xalan.jar to it.
> Also, marked this jar as "Exported" in project properties.
> 2. Created a "Dynamic Web Project", called "MyWebApp" having reference
> to "MyLibs" project.
> 3. Created a servlet which uses the xalan.jar classes to perform some
> tasks. Everything compiles fine.
> 4. When I try to deploy and run the servlet on Apache Tomcat 5.0, it
> fails giving exception as java.lang.NoClassDefFoundError for xalan.jar.
>
> This is because WTP's tomcat server plugin doesn't realize the jar's
> I've exported in "MyLibs" project.
>
> This kind of structure works perfectly fine in sysdeo tomcat plugin.
>
> I do not want to place all the jar's in WEB-INF/lib folder, because I
> have plenty of jars which are used across various projects. So, i need
> to have a common project for having all the jars.
>
> Can somebody suggest me a solution for this that works with WTP? I'm
> sincerely trying to migration my projects from Eclipse 2.1 (with various
> 3rd party plugins) to Eclipse 3.2.1 with WTP. Please help.
>
> Thanks in advance,
> --
> Sam.
Re: Using java library project in dynamic web project. [message #182596 is a reply to message #182502] Mon, 13 November 2006 14:05 Go to previous messageGo to next message
Claude Petitpierre is currently offline Claude PetitpierreFriend
Messages: 2
Registered: July 2009
Junior Member
You can try to copy your library into the Tomcat/server/lib
Claude

Anish Sam a écrit:
> Hi,
>
> I'm sure this query has been asked by many at various places, but I've
> not managed to find a solution anywhere. I'm hoping that somebody has a
> working solution to my problem.
>
> Here's what I'm trying to do:
> 1. Created a Java project called "MyLibs" and added xalan.jar to it.
> Also, marked this jar as "Exported" in project properties.
> 2. Created a "Dynamic Web Project", called "MyWebApp" having reference
> to "MyLibs" project.
> 3. Created a servlet which uses the xalan.jar classes to perform some
> tasks. Everything compiles fine.
> 4. When I try to deploy and run the servlet on Apache Tomcat 5.0, it
> fails giving exception as java.lang.NoClassDefFoundError for xalan.jar.
>
> This is because WTP's tomcat server plugin doesn't realize the jar's
> I've exported in "MyLibs" project.
>
> This kind of structure works perfectly fine in sysdeo tomcat plugin.
>
> I do not want to place all the jar's in WEB-INF/lib folder, because I
> have plenty of jars which are used across various projects. So, i need
> to have a common project for having all the jars.
>
> Can somebody suggest me a solution for this that works with WTP? I'm
> sincerely trying to migration my projects from Eclipse 2.1 (with various
> 3rd party plugins) to Eclipse 3.2.1 with WTP. Please help.
>
> Thanks in advance,
> --
> Sam.
Re: Using java library project in dynamic web project. [message #182625 is a reply to message #182581] Mon, 13 November 2006 23:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: anish-sam.lycos.com

Thanks Larry,

But since I have many jar's, it won't be ideal to specify one by one all
these jars. Also, will it not copy these jars into the Web Content lib
folder?

Why wouldn't it take all the jars specified in the project directly if
the whole project is provided in the J2EE dependent modules?

--
Sam.

Larry Isaacs wrote:
> Use the J2EE Module Dependencies page of the project Properties dialog
> to add jars to your project that you want included in the WEB-INF/lib.
> Use the "Add Jars..." button to add jars from other projects in your
> workspace. I believe this will accomplish what you want.
>
> Cheers,
> Larry
>
> Anish Sam wrote:
>> Hi,
>>
>> I'm sure this query has been asked by many at various places, but I've
>> not managed to find a solution anywhere. I'm hoping that somebody has
>> a working solution to my problem.
>>
>> Here's what I'm trying to do:
>> 1. Created a Java project called "MyLibs" and added xalan.jar to it.
>> Also, marked this jar as "Exported" in project properties.
>> 2. Created a "Dynamic Web Project", called "MyWebApp" having reference
>> to "MyLibs" project.
>> 3. Created a servlet which uses the xalan.jar classes to perform some
>> tasks. Everything compiles fine.
>> 4. When I try to deploy and run the servlet on Apache Tomcat 5.0, it
>> fails giving exception as java.lang.NoClassDefFoundError for xalan.jar.
>>
>> This is because WTP's tomcat server plugin doesn't realize the jar's
>> I've exported in "MyLibs" project.
>>
>> This kind of structure works perfectly fine in sysdeo tomcat plugin.
>>
>> I do not want to place all the jar's in WEB-INF/lib folder, because I
>> have plenty of jars which are used across various projects. So, i need
>> to have a common project for having all the jars.
>>
>> Can somebody suggest me a solution for this that works with WTP? I'm
>> sincerely trying to migration my projects from Eclipse 2.1 (with
>> various 3rd party plugins) to Eclipse 3.2.1 with WTP. Please help.
>>
>> Thanks in advance,
>> --
>> Sam.
Re: Using java library project in dynamic web project. [message #182633 is a reply to message #182625] Tue, 14 November 2006 01:19 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
The "Add JARs..." button supports multi-select so you should be able to
add the bunch in one operation. You could try Control-A to select
everything, then deselect what isn't a jar. The list displayed is
simply paths to jars in your workspace organized as a tree. A folder,
even if it corresponds to a project, isn't seen as something that can be
included in WEB-INF/lib, so selecting it grays the OK button.

Note that checking a project in the J2EE Module Dependencies page means
something different than using the "Add JARs..." button. It means build
a jar from the Java source in the project and include the jar in
WEB-INF/lib.

The jars specified as dependencies won't be copied to the WEB-INF/lib in
the project. They will be added to the build path and included in
WEB-INF/lib when the project is published to a server or exported to a
WAR file.

Cheers,
Larry

Sam wrote:
> Thanks Larry,
>
> But since I have many jar's, it won't be ideal to specify one by one all
> these jars. Also, will it not copy these jars into the Web Content lib
> folder?
>
> Why wouldn't it take all the jars specified in the project directly if
> the whole project is provided in the J2EE dependent modules?
>
> --
> Sam.
>
> Larry Isaacs wrote:
>> Use the J2EE Module Dependencies page of the project Properties dialog
>> to add jars to your project that you want included in the WEB-INF/lib.
>> Use the "Add Jars..." button to add jars from other projects in your
>> workspace. I believe this will accomplish what you want.
>>
>> Cheers,
>> Larry
>>
>> Anish Sam wrote:
>>> Hi,
>>>
>>> I'm sure this query has been asked by many at various places, but
>>> I've not managed to find a solution anywhere. I'm hoping that
>>> somebody has a working solution to my problem.
>>>
>>> Here's what I'm trying to do:
>>> 1. Created a Java project called "MyLibs" and added xalan.jar to it.
>>> Also, marked this jar as "Exported" in project properties.
>>> 2. Created a "Dynamic Web Project", called "MyWebApp" having
>>> reference to "MyLibs" project.
>>> 3. Created a servlet which uses the xalan.jar classes to perform some
>>> tasks. Everything compiles fine.
>>> 4. When I try to deploy and run the servlet on Apache Tomcat 5.0, it
>>> fails giving exception as java.lang.NoClassDefFoundError for xalan.jar.
>>>
>>> This is because WTP's tomcat server plugin doesn't realize the jar's
>>> I've exported in "MyLibs" project.
>>>
>>> This kind of structure works perfectly fine in sysdeo tomcat plugin.
>>>
>>> I do not want to place all the jar's in WEB-INF/lib folder, because I
>>> have plenty of jars which are used across various projects. So, i
>>> need to have a common project for having all the jars.
>>>
>>> Can somebody suggest me a solution for this that works with WTP? I'm
>>> sincerely trying to migration my projects from Eclipse 2.1 (with
>>> various 3rd party plugins) to Eclipse 3.2.1 with WTP. Please help.
>>>
>>> Thanks in advance,
>>> --
>>> Sam.
Re: Using java library project in dynamic web project. [message #182748 is a reply to message #182633] Tue, 14 November 2006 20:11 Go to previous message
Eclipse UserFriend
Originally posted by: anish-sam.lycos.com

Thanks Larry. I guess that solves the problem.

Thanks for your help.

--
Sam.

Larry Isaacs wrote:
> The "Add JARs..." button supports multi-select so you should be able to
> add the bunch in one operation. You could try Control-A to select
> everything, then deselect what isn't a jar. The list displayed is
> simply paths to jars in your workspace organized as a tree. A folder,
> even if it corresponds to a project, isn't seen as something that can be
> included in WEB-INF/lib, so selecting it grays the OK button.
>
> Note that checking a project in the J2EE Module Dependencies page means
> something different than using the "Add JARs..." button. It means build
> a jar from the Java source in the project and include the jar in
> WEB-INF/lib.
>
> The jars specified as dependencies won't be copied to the WEB-INF/lib in
> the project. They will be added to the build path and included in
> WEB-INF/lib when the project is published to a server or exported to a
> WAR file.
>
> Cheers,
> Larry
>
> Sam wrote:
>> Thanks Larry,
>>
>> But since I have many jar's, it won't be ideal to specify one by one
>> all these jars. Also, will it not copy these jars into the Web Content
>> lib folder?
>>
>> Why wouldn't it take all the jars specified in the project directly if
>> the whole project is provided in the J2EE dependent modules?
>>
>> --
>> Sam.
>>
>> Larry Isaacs wrote:
>>> Use the J2EE Module Dependencies page of the project Properties
>>> dialog to add jars to your project that you want included in the
>>> WEB-INF/lib. Use the "Add Jars..." button to add jars from other
>>> projects in your workspace. I believe this will accomplish what you
>>> want.
>>>
>>> Cheers,
>>> Larry
>>>
>>> Anish Sam wrote:
>>>> Hi,
>>>>
>>>> I'm sure this query has been asked by many at various places, but
>>>> I've not managed to find a solution anywhere. I'm hoping that
>>>> somebody has a working solution to my problem.
>>>>
>>>> Here's what I'm trying to do:
>>>> 1. Created a Java project called "MyLibs" and added xalan.jar to it.
>>>> Also, marked this jar as "Exported" in project properties.
>>>> 2. Created a "Dynamic Web Project", called "MyWebApp" having
>>>> reference to "MyLibs" project.
>>>> 3. Created a servlet which uses the xalan.jar classes to perform
>>>> some tasks. Everything compiles fine.
>>>> 4. When I try to deploy and run the servlet on Apache Tomcat 5.0, it
>>>> fails giving exception as java.lang.NoClassDefFoundError for xalan.jar.
>>>>
>>>> This is because WTP's tomcat server plugin doesn't realize the jar's
>>>> I've exported in "MyLibs" project.
>>>>
>>>> This kind of structure works perfectly fine in sysdeo tomcat plugin.
>>>>
>>>> I do not want to place all the jar's in WEB-INF/lib folder, because
>>>> I have plenty of jars which are used across various projects. So, i
>>>> need to have a common project for having all the jars.
>>>>
>>>> Can somebody suggest me a solution for this that works with WTP? I'm
>>>> sincerely trying to migration my projects from Eclipse 2.1 (with
>>>> various 3rd party plugins) to Eclipse 3.2.1 with WTP. Please help.
>>>>
>>>> Thanks in advance,
>>>> --
>>>> Sam.
Previous Topic:Issue Running web appl from Eclipse ( Apache)
Next Topic:Web tools - cannot update eclipse via update manager - File not found
Goto Forum:
  


Current Time: Mon Dec 22 13:40:24 GMT 2014

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

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