Weld
  1. Weld
  2. WELD-381

Proxied EJBs as Injection point, wrong interface chosen

    Details

    • Type: Bug Bug
    • Status: Closed Closed (View Workflow)
    • Priority: Major Major
    • Resolution: Duplicate Issue
    • Affects Version/s: 1.0.0.GA
    • Fix Version/s: 1.0.1.CR1
    • Component/s: Resolution
    • Labels:
      None
    • Environment:
      GF v3, JDK 1.6, Windows
    • Affects:
      Compatibility/Configuration
    • Similar Issues:
      Show 10 results 

      Description

      Based on the forum post, The following EJB cannot be injected into clients:

      @DAO
      @Local(ResultDAOBean.class)
      @Stateless
      public ResultDAO extends AbstractDAO<Result> implements ResultDAOBean

      Happens the same with/without @Local

      The problem comes in when AbstractDAO implements something (e.g. AbstractDAOBean<E>) or ResultDAOBean extends an interfacet (e.g.AbstractDAOBean<E>). The interface AbstractDAOBean isn't marked as an EJB itnerface, and only one of these two would implement/extend it (ideally, ResultDAOBean).

      The injection point results in the following exception:

      Caused by: java.lang.IllegalStateException: Unable to convert ejbRef for ejb ResultDAO to a business object of type interface AbstractDAOBean
      at com.sun.ejb.containers.EjbContainerServicesImpl.getBusinessObject(EjbContainerServicesImpl.java:104)
      at org.glassfish.weld.ejb.SessionObjectReferenceImpl.getBusinessObject(SessionObjectReferenceImpl.java:60)
      at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:121)
      at jpa.dao.EvaluationDAOBean_$$javassist_110.getEM(EvaluationDAOBean$$_javassist_110.java)
      at NewSessionBean.init(NewSessionBean.java:30)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.ejb.containers.interceptors.BeanCallbackInterceptor.intercept(InterceptorManager.java:1006)
      at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:61)
      at com.sun.ejb.containers.interceptors.CallbackInvocationContext.proceed(CallbackInvocationContext.java:109)
      at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCallback(SystemInterceptorProxy.java:133)
      at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.init(SystemInterceptorProxy.java:115)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.ejb.containers.interceptors.CallbackInterceptor.intercept(InterceptorManager.java:961)
      at com.sun.ejb.containers.interceptors.CallbackChainImpl.invokeNext(CallbackChainImpl.java:61)
      at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:390)
      at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:373)
      at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:518)
      ... 38 more

        Issue Links

          Activity

          Hide
          Pete Muir
          added a comment -

          I believe this is a duplicate of WELD-305, please verify.

          Show
          Pete Muir
          added a comment - I believe this is a duplicate of WELD-305 , please verify.
          Hide
          John Ament
          added a comment -

          It might be. In my case, I cannot inject instances of the interface. It sounds just like the problem 305 is addressing, where it adds more interfaces to the bean's types. I think it would be worthwhile to add in consideration that some interfaces should not be considered as injection points as well.

          Show
          John Ament
          added a comment - It might be. In my case, I cannot inject instances of the interface. It sounds just like the problem 305 is addressing, where it adds more interfaces to the bean's types. I think it would be worthwhile to add in consideration that some interfaces should not be considered as injection points as well.
          Hide
          Pete Muir
          added a comment -

          Ok, I will write a test using your code from the forums to verify.

          Show
          Pete Muir
          added a comment - Ok, I will write a test using your code from the forums to verify.
          Hide
          Pete Muir
          added a comment -

          Added some tests which show this is now fixed in trunk

          Show
          Pete Muir
          added a comment - Added some tests which show this is now fixed in trunk
          Hide
          James Carman
          added a comment -

          Any idea when this might make it into GlassFish3? I am currently running into this issue. I ran the update tool pointing at dev*, but it doesn't look like it's been picked up.

          Show
          James Carman
          added a comment - Any idea when this might make it into GlassFish3? I am currently running into this issue. I ran the update tool pointing at dev*, but it doesn't look like it's been picked up.
          Hide
          Pete Muir
          added a comment -

          Ask on the GlassFish forum, we don't have control over this...

          Show
          Pete Muir
          added a comment - Ask on the GlassFish forum, we don't have control over this...

            People

            • Assignee:
              Pete Muir
              Reporter:
              John Ament
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: