Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3619

JNDI resources only allow single JNDI name per REST resource

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None

      When a REST resource is defined using a JNDI name, only one name lookup is allowed for that resource. There are cases where an EJB may have multiple views and need multiple JNDI lookups for the EJB implementation. For example, if you've got an EJB which implements multiple interfaces, each JNDI lookup name needs the interface it implements. Not all methods in the EJB implementation may belong to the same interface which could lead to issues when the wrong view is used.

      An EJB example:

      GreetEjb.java
      @Local
      public interface GreetEjb {
      
          String hello();
      }
      
      GoodbyeEjb.java
      @Local
      public interface GoodbyeEjb {
      
          String goodbye();
      }
      
      LocalEjbImpl.java
      @Stateless
      @Local({GreetEjb.class, GoodbyeEjb.class})
      @Path("/")
      public class LocalEjbImpl implements GreetEjb, GoodbyeEjb {
      
          @Resource
          SessionContext ctx;
      
          @Override
          @GET
          @Path("hello")
          public String hello() {
              if (ctx == null) {
                  return "ctx is null";
              }
              return "Hello, World!";
          }
      
          @Override
          @GET
          @Path("goodbye")
          public String goodbye() {
              if (ctx == null) {
                  return "ctx is null";
              }
              return "Goodbye, World!";
          }
      }
      

      We need to map a org.jboss.resteasy.plugins.server.resourcefactory.JndiComponentResourceFactory for the GreetEjb.hello() method and a separate one for the GoodbyEjb.goodbye() method. Each may have a EJB view and each has different JNDI lookup names.

              jperkins-rhn James Perkins
              jperkins-rhn James Perkins
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: