• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Declaring library dependency in war

 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I want to declare dependency on some jdbc driver library from my application war file. The driver files are placed in the container's lib. But I want to make sure that if the deployer forget to place that driver in the container's lib, the application doesn't get started. How can I do this?
I read somewhere that we can do this by declaring library dependency in from WAR file. But I don't know the exact mechnism. Any idea will be of great help.
 
Johan Pelgrim
Ranch Hand
Posts: 105
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tridib,

Libraries that your web application is dependent on, but won't be shipped in the ./WEB-INF/lib folder in your war file should be added to the Class-Path entry in the ./META-INF/MANIFEST.MF file of your war-file. In this case, when the web application is deployed and the libraries are not found by the container (either in your ./WEB-INF/lib folder, or the container's library location) the web application won't be deployed.
The value of this attribute specifies the relative URLs of the extensions or libraries that this application or extension needs. URLs are separated by one or more spaces. The application or extension class loader uses the value of this attribute to construct its internal search path.


I.e The contents of the MANIFEST.MF file would look something like this
 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Johan,
Thanks for your reply. I tried it. My manifest file looks like,

Manifest-Version: 1.0
Class-Path: /META-INF msutil.jar mssqlserver.jar msbase.jar

There are no such jar files inside tomcat. But, still the web application is getting deployed without any error!
[ March 28, 2007: Message edited by: Tridib Samanta ]
 
Johan Pelgrim
Ranch Hand
Posts: 105
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tridib,

Hmm... too bad... I'm sorry, but that was my only suggestion. Anybody else got some experience on this subject?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic