简体   繁体   中英

Can't add single XML file to Tomcat's classpath

I want to add a file to the classpath of all applications running on my Tomcat 7 server.

When adding

${catalina.base}/conf/myfile.xml

to common.loader in catalina.properties it's not working.

But adding just

${catalina.base}/conf

does the trick.

However, I just want to add a specific file, not the entire directory. The comments in catalina.properties state the following:

[…] Prefixes should be used to define what is the repository type. […]

[…] Examples: "foo/bar.jar": Add bar.jar as a class repository […]

Unfortunately I haven't found out with which prefix I should mark my file. Do you know more about this?

When you add something to the classpath, it it always either an whole directory; or a whole JAR file (which you may consider as an packed directory). You may never have a single file entry in your classpath.

Proposed solution: Either live with the conf/ directory; or pack your myfile.xml in a JAR file (even if it only contains a single file).

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM