• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in accessing EJB3.0 session bean through plain java class  RSS feed

 
Shaveta Bansal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I am having one enterprise application containing both ejb and war. I am creating entity classes and session façade in ejb side for database access. I am also having one plain java class in ejb side but in separate package. Now I want to access session bean through this java class I am not able to do so…

Can you please help me to solve this problem. I am using ejb3.0 and glassfish application server using Netbeans IDE
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I want to access session bean through this java class I am not able to do so…


How are you trying to access the bean? Please post relevant code.


While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted.
 
Shaveta Bansal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my plain java class that wants to call ConstantsMasterFacade session facade....
As in this class we have used both the way to call a session bean(annotation using ejb 3.0 and lookup method using ejb 2.0).
But none of the way is working...
As an output its gng in if loop and after that it throughs "NameNotBoundException ConstantsMasterFacade is not bound".
As we are using ejb3.0 , we dont have ejb-jar.xml...

Please help me out...


 
chetan agg
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am not very sure whether dependency injection can be done in plan java class or not. It can be done in EJBs, Servlets. Thats why probably @EJB annotation is not working.

JNDI lookup should work and it looks to me JNDI Name problem. Try "java:comp/env/ConstantsMasterFacade/Local" as JNDI names. Normally I have seen EJB 3.0 beans binding with such names in JNDI tree.

Regards,
Chetan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!