This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JBoss and the fly likes Adding jars in Web/Enterprice application Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "Adding jars in Web/Enterprice application" Watch "Adding jars in Web/Enterprice application" New topic
Author

Adding jars in Web/Enterprice application

Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 102


Hi,

What is the difference between adding jars of a build path of a project in eclipse and putting it in JBoss server/default/lib.
One more question I have that in a "Dynamic Web Project" say I want to use mysql jdbc I need to put that driver jar file in lib directory under web-apps directory.In case of a console application if I include that jar in project classpath it works.I want to know what is the difference between these two ?

Regards,
Arka
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5536

1) JARS in the Eclipse build path will go into the WEB-INF/lib directory of your app.

2) JARs in the WEB-INF/lib directory are automatically added to your apps classpath by the application server. For a console app, you have to add those JARs to the classpath yourself. But in both cases, the JARs are in the classpath.

You might want to read up about java class loaders.


JBoss In Action
Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 102

Thanks Peter for replying.But I was using a CSV api deployed as java-csv.jar in a EJB project.I added this jar in Eclipse build path.No compile time error I got.But while running it was throwing NoClassDefFoundError.Then I put that jar in JBoss where I deployed my application, inside server/default/lib then it worked.

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5536

Ah, but an EJB project is different from a Dynamic Web Project. If the EJB is a standalone project (no EAR project), then you have to manually provide any dependencies. If the EJB project is part of an EAR project, then the EAR project should provide the dependencies in the EAR's lib directory.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Adding jars in Web/Enterprice application
 
Similar Threads
java.lang.NoClassDefFoundError for interface of included project
Why do my JARs have to be in the server classpath?
Problems with Using ReportWriter
maven: the war directory structure
Adding jars to WEB-INF/lib and build path