D
dcp
I'm trying to create a simple SessionBean and connect using JBOSS as
the app server. However, I keep getting an ejb not bound error.
Here's the stack trace and source code. Anybody have any ideas?
javax.naming.NameNotFoundException: TestSessionBeanHome not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
at org.jnp.server.NamingServer.lookup(NamingServer.java:256)
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:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.paynetech.test.client.SessionClient.getHome(SessionClient.java:27)
at com.paynetech.test.client.SessionClient.main(SessionClient.java:81)
/*
* Created on Sep 9, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and
Comments
*/
package com.paynetech.test.client;
import java.util.Properties;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.paynetech.test.interfaces.*;
import javax.rmi.PortableRemoteObject;
/**
* @author kpdcp
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and
Comments
*/
public class SessionClient {
private static TestSessionBeanHome getHome() throws NamingException
{
Object ref =
(TestSessionBeanHome)getContext().lookup(TestSessionBeanHome.JNDI_NAME);
TestSessionBeanHome home =
(TestSessionBeanHome)PortableRemoteObject.narrow(
ref,
TestSessionBeanHome.class);
return home;
}
private static InitialContext getContext() throws NamingException {
Properties p = System.getProperties();
p.setProperty(
"java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
p.setProperty("java.naming.provider.url", "127.0.0.1:1099");
p.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
//
// Get JNDI context
//
return new javax.naming.InitialContext(p);
}
catch (Exception e) {
System.out.println(
" ARRGHH caught exception: " + e.getClass().getName());
throw new Error(e.toString());
}
}
public static void main(String[] args) {
try {
TestSessionBeanHome home = getHome();
com.paynetech.test.interfaces.TestSessionBean bean =
home.create();
}
catch (java.rmi.RemoteException re) {
re.printStackTrace();
}
catch (NamingException ne) {
ne.printStackTrace();
}
catch (javax.ejb.CreateException ce) {
ce.printStackTrace();
}
}
}
the app server. However, I keep getting an ejb not bound error.
Here's the stack trace and source code. Anybody have any ideas?
javax.naming.NameNotFoundException: TestSessionBeanHome not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
at org.jnp.server.NamingServer.lookup(NamingServer.java:256)
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:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.paynetech.test.client.SessionClient.getHome(SessionClient.java:27)
at com.paynetech.test.client.SessionClient.main(SessionClient.java:81)
/*
* Created on Sep 9, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and
Comments
*/
package com.paynetech.test.client;
import java.util.Properties;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.paynetech.test.interfaces.*;
import javax.rmi.PortableRemoteObject;
/**
* @author kpdcp
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and
Comments
*/
public class SessionClient {
private static TestSessionBeanHome getHome() throws NamingException
{
Object ref =
(TestSessionBeanHome)getContext().lookup(TestSessionBeanHome.JNDI_NAME);
TestSessionBeanHome home =
(TestSessionBeanHome)PortableRemoteObject.narrow(
ref,
TestSessionBeanHome.class);
return home;
}
private static InitialContext getContext() throws NamingException {
Properties p = System.getProperties();
p.setProperty(
"java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
p.setProperty("java.naming.provider.url", "127.0.0.1:1099");
p.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
//
// Get JNDI context
//
return new javax.naming.InitialContext(p);
}
catch (Exception e) {
System.out.println(
" ARRGHH caught exception: " + e.getClass().getName());
throw new Error(e.toString());
}
}
public static void main(String[] args) {
try {
TestSessionBeanHome home = getHome();
com.paynetech.test.interfaces.TestSessionBean bean =
home.create();
}
catch (java.rmi.RemoteException re) {
re.printStackTrace();
}
catch (NamingException ne) {
ne.printStackTrace();
}
catch (javax.ejb.CreateException ce) {
ce.printStackTrace();
}
}
}