Hai,
I had created a java class that includes the EJB in it
The code is given below :
Properties props = new Properties();
try
{
props.put (Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
props.put(Context.PROVIDER_URL, "<server name >:<server port>");
}
catch (Exception e1)
{
System.out.println("Exception 1 -
> "+e1.getMessage());
}
try
{
Context ctx = new InitialContext(props);
Object o = ctx.lookup("sap.com/DivEAR/LOCAL/com.sap.sdn.ejb.DivLocalHome");
System.out.println("Test");
DivHome home = (DivHome)PortableRemoteObject.narrow(o,DivHome.class);
Div dref = home.create();
System.out.println(dref.Divide(20,4));
}
catch (Exception e2)
{
e2.printStackTrace();
}
But it gives the following Error :
com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception while trying to get InitialContext. [Root exception is com.sap.engine.interfaces.cross.DestinationException: cannot establish connection with any of the available instances:
192.168.1.37:50200 Reason: Cannot open connection on host: 192.168.1.37 and port: 50200]
at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:455)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at com.sap.sdn.client.DivisionClient.main(DivisionClient.java:44)
Caused by: com.sap.engine.interfaces.cross.DestinationException: cannot establish connection with any of the available instances:
192.168.1.37:50200 Reason: Cannot open connection on host: 192.168.1.37 and port: 50200
at com.sap.engine.interfaces.cross.Destination.getNextAvailableBroker(Destination.java:53)
at com.sap.engine.interfaces.cross.Destination.getRemoteBroker(Destination.java:33)
at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:340)
... 5 more
Can anyone help me solve the problem.
Regards,
R.Jude Silvester.
Edited by: Jude Silvester on Jan 28, 2009 12:06 PM