JAX-RS does not work with EJB's with a non-default name in EAP 6

Solution Verified - Updated -

Issue

When we use EJB and give it a name set by the annotation @javax.ejb.Stateless(name="MyCustomName") which is different of the name of the class, it is not working as a JAX-RS resource and the following error is raised:

org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: javax.naming.NameNotFoundException: resteasy-ejb-beans/EJBResource -- service jboss.naming.context.java.app.resteasy-ejb.resteasy-ejb-beans.EJBResource
    org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:245)
    org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190)
    org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540)
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
    org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.0.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.