Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding jars in Web/Enterprice application

 
Arka Sharma
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Arka Sharma
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic