この例外を解決する方法??? 瓶がありませんか?Jboss jmx-console を調べると、「santosh」が利用できません。
EJBTest.java
EJB Remote Interface とその実装が含まれています。
package com.ramco.santosh.EJB;
import javax.ejb.Stateless;
import org.jboss.annotation.ejb.*;
@Stateless
@RemoteBinding(jndiBinding="santosh")
public class EJBTest implements EJBTestRemote {
public EJBTest(){}
public void doHello()
{
System.out.println("Hello Mr.Santosh");
}
}
主要
EJBTestRemote Interface を介して EJBTest.java にアクセスする Client です。
import java.util.*;
import javax.naming.*;
import com.ramco.santosh.EJB.*;
public class Main {
public static void main(String[] args) throws NamingException
{
Hashtable hashtable = new Hashtable();
hashtable.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
hashtable.put("java.naming.provider.url","jnp://localhost:1099");
hashtable.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
InitialContext context = new InitialContext(hashtable);
Object h=context.lookup("santosh");
EJBTestRemote remote=(EJBTestRemote)h;
remote.doHello();
}
}
Exception in thread "main" javax.naming.NameNotFoundException: santosh not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at Main.main(Main.java:27)