• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

JNDI referencing to JBoss

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I've got the following scenario:

A simple, stateless session bean that's deployed to a JBoss-4.2.2-GA server. The relevant EJB-Jar.xml syntax is listed like so -
...
<enterprise-beans>
<session>
<display-name>AdviceBean</display-name>
<ejb-name>Advisor</ejb-name>
<home>headfirst.AdviceHome</home>
<remote>headfirst.Advice</remote>
<ejb-class>headfirst.AdviceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<security-identity>
<description/>
<use-caller-identity/>
</security-identity>
</session>
</enterprise-beans>
...

I have a client application that lives on a different box that has the
following JNDI code:

public void initializeReferences()
{
Hashtable myEnv = new Hashtable();

myEnv.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
myEnv.put
(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");
myEnv.put
(Context.PROVIDER_URL, "jnp://com.myServer:1099");

try {
Context ic = new InitialContext(myEnv);

Object o = ic.lookup("Advisor/remote");

AdviceHome home = (AdviceHome)PortableRemoteObject.narrow( o, AdviceHome.class);
advisor = home.create();

...

the problem with this setup (although it works when I have both the session bean and client running on the same box) doesnt work when I separate the two.

I have the client code as part of a web application trying to do this lookup running under Tomcat. (But again, on another box.)


I've trapped each line of the client code and the naming exception I'm getting is when the client tries to do ic.lookup("Advisor/remote");

I've tried several variations of this JNDI name and the references I see under JBoss aren't too helpful.

Can someone help ?



}
 
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
How do you start JBoss? Do you use the -b option? If you are not using the -b option as mentioned here, then the JBoss services will by default be bound to localhost and will not be accessible from remote clients.
 
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you added an entry in jboss.xml [under the same folder as ejb-jar.xml]
like

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you included jboss client jars to your client project?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic