Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem accessing EJB method

Status
Not open for further replies.
May 13, 2002
75
GB
Hiya,

i've spent a day now on this and can't figure it out. I've created a very basic session bean, and packaged it up into an .ear file. The MySessionEJBBean.java contains the following:
Code:
  public String SayHello()
  {
    return "Hello World";
  }
and the MySessionEJB.java interface contains
[/code]String SayHello() throws RemoteException;
Code:
I've copied the .ear to my app server (Oracle 9iAS OC4J container) and deployed with no error messages, all the relavent files seem to be in the correct place on the server after deployment.

Now, i've created a client application that connects to the server....
[code]
try
    {
      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, "admin");
      env.put(Context.PROVIDER_URL, "ormi://uksap13:23791/MySessionEJB");
      Context ctx = new InitialContext(env);
      
      MySessionEJBHome mySessionEJBHome = (MySessionEJBHome)ctx.lookup("MySessionEJB");

      MySessionEJB mySessionEJB = mySessionEJBHome.create();

      System.out.println("Connected !");

        mystring = mySessionEJB.SayHello();        
        System.out.println(mystring);
    }
    catch(Throwable ex)
    {
      ex.printStackTrace();
    }

When i run it, it seems to connect to the server and find the EJB just fine, but it won't run the
Code:
SayHello()
method and fails with a
Code:
java.lang.NullPointerException

I've worked the same code locally from within Oracle's JDeveloper and it works fine, but just won't seem to work remotely from another server. Has anyone any ideas whats wrong or point me in a good direction to start looking ?? [ponder]

TIA
Alistair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top