0

I have a handler class that is instantiated dynamically during the run time. It's instantiated fine for certain number of invocations, but at some moment X I get this exception:

    java.lang.ClassNotFoundException: com.q.integration.handler.SearchHandler
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
        at 

I looked at URLClassLoader's source and it looks like URLClassPath cannot find resource path and returns null followed by thrown run time exception. I'll be really happy if you can give me any ideas. Thanks!

batu
  • 1

1 Answers1

0

Found! The code that was "losing" java class is a request handler used in multithreaded code. It had private static regex Pattern variable at the top. My understanding ClassNotFoundException had something to do with this variable's initialization which should've happened only once at the class level. I moved this variable inside of function call and that fixed the problem.

batu
  • 1