如何在weblogic启动时让其加载指定的jar库文件
項(xiàng)目使用了某第三方公司提供的一個(gè)jar包,且那個(gè)jar包必須在容器啟動(dòng)的classpath內(nèi),不能在application的classpath內(nèi)。
起初是修改weblogic中domain的啟動(dòng)文件,想把jar的路徑set進(jìn)去,但是修改了startWeblogic.sh和setDomainEnv.sh都不行,比較郁悶。
后來突然想起,tomcat有個(gè)common目錄,下面有個(gè)lib目錄,tomcat在啟動(dòng)的時(shí)候會(huì)自動(dòng)加載lib目錄下的jar,那weblogic也應(yīng)該有個(gè)類似的東東才對(duì)。
翻了翻weblogic domain的目錄,發(fā)現(xiàn)domain下有個(gè)lib目錄,里面有個(gè)說明文件這么寫到:
this is the domain library directory and is usually located at $DOMAIN_DIR/lib.
The jars located in this directory will be picked up and added dynamically to the end of the server classpath at server startup. The jars will be ordered lexically in the classpath. The domain library directory is one mechanism that can be used for adding application libraries to the server classpath.
It is possible to override the $DOMAIN_DIR/lib directory using the -Dweblogic.ext.dirs system property during startup. This property specifies a list of directories to pick up jars from and dynamically append to the end of the server classpath using java.io.File.pathSeparator as the delimiter between path entries.
意思大致就是,凡是放在這個(gè)目錄里的jar文件,都會(huì)在weblogic啟動(dòng)的時(shí)候自動(dòng)追加到classpath里,可以被application引用。
問題圓滿解決,不過解決之前花了好久修改啟動(dòng)文件 囧rz......
總結(jié)
以上是生活随笔為你收集整理的如何在weblogic启动时让其加载指定的jar库文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 有人说学了C语言,两天就能学会Java,
- 下一篇: 数据管理的3种方法,看完后感叹:数字化转