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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

calling ejb on another machine on OC4J hangs

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
hi,

I used the following code:

protected void doPost( final HttpServletRequest request
, final HttpServletResponse response ) throws ServletException, IOException
{
InitialContext context = getInitialContext() ;

try
{
System.out.println("context : " + context.toString()) ;

// Get a reference to the Bean
Object reference = context.lookup("HELLOEJB") ;
System.out.println("object reference : " + reference.toString());

// Get a reference from this to the Bean's Home interface
HelloHome home = (HelloHome) PortableRemoteObject.narrow (reference, HelloHome.class);

System.out.println("home interface : " + home.toString());

// Create the EJBObject from the Home interface
HelloRemote hello = home.create();
System.out.println("remote interface : " + hello.toString());

// Get the result
String result = hello.helloWorld() ;
response.setContentType("text/html") ;
PrintWriter out = response.getWriter() ;
out.println("Output from HelloEJB : " + result) ;
}
catch(Exception e)
{
e.printStackTrace() ;
}
}

private InitialContext getInitialContext()
{
Hashtable props = null ;
InitialContext context = null ;
try
{
props = new Hashtable();

// For OC4J SERVER
props.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
props.put(Context.PROVIDER_URL, "ormi://172.16.88.49:8888/Testhello") ;
context = new InitialContext(props) ;
}
catch(Exception e)
{
e.printStackTrace() ;
}
return context ;
}


The client servlet is at my machine on Tomcat. The ejb is at some other machine on OC4J. Using the above code there is no error but the ejb is not reached... It hangs, waiting for the ejb. The two machines are on a normal intranet.

Thanks and regards,
Amit.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not duplicate post. This is also posted in your other thread and is related to that other thread. So I am going to close this thread and let you continue your progress in the other thread.

Thanks

Mark
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic