1
Netbean 플랫폼 응용 프로그램 모듈에서 ejb 클라이언트를 만들고 Glassfish에 배포 된 ejb를 호출하려고합니다.netbeans 플랫폼 응용 프로그램 모듈의 ejb 클라이언트
내 ejb 서버 응용 프로그램에서 필요한 모든 jar 파일을 추가했으며 glashfish jars가 필요합니다. appserv-rt.jar, javaee.jar, gf-client.jar.
독립 실행 형 Java 응용 프로그램에서 호출 할 때 다음 코드가 제대로 작동하지만 netbeans platfrom 응용 프로그램 모듈에서 호출하려고 할 때 인스턴트 메시지를 가져올 수 없습니다.
넷빈 플랫폼 특정 구성이 필요합니까?
try {
Properties props = new Properties();
props.setProperty("java.naming.factory.initial",
"com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state",
"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl"
);
props.setProperty("org.omg.CORBA.ORBInitialHost", "127.0.0.1");
props.setProperty("org.omg.CORBA.ORBInitialPort","3700");
InitialContext ctx = new InitialContext (props);
MySessionBeanRemote mySessionBean=
(MySessionBeanRemote)ctx
.lookup("sessions.MySessionBeanRemote");
Userprofile user = new Userprofile();
user.setActive('A');
user.setDescription("some desc");
user.setEmail("abc");
user.setFirstname("xyz");
user.setLastname("123");
user.setPassword("pwd");
user.setStatus("Enabled");
user.setUserid(Long.valueOf(25));
user.setUsername("abc");
mySessionBean.persist(user);
} catch (javax.naming.NamingException ne) {
ne.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}