- PR -

EJBクライアントアプリケーションからのEJB呼び出し

1
投稿者投稿内容
haona
会議室デビュー日: 2003/07/09
投稿数: 1
投稿日時: 2003-07-09 11:55
Cosminexus 5.5のJ2EEサーバ上で開始しているJ2EEアプリケーション中のEnterprise Beanを呼び出すEJBクライアントアプリケーションを作りたいですが,でもうまくできなかったです。

エラー内容:

javax.naming.NamingException: Unexpected CORBA Error Occurred. Root exception is org.omg.CORBA.DATA_CONVERSION: vmcid
: SUN minor code: 202 completed: No
at com.sun.corba.se.internal.corba.ORB.string_to_object(ORB.java:2024)
at com.hitachi.software.ejb.jndi.InsContext.setRootContext(InsContext.java:899)
at com.hitachi.software.ejb.jndi.InsContext.<init>(InsContext.java:175)
at com.hitachi.software.ejb.jndi.InsContextFactory.getInitialContext(InsContextFactory.java:41)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at Hello_Client.main(Hello_Client.java:45)


JbossとJ2EEサーバでやったら,うまくできました。

呼び出しソースは:

import java.util.Hashtable;
import java.util.Properties;

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

import hello.Hello;
import hello.HelloHome;

public class Hello_Client {


public static void main(java.lang.String[] args) {

Object ref = null;
InitialContext jndiContext = null;

java.util.Properties prop = new java.util.Properties();

HelloHome home;


prop.setProperty("org.omg.CORBA.ORBClass","com.inprise.vbroker.orb.ORB");
prop.setProperty("org.omg.CORBA.ORBSingletonClass","com.inprise.vbroker.orb.ORBSingleton");
prop.setProperty("javax.rmi.CORBA.UtilClass","com.hitachi.software.ejb.rmi.Util");
prop.setProperty("javax.rmi.CORBA.StubClass", "com.inprise.vbroker.rmi.CORBA.StubImpl");
prop.setProperty("javax.rmi.CORBA.PortableRemoteObjectClass","com.hitachi.software.ejb.rmi.PortableRemoteObject");
prop.setProperty("java.endorsed.dirs","C:/Program Files/Hitachi/Cosminexus/TPB/lib/endorsed");
prop.setProperty("java.naming.factory.initial","com.hitachi.software.ejb.jndi.InsContextFactory");
prop.setProperty("java.naming.factory.object", "com.hitachi.software.ejb.jndi.InsNamingFactory");
prop.setProperty("java.naming.factory.state","com.hitachi.software.ejb.jndi.InsNamingFactory");
prop.setProperty("java.naming.provider.url","iiopname://localhost:900");
prop.setProperty("ejbserver.jndi.cache","on");
prop.setProperty("ejbserver.jndi.cache.interval", "3600");
prop.setProperty("ejbserver.rmi.request.timeout","0");
prop.setProperty("ejbserver.serverName","TEST");
prop.setProperty("vbroker.agent.enableLocator","false");
prop.setProperty("vbroker.orb.dynamicLibs", "com.hitachi.software.ejb.security.base.interceptor.SimpleSecurityClientLoader");
prop.setProperty("java.security.policy", "java.security.policy==C:/Program Files/Hitachi/Cosminexus/CC/server/sysconf/cli.policy");


try {
jndiContext = new InitialContext(prop);
} catch (NamingException namingexception) {
namingexception.printStackTrace();
}

try {
ref =
jndiContext.lookup(
"HITACHI_EJB/SERVERS/TEST/EJB/hello/HelloEJB");
home =
(HelloHome) PortableRemoteObject.narrow(
ref,
HelloHome.class);
Hello _control = home.create();
} catch (NamingException namingexception) {
namingexception.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}

}

}


もし何か分かる事があったら,是非教えてください。



ken
常連さん
会議室デビュー日: 2002/04/29
投稿数: 38
投稿日時: 2003-07-09 13:08
Cosminexus は、Borland社のVisiBrokerを基盤に実装されているようですね。
初めて知りました。(^^)


閑話休題。
おそらく、new InitialContext(prop) の部分で例外が発生していると思われ
ますが、JNDIに関係する環境変数や必要なライブラリは正しく設定されていま
すでしょうか?
例えば java.naming.factory.url.pkgs という環境変数が必要なのではないで
しょうか?
1

スキルアップ/キャリアアップ(JOB@IT)