I get java.lang.ClassNotFoundException when invoking EJB from MBean
Issue
- When invoking an EJB from an MBean via the JMX Console it fails with the error shown below. This works in JBoss EAP 4.x but in JBoss EAP 5.x/6.x fails.
- Why do I need to set the TCCL when calling an EJB from an MBean?
- How can I set the correct classloader for EJB's being called from an MBean?
[STDERR] Caused by: java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + org.jboss.web.tomcat.service.WebCtxLoader$ENCLoader@5d48aa9e
12:13:18,098 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:410)
12:13:18,098 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:134)
12:13:18,098 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)
12:13:18,098 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:161)
12:13:18,098 ERROR [STDERR] at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
12:13:18,098 ERROR [STDERR] at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1526)
12:13:18,098 ERROR [STDERR] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1543)
12:13:18,098 ERROR [STDERR] ... 58 more
12:13:18,098 ERROR [STDERR] Caused by: java.lang.ClassNotFoundException: org.jboss.classloader.beans.SomeBeanLocal
12:13:18,098 ERROR [STDERR] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
12:13:18,098 ERROR [STDERR] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
12:13:18,098 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
12:13:18,098 ERROR [STDERR] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
12:13:18,098 ERROR [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
12:13:18,098 ERROR [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
12:13:18,098 ERROR [STDERR] at java.lang.Class.forName0(Native Method)
12:13:18,098 ERROR [STDERR] at java.lang.Class.forName(Class.java:270)
12:13:18,098 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:406
)
12:13:18,098 ERROR [STDERR] ... 64 more
Environment
- Red Hat JBoss Enterprise Application Platform 5.x
- Red Hat JBoss Enterprise Application Platform 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.