[jboss-jira] [JBoss JIRA] Created: (JBAS-6054) @EJB injection in JSP fails for local interface

Wolfgang Knauf (JIRA) jira-events at lists.jboss.org
Tue Oct 7 16:53:20 EDT 2008


@EJB injection in JSP fails for local  interface
------------------------------------------------

                 Key: JBAS-6054
                 URL: https://jira.jboss.org/jira/browse/JBAS-6054
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: EJB3
    Affects Versions: JBossAS-5.0.0.CR2
            Reporter: Wolfgang Knauf
            Assignee: Carlo de Wolf
         Attachments: Stateless.ear

I will attach a sample for this problem.
To verify the code:
The attached EAR contains EJB, Web and ApplicationClient projects, one EJB "GeometricModelBean" with remote and local interfaces. The web project uses injection, the application client performs a JNDI lookup.

The JSP  tries to inject a local and a remote interface in "GeometricModelTest.jsp" (http://localhost:8080/StatelessWeb/GeometricModelTest.jsp)

<%!
  @EJB()
  GeometricModelRemote geometricModel;

  @EJB()
  GeometricModelLocal geometricModelLocal;
%>

The local interface injection will fail with this exception (from server console):

21:46:31,421 ERROR [FieldBeanProperty] failed to set value Proxy to jboss.j2ee:ear=Stateless.ear,jar=StatelessEJB.jar,name=GeometricModelBean,service=EJB3 implementing [interface org.jboss.ejb3.proxy.intf.EjbProxy, interface de.fhw.komponentenarchitekturen.knauf.stateless.GeometricModelRemote, interface org.jboss.ejb3.proxy.intf.SessionProxy] on field de.fhw.komponentenarchitekturen.knauf.stateless.GeometricModelLocal org.apache.jsp.GeometricModelTest_jsp.geometricModelLocal
java.lang.IllegalArgumentException: Can not set de.fhw.komponentenarchitekturen.knauf.stateless.GeometricModelLocal field org.apache.jsp.GeometricModelTest_jsp.geometricModelLocal to $Proxy245
	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
	at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
	at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source)
	at java.lang.reflect.Field.set(Unknown Source)
	at org.jboss.injection.lang.reflect.FieldBeanProperty.set(FieldBeanProperty.java:74)
	at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:119)
	at org.jboss.web.tomcat.service.TomcatInjectionContainer.processInjectors(TomcatInjectionContainer.java:361)
	at org.jboss.web.tomcat.service.TomcatInjectionContainer.processAnnotations(TomcatInjectionContainer.java:404)
	at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:261)
	at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
	.....

It works, if I specifiy a "mappedName" attribute (pointing to the default bean name).
<%!
  @EJB()
  GeometricModelRemote geometricModel;

  @EJB(mappedName="Stateless/GeometricModelBean/local")
  GeometricModelLocal geometricModelLocal;
%>

For servlets, the local interface injection works fine (also in the sample at URL http://localhost:8080/StatelessWeb/servlet/GeometricModelServlet)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list