[jboss-user] [EJB 3.0] - Re: Why is injection not working in AS 4.0 and 4.2 (servlets

Wolfgang Knauf do-not-reply at jboss.com
Thu Apr 26 11:13:55 EDT 2007


One thing to add: Injection in a JSF mananged bean will work in JBoss 4.2

I managed to achieve this only by accessing the ENC:
@EJB(name="java:comp/env/ejb/MyBeanLocal")
  | private MyBeanLocal myBean;

I had to declare it in web.xml and jboss-web.xml.
This is my jboss-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jboss-web PUBLIC
  |     "-//JBoss//DTD Web Application 4.2//EN"
  |     "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
  | <jboss-web>
  | 	<context-root>MyWeb</context-root>
  | 	<ejb-local-ref>
  | 		<ejb-ref-name>ejb/MyBeanLocal</ejb-ref-name>
  | 		<local-jndi-name>MyEAR/MyBean/local</local-jndi-name>
  | 	</ejb-local-ref>
  | </jboss-web> 

Simply declaring "@EJB" without attributes did not work. Maybe someone can clear this ?

Wolfgang

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041041#4041041

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041041



More information about the jboss-user mailing list