JNDI-name ist nicht verbindlich in jboss
Beheben dieses Ausnahme??? fehlen mir irgendwelche Gläser ?
Wenn ich einen Blick in die Jboss jmx-Konsole "santosh" ist nicht verfügbar.
EJBTest.java
Es enthält EJB-Remote-Interface und seine Implementierung
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");
}
}
Main
Es ist ein Client welcher Zugriff EJBTest.java durch EJBTestRemote-Schnittstelle.
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)
- wie sind Sie versuchen zu binden, Santosh ? wenn Sie über XML-bitte posten Sie die entsprechende XML-Datei , sonst, wenn durch Java, poste bitte die entsprechenden Java-code
- Vielen Dank für die Antwort von Satya. Ich Bearbeitet die Post angemessen mit code.
- versuchen Sie suchen für java:santosh
- tut mir Leid für meine Anfänger,wo man suchen muss?
Du musst angemeldet sein, um einen Kommentar abzugeben.
Meinte ich ändere diese Zeile
zu
und lassen Sie mich wissen, wenn das funktioniert
Ich das problem Gelöst,
Jboss-server fehlte ejb3-persistence.jar Datei. Nach dem hinzufügen einer EJB-Anwendung, die gut funktioniert.