• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Library Files Referencing

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am still figuring how to use JBoss and need some help in referencing Library Files for a WAR deployment. My current WAR file has the necessary library files (incl third party jars, spring jars etc) inside the 'WEB-INF\lib'. However, when I deploy this WAR file, all manner of exceptions show up (due to the inability for JBoss to reference them).

However, when I put these same jar files into "%JBOSS_HOME%server\default\lib", all the referencing error goes away and the WAR application can be deployed. I was hoping that the WAR file can be 'self-contained'; in other words, there is no need to copy any jar files to the JBoss folder. Could someone give me some advice as to how this can be done?

I was thinking of changing the JBOSS_CLASSPATH in the run.bat to include the reference to the 'WEB-INF\lib' folder in the WAR file but am not sure how do I do this (as in how to i reference a path in a WAR file) or if this is even the right approach.

Many thanks in advance!
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most likely you are including in WEB-INF/lib some JAR files that are already present in JBoss AS, and this is causing classloader issues. But this is just a guess because you did not provide the stack traces showing the errors.
 
Wai Meng Ng
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:Most likely you are including in WEB-INF/lib some JAR files that are already present in JBoss AS, and this is causing classloader issues. But this is just a guess because you did not provide the stack traces showing the errors.



Thank you for your reply. Actually, I have resolved the issue by putting the jars in the "%JBOSS_HOME%server\default\lib" folder. Whether the jars are included in the WAR's "WEB-INF\lib" or not does not cause the stack trace error. Only when the jars are not included in the "%JBOSS_HOME%server\default\lib" folder does the errors come up. So based on this, I reckon that JBoss only looks up and references jar files not from the WEB-INF/lib in my War file but rather solely on the jars found in "%JBOSS_HOME%server\default\lib".

Therefore my question is, how can i tell JBoss, to reference the jars found in my WAR (WEB-INF/lib folder) and not depend on those jars that i put into "%JBOSS_HOME%server\default\lib"?

Thank you
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post the list of JAR files, and the stack trace you are seeing. That might give us some clue. Other than that we would juts be guessing.
 
Wai Meng Ng
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:Please post the list of JAR files, and the stack trace you are seeing. That might give us some clue. Other than that we would juts be guessing.



Hi Peter,

Please find the stacktrace.




It is strange, now most of the errors are not appearing after removing all the jar files from the "%JBOSS_HOME%server\default\lib" folder. However, if i exclude the ojdbc14.jar file, the errors in the stack trace appears. Including this jar file back removes the errors.

I have confirmed that this jar file is in the 'WEB-INF/lib' folder of my WAR file (please see attached image).

Thank you.

library-list.jpg
[Thumbnail for library-list.jpg]
Library List
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Actually, I have resolved the issue by putting the jars in the "%JBOSS_HOME%server\default\lib" folder. Whether the jars are included in the WAR's "WEB-INF\lib" or not does not cause the stack trace error. Only when the jars are not included in the "%JBOSS_HOME%server\default\lib" folder does the errors come up. So based on this, I reckon that JBoss only looks up and references jar files not from the WEB-INF/lib in my War file but rather solely on the jars found in "%JBOSS_HOME%server\default\lib".



However, if i exclude the ojdbc14.jar file, the errors in the stack trace appears



As suspected this jar is a JDBC driver jar. And a JDBC driver jar must be placed in the %JBOSS_HOME%/server/< serverName>/lib folder. See this for details.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And you also need to correct the connection URL:



You need to replace <IPADDR> and <TNSNAME> with the values for your system.
 
Wai Meng Ng
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:And you also need to correct the connection URL:



You need to replace <IPADDR> and <TNSNAME> with the values for your system.



I know, i deliberately 'censored' that out ;)
 
Wai Meng Ng
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:

Actually, I have resolved the issue by putting the jars in the "%JBOSS_HOME%server\default\lib" folder. Whether the jars are included in the WAR's "WEB-INF\lib" or not does not cause the stack trace error. Only when the jars are not included in the "%JBOSS_HOME%server\default\lib" folder does the errors come up. So based on this, I reckon that JBoss only looks up and references jar files not from the WEB-INF/lib in my War file but rather solely on the jars found in "%JBOSS_HOME%server\default\lib".



However, if i exclude the ojdbc14.jar file, the errors in the stack trace appears



As suspected this jar is a JDBC driver jar. And a JDBC driver jar must be placed in the %JBOSS_HOME%/server/< serverName>/lib folder. See this for details.



Thanks for the reply, i never knew this. So all the other jars should not cause the problem then
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You still need to correct the URL:



The Oracle driver does not like the URL you gave it.
 
Wai Meng Ng
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:You still need to correct the URL:



The Oracle driver does not like the URL you gave it.



Sorry Peter, I do not quite get you. After adding the ojdbc14.jar file to the %JBOSS_HOME%/server/< serverName>/lib folder, there are no more errors. The error only appears when I did not copy the ojdbc14.jar file to the %JBOSS_HOME%/server/< serverName>/lib folder.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I though the you had already provided the ojdbc14.jar file and were getting the error, in which case the error means that the Oracle driver didn't like the URL.
 
Wai Meng Ng
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:Sorry, I though the you had already provided the ojdbc14.jar file and were getting the error, in which case the error means that the Oracle driver didn't like the URL.



No worries. Thanks for the great help Peter!
 
How do they get the deer to cross at the signs? Or to read this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic