0

我正在使用EJB 2.x。我有 2 台机器,它们都在WebSphere 7.0上。他们每个人都部署了不同的应用程序。当我尝试从一个应用程序(在 machine1 上)调用另一个应用程序(在 machine2 上)的 EJB 时,我收到以下错误:

java.rmi.MarshalException:CORBA MARSHAL 0x4942f999 否;嵌套异常是:org.omg.CORBA.MARSHAL:读取 IOR 配置文件 vmcid 时长度为 0x3f400000 的配置文件数据:IBM 次要代码:999 已完成:否

有谁知道如何解决这个问题,因为我几乎被困在这个问题上。谢谢!

编辑

对于 EJB 调用,我使用了常用方法:

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(Context.PROVIDER_URL, "iiop://remote.host.com:2809");
props.put(Context.SECURITY_PRINCIPAL, "remote_user");
props.put(Context.SECURITY_CREDENTIALS, "remote_pwd");
Context ctx = new InitialContext(props);
Object objRef = ctx.lookup("servicemanagerJndiName");
ServiceManagerHome home = (ServiceManagerHome) PortableRemoteObject.narrow(
        objRef, ServiceManagerHome.class);
manager = home.create();
manager.getMethod();...

问题是该服务调用在远程服务器上正确调用,并且响应已发送,就在客户端,我收到以下错误:

这是我收到的错误 [SoapConnectorThreadPool : 5] [] ERROR java.rmi.MarshalException: CORBA MARSHAL 0x4942f999 No; 嵌套异常是:org.omg.CORBA.MARSHAL:读取 IOR 配置文件 vmcid 时长度为 0x3f400000 的配置文件数据:IBM 次要代码:999 已完成:com.ibm.CORBA.iiop.UtilDelegateImpl.mapSystemException(UtilDelegateImpl.java:277)中的否在 com.host.local.manager._ServiceManager_Stub.getMethod(_ServiceManager_Stub.java) 的 javax.rmi.CORBA.Util.mapSystemException(Util.java:84):

4

1 回答 1

0

我已经成功解决了这个问题。保存ServiceManager(远程接口)和ServiceManagerHome (主接口)的外部 jar已被替换为内部也包含存根的 jar 文件。存根是使用com.ibm.websphere.ant.tasks.WsEjbDeploy ant任务创建的。你的蚂蚁应该看起来像这样:

    <taskdef name="wsejbdeploy" classname="com.ibm.websphere.ant.tasks.WsEjbDeploy>
        <classpath refid="your.websphere.classpath"/>
    </taskdef>
    <target name="packEjbJar">
        <jar destfile="pre-deploy-ejb.jar">
            <metainf dir="src" includes="ejb-jar.xml" />
            <metainf dir="src" includes="ibm-ejb-jar-bnd.xmi" />

            <fileset dir="your.build.classes.location">
                <include name="com/yourapp/ejb/**/*.*" />
            </fileset>
        </jar>
        <wsejbdeploy inputJar="pre-deploy-ejb.jar"
                            wasHome="your.websphere.home"
                            workingDirectory="dist"
                            outputJar="ejb.jar"
                            codegen="false"
                            keepGenerated="false"
                            quiet="false"
                            noValidate="true"
                            noWarnings="false"
                            noInform="false"
                            failonerror="true"
                            trace="true"
                            classpathref="your.classpath" />
    </target>

在此之后,存根将被打包在ejb.jar中。使用这个新 jar 重新部署后,我的应用程序工作得很好。注意您需要填充ibm-ejb-jar-bnd.xmi才能创建存根。这是此文件的示例内容:

<ejbbnd:EJBJarBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ejbbnd="ejbbnd.xmi" xmlns:ejb="ejb.xmi" xmi:id="ejb-jar_ID_Bnd">
  <ejbJar href="META-INF/ejb-jar.xml#ejb-jar_ID"/>
  <ejbBindings xmi:id="Session_ServiceManager_Bnd" jndiName="com.host.local.manager.ServiceManager">
    <enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml#Session_ServiceManager"/>
  </ejbBindings>
</ejbbnd:EJBJarBinding>

PS 另外,要从machine1访问远程 bean(在machine2 上),我需要设置 C:\WINDOWS\system32\drivers\etc\hosts文件,并添加列表 IP 和远程 machine2 的名称

希望这些信息对某人有用。

于 2011-08-09T14:18:10.210 回答