0

In my tomcat servlet, I am referencing a third party jar in which all annotations are loaded by ClassLoader.getSystemClassLoader(). (JDK library)

Currently, I am not able to get annotations properly within my servlet because I think servlet itself is loaded by a different class loader.

How do I work around this issue? Since it is a 3rd-party jar, I can't just change the call to use a different class loader.

Can someone please help me?

bohanl
  • 1,885
  • 4
  • 17
  • 33

1 Answers1

1

You may want to use:

ClassLoader classloader = Thread.currentThread().getContextClassLoader();

See also:

Community
  • 1
  • 1
Paul Vargas
  • 41,222
  • 15
  • 102
  • 148