Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

null pointer exception while accessing EJB method  RSS feed

 
Harry Singh
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gurus,

I'm trying to integrate quartz scheduler in my project.. and i want to call a simple EJb class from my .java class of scheduler job. and i am trying to do a look up and getting the home, remote interfaces... like this..

value = jndiContext.lookup("Service");
ServiceHome ejbHome = (ServiceHome) PortableRemoteObject.narrow(value,ServiceHome.class);
service = ejbHome.create();
service.myMethod();

i am getting the interfaces but when i try to execute the method on these object it says null pointer exception...

I am using oc4j stand alone server!!!

Any Pointers..

Thanks in Advance
Harry
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you got NullPointerException, you can lookup your bean in Directory.

you must check null in line

 
Harry Singh
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Didnt get what u meany by that... i am getting everything all the interfaces as i am not getting any exceptions with that... but when i try to invoke method then it throws null pointer exception.. what could be the reason...
 
Sat Kum
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its been a long time since i used ejbs now.
anyways, did you check whether the instance returned/assigned is not null?

ie., in the below code,
service = ejbHome.create();
service.myMethod();

is "service" a null object.

probabaly you may have to check the corresponding ejbcreate method and the components used/called in it.
 
Harry Singh
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

No its not null and create method is fine as well... it just does everything fine... but when i try to execute method it just says null pointer exception... basically i am trying to use quartz scheduler.. and trying to call EJB method from scheduler's job.

Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!