• Post Reply Bookmark Topic Watch Topic
  • New Topic

Ejb injection in backing bean  RSS feed

 
viji narasimhan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Ejb and icefaces. currently i am working in a project which includes ejb3 and icefaces using netbeans IDE.

i trying to using ejb injection in the backing bean of an icefaces page. it works well but i am having a doubt

Code snippet

This works
@EJB(name="java:comp/env/ejb/helloref") and in sun-web.xml

i am providing
<ejb-ref>
<ejb-ref-name>helloref</ejb-ref-name>
<jndi-name>session.NewSessionRemote</jndi-name>
</ejb-ref>


but

@EJB(name="helloref") this doesn't


why and can anyone explain me what it does and what is the fund behind this.


Thanks in Advance
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

@EJB(name="helloref") there will be also an other parameter with it called MappedName .

This refers to the EJB class name and the mapped name refers to the JNDI name associated with it.

You should not make a call with ejb name ,but with the mappedname .Then your code will work.
 
viji narasimhan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi thanks for your reply. but i tried with mappedName again it is throwing the same error namenotfound exception.

i am using glass fish v2
 
Reza Rahman
author
Ranch Hand
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The EJB name is likely not correct. Take a look here: https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html.

Regards,
Reza
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!