Hi,
I am using oracle9i jdeveloper 9.0.3,
I have downloaded jdev903_pre and uziped and executed jdevw.
I had created a simple session bean (TSession) and to
test it a client has been created. The source code is as follows:
package Samplemypackage1;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import mypackage1.TSession;
import mypackage1.TSessionHome;
import javax.naming.NamingException;
public class TSessionClient
{
public static void main(
String [] args)
{
TSessionClient tSessionClient = new TSessionClient();
try
{
Context context = getInitialContext();
TSessionHome tSessionHome = (TSessionHome)PortableRemoteObject.narrow(context.lookup("TSession"), TSessionHome.class);
TSession tSession;
// Use one of the create() methods below to create a new instance
// tSession = tSessionHome.create( );
tSession = tSessionHome.create();
// Call any of the Remote methods below to access the
EJB // tSession.PrintGiven( java.lang.String str );
tSession.PrintGiven("raju");
}
catch(Throwable ex)
{
ex.printStackTrace();
}
}
private static Context getInitialContext() throws NamingException
{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
env.put(Context.PROVIDER_URL, "ormi://localhost:23891/current-workspace-app");
return new InitialContext(env);
}
}
When I run this code I got the following error message.
javax.naming.NamingException: Lookup error: java.net.ConnectException: Connection refused: connect; nested exception is:
java.net.ConnectException: Connection refused: connect
java.lang.Object com.evermind.server.rmi.RMIContext.lookup(java.lang.String)
RMIContext.java:134
java.lang.Object javax.naming.InitialContext.lookup(java.lang.String)
InitialContext.java:350
void Samplemypackage1.TSessionClient.main(java.lang.String[])
TSessionClient.java:18
Process exited with exit code 0.
Any Idea how to resolve this error? Do I need set any environment variables before developing ejbs?
regds
-raju