[
https://jira.jboss.org/jira/browse/JBAS-5646?page=com.atlassian.jira.plug...
]
Gerbrand van Dieijen commented on JBAS-5646:
--------------------------------------------
Hello, I got the error too when using JBoss 5.0.0.GA
I could work-around the problem by adding a mappedName parameter to the @EJB annotation
with the JNDI name:
Bean snippets:
@Stateless
public class MyBean implements MyBeanInterface {
...
}
@Local
public interface MyBeanInterface {
...
}
MyServlet extends HttpServlet {
@EJB(beanInterface=MyBeanInterface.class,mappedName = "MyBean/local")
private MyBeanInterface myBean;
..
}
With the mappedName the bean was injected succesfully in my servlet.
@EJB does not work in servlet
-----------------------------
Key: JBAS-5646
URL:
https://jira.jboss.org/jira/browse/JBAS-5646
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: EJB3, Web (Tomcat) service
Affects Versions: JBossAS-5.0.0.CR1
Environment: JBOSS trunk revision 74818 on both Windows 2000SP4 and Linux Fedora
8 (64-bit) with 32-bit JDK 1.5.0.14 (on both Windows and Linux)
Reporter: Rick Vederman
Assignee: Emanuel Muckenhuber
Priority: Critical
Fix For: JBossAS-5.0.0.CR2
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.
--
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