java - JBoss - War library dependencies -


i trying add dependencies jar files. these files when put in lib/endorsed or in web_inf/lib.jar results in startup error jboss instances. suppose happening because flat classloader structure of jboss. if has implemented classloader settings in jboss-web.xml

<class-loading>        <loader-repository>com.example:archive=unique-archive-name</loader-repository>  </class-loading> 

can give me real life example ?

also should place these jar files - lib/endorsed of jboss, or lib folder in deploy folder or in web_inf/lib

duffymo's directive on not putting jars in endorsed ignored @ peril.

in additional detail:

placing libraries in web-inf/lib best practice portability , consistency adheres standard provision creating self-sufficient , distributable web archives, need pay close attention class-loading declaration you're putting in jboss-web.xml.

assume simple scenario without class-loading declaration , fictional example.jar:

  • if place example.jar in web-inf/lib and not exist in jboss//lib, example.jar visible specific war.
  • if place example.jar in web-inf/lib and does exist in jboss//lib, instance in web-inf/lib ignored , war use jboss server instance's unified class loader load example classes jboss//lib/example.jar. (the same apply other wars or ears in same server instance, assuming no class-loading overrides.)

the class-loading declaration necessary in cases (such as) have 2 different versions of example.jar: - jboss//lib: example1.0.jar - web-inf/lib: example2.0.jar

in case, jboss create unique , isolated classloader war avoid jboss//lib/example1.0.jar in favour of web-inf/lib/example2.0.jar in context of war.

in summary, if you're running 1 war in jboss server instance and/or have no conflicting jar issues, ditch class-loading declaration , put jars in jboss//lib. makes war file more lightweight, overall deployment may simpler , not consume additional memory class versions during hot-deploys.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -