Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to declare session bean with local view in ejb-jar.xml

 
kurt hanni
Ranch Hand
Posts: 140
Eclipse IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How come this does not work?

no jndi name is created on startup. I cannot access it using
@EJB SampleBeanLocal bean;
It throws javax.naming.NameNotFoundException



but this does work, a jndi-name is created and can be accessed using @EJB

 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume that in no-interface view you changed your code to this:


right? I guess that you use explicit name of the bean, so you need to use this name when accessing it using @EJB annotation (beanName attribute or lookup attribute).

When you use the local business view, did you try looking the EJB using JNDI name (lookup(-) method - not the @EJB annotation).
Also, what if you use annotations instead of ejb-jar.xml (@Stateful @Local and @Statful @LocalBean respectively) - will it work?

What EJB container do you use?

Cheers!
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be <business-local> instead of <local>
 
kurt hanni
Ranch Hand
Posts: 140
Eclipse IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran Pai wrote:It should be <business-local> instead of <local>


stupid me! its working now thanks thanks
 
kurt hanni
Ranch Hand
Posts: 140
Eclipse IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
whats the difference of using <local> and <business-local> when using it to define the session view,

code samples that I was following was using <local>/<remote>, but this not work
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kurt hanni wrote:whats the difference of using <local> and <business-local> when using it to define the session view,



See these:

http://www.coderanch.com/t/475601/EJB-JEE/java/Confused-getting-reference-interface#2131276
http://www.coderanch.com/t/414957/EJB-JEE/java/EJBObject#1828744
 
kurt hanni
Ranch Hand
Posts: 140
Eclipse IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks again Jaikiran, that cleared it up.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic