Wo ist der JNDI-name in meinem code?
Habe ich einen EJB2.0 mit Eclipse 3.7 IDE, und implementiert es in der JBoss 5 application server (mein bean-name-Produkt). Ich mache das normale Kontext-lookup (und andere Sachen zu nennen, ejb), und ich bin in der Lage zu nennen, EJB erfolgreich. Nun ist meine Frage, was ist der JNDI-name, genau, und wo wurde es verwendet. Ist mein bean name der JNDI-name, oder ist dies mein JNDI-Namen -> org.jnp.interfaces.NamingContextFactory
. Wo ist der JNDI-name?????
mein code:-
//initial code.............
Context ctx = getContext();
Object obj=ctx.lookup("Product");
ProductHome home =(ProductHome) javax.rmi.PortableRemoteObject.narrow(obj,ProductHome.class);
ProductRemote remote=home.create();
Product prd = new rohit.Product("PRDCamera",001,50.50) ;
remote.addProduct(prd);
remote.updateProduct(prd);
remote.removeProduct(001);
remote.findProduct(001);
remote.findAllProduct();
//getContext Method
public static InitialContext getContext() throws Exception{
Properties pro = new Properties();
pro.put(javax.naming.InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
pro.put(javax.naming.InitialContext.PROVIDER_URL,"localhost:1099");
return new InitialContext(pro);
}
InformationsquelleAutor Rohit Elayathu | 2012-03-16
Du musst angemeldet sein, um einen Kommentar abzugeben.
Gibt es keine JNDI-Namen in Ihrem code.
Dies ist, wie Sie sehen EJBs im EJB 2.0:
Den JNDI-Namen ist
java:comp/env/com/mycorp/MyEJB
in diesem Fall.In der viel gesünderen EJB 3.0, tun Sie nur
und tun, Weg mit den schrecklichen home interface Idee.
Nein, das JNDI-name ist standardisiert, es ist java:comp/env/com/mycorp/MyEJB für eine EJB-Klasse Kom.mycorp.MyEJB standardmäßig. Die Implementierung der Klasse der initial context factory, jedoch ist proprietär.
Dies ist, wie der code ist in der Datei die ich mich beziehe
public final static String JNDI_NAME="myproj/Status"; public final static String EJB_NAME="myprojStatus";
Hier Status ist eine Schnittstelle, und sollte ich erstelle ein Verzeichnis mit dem Namen myproj Ort und Status-Schnittstelle. Ist die JNDI_NAME ein Pfad???InformationsquelleAutor Ingo Kegel