This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

First EJB - Stateless session bean  RSS feed

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Application Server : BEA Web Logic 10.3
EJB 2.0


Hi,

I am new to EJB technology.

i have created my first Stateless Session Bean. Written Home and Component Interface and below is my DD which is in MATA-INF folder.



i have created ejb jar and deployed it in web logic server. on the web logic console it is showing the EJB State as Active however as you can see in the attached image the type of application is is showing as library... should it be EJB ?

I have also written one client for testing the EJB.

below is my client code



but i am getting below exception

Stacktrace



Can anybody tell me what's wrong in my application ???
ejb1.JPG
[Thumbnail for ejb1.JPG]
 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you make JNDI mapping to the EJB bean?...
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes there is a little progress.

previously i was deploying only jar file to the web logic server. now i came to know that ejb needs to be in EAR file. so now i am confirm that the bean has been deployed to the web server. I can see the JNDI Name on web logic server.

but still having the same error.

My client application is simply a java project which contains the weblogic.jar wlclient.jar api.jar in class path. and my ejb jar file.

One thing i am wondering is that... i am not able to any stubs in my application. there is just three class files.

1. EJB
2. home interface
3. component interface.

so when will the stubs gets created, and where will i be able to see the stubs ??? Who will use stubs ?

 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh Oh!!! Your client does not know where JNDI is...

You should specify where the JNDI Service is running...

InitialContext is unable to get the whereabouts of JNDI... You should specify that...

You can do either by specifying "jndi.properties" file keeping it in parallel where Client program is...

Otherwise, create Properties object and pass the Properties object to InitialContext Constructor like this



The above code example is for JBOSS JNDI Service... Likewise, check it for WEB-LOGIC and map like this...

Then the Client can able to get the stubs from the server...
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i have noticed that and have passed properties object containing the location and factory for web logic server to InitialContext.

Now i am getting NameNotFoundException. And i have doubt that it has to do something with stubs only.

Ram Narayan.M wrote:
Then the Client can able to get the stubs from the server...


What does it mean ??? Can you please explain it in detail ???

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