Groovy에서 내 세션 빈 (Java로 작성되고 Weblogic에 배포 됨)에 대한 RMI 호출을 수행 할 수있는 코드 스 니펫을 제공 할 수 있습니까?Groovy를 사용하여 내 세션 빈에 RMI 호출
편집 한
이 내 자바 코드입니다. Groovy에서 더 쉬운 방법이 있습니까?
Properties props = new Properties();
props.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
props.put("java.naming.provider.url",”t3://127.0.0.1:7001”); // url+port format
props.put("java.naming.security.principal", “weblogic_username”));
props.put("java.naming.security.credentials", “weblogic_password”);
try
{
String simpleName = MyRemoteClass.class.getSimpleName();
String fullName = MyRemoteClass.class.getName();
String name = simpleName + "#" + fullName;
initContext = new InitialContext(props);
MyRemoteClass remoteClass = (MyRemoteClass)initContext.lookup(name);
remoteClass.doSomething();
}
catch (Throwable ex)
{
}
그것은 단지 당신이 어떤 구문 설탕 혜택을 누릴 수 있습니다, 거의 같은 것입니다. 너 뭐 해봤 니? – Will
@WillP 자바 코드를 추가했습니다. – hsalimi