Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-5646

@EJB does not work in servlet

    XMLWordPrintable

Details

    Description

      This was not an issue in 5.0.0.Beta4. I pulled the trunk to get the fix for another bug and this cropped up. Basically, I declare an interface POJO and prefix it with @Remote. I then declare a stateless EJB which implements that interface and prefix it with @Stateless. Finally, I create a servlet and prefix an attribute declaration of the interface type using @EJB. None of the annotations have any parameters.

      See the Forum reference for the log dump (first post) as well as the java code (third post). I apologize if this is a duplicate...I see some other issues which look close, but I was not sure.

      Work-around:
      Add 'mappedName="EJB3Test1/CoverageWCBean/remote"' to the @EJB annotation in the servlet. This gets me past the "java.lang.IllegalStateException: Resolution should not happen via injection container" problem, but then this problem crops up:

      23:41:28,159 ERROR [FieldBeanProperty] failed to set value jboss.j2ee:ear=EJB3Test.ear,jar=EJB3TestEJB.jar,name=CoverageWCBean,service=EJB3 on field private ic.poc.wc.CoverageWC EJB3TestServlet.wc
      java.lang.IllegalArgumentException
      at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)

      This problem is then worked around by setting CallByValue=true in the Naming service (jboss-service.xml) and then it works (EJBTHREE-983 might be related to this problem). Note that I tested this in GlassFish and it all works fine with just the annotations without any parameters as it did under 5.0.0.Beta4.

      Attachments

        Activity

          People

            emuckenhuber_jira Emanuel Muckenhuber (Inactive)
            rweed_jira Rick Vederman (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: