We are seeing an older version of a class being used, although we had the latest one deploy. To scan all JAR files in all subfolders of an application server, how do we write a small shell script that prints out the file name of JARS files in which this specific class is found?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Now to answer this question here is a simple shell command that did that for us.
The tool JAR Explorer is pretty useful.
It pops open a GUI window with two panels. You can pick a directory, the tool will scan all the JAR files in that directory, then let you search for a specific class. The lower panel then lights up with a list of hits for that class in all the scanned JAR files.
If you need result only then you can install agentransack http://www.mythicsoft.com/agentransack/ and do a containing text search. Agentransack searches inside jar and zip files as well.
Something like:
You can wrap that up like this:
And then
jarscan org.jboss.Main
will search for that class in all jar files found under the current directoryYears ago I wrote a utility classfind to resolve issues like this. Set your classpath to point to your .jar set, and classfind will tell you in which jars it'll find a particular class.