Monday, 15 February 2010

java - in working with ejb I have problems understanding something from the code below. it works perfect just confused about the lookup process(see code) -



java - in working with ejb I have problems understanding something from the code below. it works perfect just confused about the lookup process(see code) -

in working ejb have problems understanding code below. works perfect confused lookup process(see code)

import java.util.properties; import javax.naming.context; import javax.naming.initialcontext; import javax.naming.namingexception; import com.coolstory.thebeanremote; public class main { /** * @param args * @throws namingexception */ public static void main(string[] args) { // todo auto-generated method stub properties p= new properties(); p.put((context.provider_url) ,"t3://localhost:7001"); p.put((context.initial_context_factory),"weblogic.jndi.wlinitialcontextfactory"); seek { //create context , pass in properties contain lookup info context ctx= new initialcontext(p); thebeanremote bean= (thebeanremote)ctx.lookup("mrbean#com.coolstory.thebeanremote"); /*what pound sign function here confused */ string x= ctx.getenvironment().tostring(); system.out.println(x); bean.sayhi(); system.out.println("main.main()"+ bean.sayhi()); } grab (namingexception e) { // todo auto-generated grab block e.printstacktrace(); } }

the convention <ejb-name>#<interface-name>, # delimiter between ejb name , interface name.

java ejb-3.0 jndi

No comments:

Post a Comment