2008-11-16 5 views

답변

19

좋아요 ... 직접 발견했습니다. :)

다음은 씬 클라이언트에서 원격 EJB에 연결하는 데 사용한 코드입니다.

Hashtable env = new Hashtable(5); 
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); 
//Assuming weblogic server is running on localhost at port 7001 
env.put(Context.PROVIDER_URL, "t3://localhost:7001"); 

Context ic = new InitialContext(env); 

//obtain a reference to the home or local home interface 
FooHome fooHome = (FooHome)ic.lookup("MyBeans/FooHome"); 

//Get a reference to an object that implements the beans remote (component) interface 
Foo foo = fooHome.create(); 

//call the service exposed by the bean 
foo.shoutFoo() 

그리고 저에게 효과적이었습니다.

+7

이것이 효과가 있다면 스스로 대답을 받아 들여야합니다. –

+0

'weblogic.jndi.WLInitialContextFactory'를 사용하면 클라이언트가 일부 weblogic 라이브러리를 잡는 경우에만 EJB를 호출해야한다는 것을 의미합니다. –

+0

finally 블록의 초기 컨텍스트를 닫아야합니다. – mnp

관련 문제