Getting ClassNotFound when class is in the application when creating unmanaged threads or using java.util.Timer, or registering Message Listeners

Solution Verified - Updated -

Issue

We are getting a ClassNotFoundException for a class that is in the application when we create our own threads from the application.

java.lang.NoClassDefFoundError: com/jboss.examples/Example
  at com.jboss.examples.ExampleService.invoke(ExampleService.java:123)
  ...
  at com.jboss.examples.thread.ExampleThread$ExampleThreadRunnable.run(ExampleThread.java:123)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.ClassNotFoundException: com.jboss.examples.Example from [Module "deployment.application.ear.web.war" from Service Module Loader]
  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
  ... 17 more

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 8
    • 7
    • 6
    • 5
    • 4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content