This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of TensorFlow 2.0 in Action and have Thushan Ganegedara on-line!
See this thread for details.
Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Help needed with ejbs+jboss!!!

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have made a session ejb, put it in a jar along with its ejb-jar.xml and jboss.xml.I have copied this jar to jboss/server/default/deploy location.
Now I have a client class, using which I am trying to invoke a method on the above deployed ejb.This client class is located outside jboss server, in some other folder say C:/MyStore on my machine.
I run the client program as a java application to access the bean class methods, but I get the following exception:
___________________________________________________________________________

javax.naming.NameNotFoundException: StoreAccessBean not bound
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:464)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:443)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at au.com.tusc.client.SessionClient.getHome(SessionClient.java:46)
at au.com.tusc.client.SessionClient.setUp(SessionClient.java:56)
at au.com.tusc.client.SessionClient.main(SessionClient.java:66)
___________________________________________________________________________

My ejb-jar.xml has the entry :
___________________________________________________________________________


<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>StoreAccess</ejb-name>
<home>au.com.tusc.session.StoreAccessHome</home>
<remote>au.com.tusc.session.StoreAccess</remote>
<local>au.com.tusc.session.StoreAccessLocal</local>
<local-home>au.com.tusc.session.StoreAccessLocalHome</local-home>
<ejb-class>au.com.tusc.session.StoreAccessSession</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
___________________________________________________________________________

and jboss.xml has the entry

<jboss>

<enterprise-beans>

<session>
<ejb-name>StoreAccess</ejb-name>
<jndi-name>StoreAccessBean</jndi-name>
<local-jndi-name>StoreAccessLocal</local-jndi-name>
</session>

</enterprise-beans>

<resource-managers>
</resource-managers>

</jboss>
___________________________________________________________________________

In my client class i am saying,
__________________________________________________________________________

Object o = ctx.lookup(au.com.tusc.session.StoreAccessHome.JNDI_NAME);

where, JNDI_NAME = "StoreAccessBean";
___________________________________________________________________________
Can anyone help me in solving out the above error.
I hope the way I have deployed the ejb and invoking the method from a client class is correct!!Please correct me if am wrong!!
I tried searching this forum as well as web for any suitable reply, but in vain..
Any help will be highly appreciated!!
Waiting for a reply,
Thanks in advance,
Shetal
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think your bean is not correctly deployed.Can you look on the server console
and check whether it is showing the message "Deploying StoreAccessBean".If not check the error.

Ambily
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a similar problem,than I got rid of local reference(jboss.xml) and interfaces and the problem was resolved.I hope this helps in your case too.
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's quite simple:

1. In your XML, you named the bean "StoreAccess" under <ejb-name/>
2. In your client code you asked for "StoreAccessBean"

"StoreAccess" doesn't equal "StoreAccessBean".


Simply change the XML to have the ejb-name:

<ejb-name>StoreAccessBean</ejb-name>
 
Vijaypal Singh
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan,the lookup is done on the basis of jndi-name not on the ejb-name.In the exception stack trace the name looked up but not fund is the jndi-name specifed in the xml which looks correct to me.
 
reply
    Bookmark Topic Watch Topic
  • New Topic