Hi,
Thanks for your information. I am trying as follows,
#1 I have created a sun-application-client.xml descriptor.
<sun-application-client>
<ejb-ref>
<ejb-ref-name>ejb/Test</ejb-ref-name>
<jndi-name>TestBean</jndi-name>
</ejb-ref>
</sun-application-client>
#2 In my AppClient.java code I say,
package client;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.*;
import ejb.Test;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
* @author NetbeansUser
*/
public class AppClient {
@EJB(name="ejb/Test")
private static Test sb;
public AppClient() throws NamingException {
InitialContext ic = new InitialContext();
sb = (Test) ic.lookup("TestBean");
}
public static void main(String[] args) {
try {
AppClient test = new AppClient();
test.runTest();
} catch (NamingException ex) {
Logger.getLogger(AppClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void runTest() {
// Persist all entities
System.out.println("Inserting Customer and Orders... " + sb.testInsert());
// Test query and navigation
System.out.println("Verifying that all are inserted... " + sb.verifyInsert());
// Get a detached instance
int id = sb.findCustomer("Joe Smith");
// Remove all entities
System.out.println("Removing all... " + sb.testDelete(id));
// Query the results
System.out.println("Verifying that all are removed... " + sb.verifyDelete());
}
}
and I get a NameNotFoundException,
19-feb-2009 16:10:51 client.AppClient main
GRAVE: null
javax.naming.NameNotFoundException: TestBean not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
What am i doing wrong?
Regards,
Jose Alvarez de Lara
[Message sent by forum member 'josealvarezdelara' (josealvarezdelara)]
http://forums.java.net/jive/thread.jspa?messageID=332929