aspose file tools*
The moose likes JBoss/WildFly and the fly likes Adding jars in Web/Enterprice application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
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: 103


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: 5843
    
    7

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: 103

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: 5843
    
    7

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://aspose.com/file-tools
 
subject: Adding jars in Web/Enterprice application