View hierarchy, urls and classes-loading info for the class-loaders.
`classloader` can search and print out the URLs for a specified resource from one particular classloader. It is quite handy when analyzing `ResourceNotFoundException`.
### Options
|Name|Specification|
|---:|:---|
|[l]|list all classloader instances|
|[t]|print classloader's hierarchy|
|[a]|list all the classes loaded by all the classloaders (use it with great caution since the output can be huge)|
|[c:]|print classloader's hashcode|
|`[classLoaderClass:]`| The class name of the ClassLoader that executes the expression. |
|`[c: r:]`|using ClassLoader to search resource|
|`[c: load:]`|using ClassLoader to load class|
### Usage
First visit the jsp page: https://[[HOST_SUBDOMAIN]]-80-[[KATACODA_HOST]].environments.katacoda.com/hello
* The number of classes loaded by TomcatEmbeddedWebappClassLoader is 0, so in spring boot embedded tomcat, it is just an empty ClassLoader, all the classes are loaded by `LaunchedURLClassLoader`
Note that the hashcode changes, you need to check the current ClassLoader information first, and extract the hashcode corresponding to the ClassLoader.
if you use`-c`, you have to manually type hashcode by `-c <hashcode>`.
```bash
$ classloader -c 65361d9a
```
For classloader with only one instance, it can be specified by `--classLoaderClass` using class name, which is more convenient to use.
The value of `--classloaderclass` is the class name of classloader. It can only work when it matches a unique classloader instance. The purpose is to facilitate the input of general commands. However, `-c <hashcode>` is dynamic.
### List all classes loaded in ClassLoader
List all classes loaded by `org.apache.jasper.servlet.JasperLoader`:
`classloader -a --classLoaderClass org.apache.jasper.servlet.JasperLoader`{{execute T2}}
```bash
$ classloader -a --classLoaderClass org.apache.jasper.servlet.JasperLoader
For example, the hashcode of spring `LaunchedURLClassLoader` viewed above is `1be6f5c3`, and all its urls can be listed by specifying classloader using the `-c` or`--classLoaderClass` parameter and then executing the following command: