Check if the jar file is loaded?
2 answers
I think I've seen which jars are opened at startup in one of the Tomcat log files. If it weren't for me, I could think of two possible alternatives:
- Add
-verbose:class
inJAVA_OPTS
Tomcat startup scripts. It should print the classes as they are loaded by the JVM (a lot of output). Grep log file (or standardstdout
) to find if classes are listed from your jar - Use the Linux lsof command to view the files opened by the Tomcat process.
+17
source to share
The boxes are not actually loaded at startup. But Tomcat classloader loads classes from these jars. You can check if any class is available from the jar:
- trying to load this class from your code eg.
getClass().getClassloader().loadClass(className)
- trying to load a class as a resource like
getClass().getResource("/" + className.replace('.', '/') + ".class")
In the second case, you must have the name or your jar file in the url returned getResource()
.
+2
source to share