• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Using SessionBeans from POJO within the ear...

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys/Gals,

I have a project that is really starting to get to me. I wanted to run this by you to see if you had any ideas. Currently I have 3 projects (Using Maven) One EAR project for the completed build and deployment, one EJB project which contains the Beans and POJO's for the business logic, and WEB project which uses JSF amount other frameworks. The problem I am having I would think would be simply however its driving me nuts. From withing my EJB project I have a standard POJO that I want to access a stateless session bean. I have attempted injection but found out that this method does not work from within the POJO. My next step was to use JNDI lookup however I cannot get it to find the object. I'm going to post the examples below to see if somebody has any ideas. I'm getting frustrated and figured somebody here could open my eyes. Also you should know that accessing these beans from the web side via Servlets and Managed Beans works 100% with no problems.


** Stateless SessionBean



*** POJO using injection (Does not work)


*** POJO using JNDI


OR



Both of these JNDI examples return back NameNotFoundException. Can anybody shed some light as to what is going on?
 
author & internet detective
Posts: 41415
854
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have attempted injection but found out that this method does not work from within the POJO.


This is correct. You cannot use injection within a POJO.

Did you look in your server's console to see that it is bound to the JNDI name you are expecting.
 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is I cannot determine the name it is bound to. I've attemped using mappedName name and others in the annotation however when doing the lookup we can never seem to find the correct bound name? Any tips?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which application server do you use?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic