I am using tomcat 8 and have an external library directory called /opt/thirdParty. I have the third party library in this directory. (ie. the library directory is outside of tomcat server)
and have context.xml under META-INF configured like this
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resources className="externalPackage.ExteranlJavaClass">
<PreResources className="externalPackage.ExteranlJavaClass"
base="/opt/thirdParty/firstWebApp.jar"
internalPath="/"
webAppMount="/WEB-INF/lib" />
</Resources>
</Context>
when I start the tomcat server and get error in the catalina.out file
java.lang.ClassNotFoundException: externalPackage.ExteranlJavaClass
I need help on how to configure the tomcat server so that I can access the external library files at /opt/thirdParty directory.
Thanks.
I also tried following and get the same error message: java.lang.ClassNotFoundException: externalPackage.ExteranlJavaClass thanks for help
<Context> <Loader className="externalPackage.ExteranlJavaClass"
virtualClasspath="/opt/thirdParty/firstWebApp.jar"/> <JarScanner
scanAllDirectories="true" />
</Context>
You have several options:
Can't you just make a symlink from /opt/3rdParty/lib1.jar
to CATALINA_BASE/lib
folder?
Note! Don't forget to fix file permission issues
The className
attribute in the PreResources
element specifies an implementation of org.apache.catalina.WebResourceSet
which is used to load the resource. Since you want to load a jar you can use the standard JarResourceSet
<PreResources className="org.apache.catalina.webresources.JarResourceSet" ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.