[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - @EJB injection problems for managed beans and servlets

fobos do-not-reply at jboss.com
Mon Jul 9 16:12:10 EDT 2007


Hi all, i have created a SSB/EJB and access the same in  my ManagedBean JSF and in a servlet using a commom lookup as:
EJBX = (EJBX)(new InitialContext().lookup("ejb/EJBX"));i mapped the name "ejb/EJBX" in jboss.xml to local interface of my EJB. this works in Managed Bean and in Servlet.

If i use:
 @EJB(name= "ejb/EJBX") EJBX ejb; 
in a managed bean its works fine but when try run this same code injection in a servlet the same not run, why ??

I use a jboss-4.2.0.GA.

Other question is when a try use for eg.
<ejb-local-ref>
  |        <ejb-ref-name>SessionEJBLocal</ejb-ref-name>
  |       <ejb-ref-type>Session</ejb-ref-type>
  |       <local>jbossjpa.model.session.SessionEJBLocal</local>
  |       <ejb-link>ejb/SessionEJBLocal</ejb-link>
  |  </ejb-local-ref>   

Using  a servlet version="2.5", jboss cannot deploy my application, the folowing exception is throw:

  | 2007-07-09 13:43:11,926 DEBUG [org.jboss.web.tomcat.service.JBossWeb] Problem in init 
  | org.jboss.deployment.DeploymentException: Failed to parse WEB-INF/web.xml; - nested throwable: (org.jboss.deployment.DeploymentException: expected one local-home tag)
  | 	at org.jboss.web.AbstractWebContainer.parseMetaData(AbstractWebContainer.java:755)

Why this error is throw ? this version of Jboss is sevlet 2.5 compatible or no ? 

Thanks!

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

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



More information about the jboss-user mailing list