Hello Friends,
I am very much new to
EJB and this is my first application.
I am using weblogic server 7 . I have deploied the EJB on the server, and now for the client code I am getting the error as :
javax.naming.NameNotFoundException: Unable to resolve 'com.ejb.examples.HelloHome' Resolved: '' Un
resolved:'com' ; remaining name 'com.ejb.examples.HelloHome'
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:263)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)
at javax.naming.InitialContext.lookup(InitialContext.java:345)
at com.ejb.examples.HelloClient.main(HelloClient.java:44)
My client code is as below :
----------------------------------------------------------------------------------------
package com.ejb.examples;
import com.ejb.examples.*;
import java.rmi.Remote;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.*;
import java.util.Properties;
/***
* This class is an example of client code that invokes method on a simple stateless session bean.
*/
public class HelloClient
{
public static void main(
String[] args) throws Exception
{
try
{
/**
* Setup properties for JNDI initialization.
*/
Properties props = System.getProperties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL,"t3://localhost:7001");
/**
* Obtain JNDI initial context.
*/
System.out.println("1");
Context ctx = new InitialContext(props);
System.out.println("2");
/**
* Get a reference to home object
*/
HelloHome obj = (HelloHome) ctx.lookup("com.ejb.examples.HelloHome");
System.out.println("3");
/**
* Home objects are RMI-IIOP objects and so they must be cast into RMI-IIOP objects.
*/
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, com.ejb.examples.HelloHome.class);
/**
* Use factory to create hello EJB Object.
*/
Hello hello = home.create();
/**
* Call the hello() method.
*/
System.out.println(hello.hello());
hello.remove();
}
catch(Exception e)
{
e.printStackTrace();
}
}
};
------------------------------------------------------------------------------------------------------------
If possible please help me as early as possible.