EAR dynamic libraries
I want to ask if it's possible for the war which is packed in ear, to use libraries which are not packed in the war file. I want to have the directory on the file systems with the libraries and deployed war file will load the libraries from this directory. I haven't 开发者_开发技巧found the example how to do this. So i want to ask if all libraries that the deployed war used have to be packed in the lib directory in the war file or no.
Well, depending on your application server, you can add some config to it (the app server) in which you declare some local directory as being part of the class path. This way, any jar files that you put in that directory will be available to deployed applications (wars) in that application server.
Here's some quick examples:
for tomcat you edit [tomcatDIr]\conf\catalina.properties and add to the properties server.loader and shared.loader the full path of the dir where you wanna keep external libraries
server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar,c:/bla/myExternalLibsDir
shared.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar,c:/bla/myExternalLibsDir
For jboss, you can simply edit the run.bat file found in [jbossDir]\bin, look for the line that sets the jboss classpath, and add to it's value your dir:
set JBOSS_CLASSPATH=%RUN_CLASSPATH%;c:/bla/myExternalLibsDir
精彩评论