Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 尝试在另一台服务器上调用EJB方法时发生Websphere错误_Java_Websphere_Ejb 2.x - Fatal编程技术网

Java 尝试在另一台服务器上调用EJB方法时发生Websphere错误

Java 尝试在另一台服务器上调用EJB方法时发生Websphere错误,java,websphere,ejb-2.x,Java,Websphere,Ejb 2.x,我正在使用EJB2.x。我有两台机器,都在WebSphere7.0上。 在他们每个人身上都部署了不同的应用程序。当我尝试从machine1上的一个应用程序调用machine2上另一个应用程序的EJB时,出现以下错误: java.rmi.marshallexception:CORBA封送0x4942f999否;嵌套 例外情况是:org.omg.CORBA.MARSHAL:长度的概要文件数据 读取IOR配置文件vmcid:IBM次要代码:999时显示0x3F40000 已完成:否 有没有人知道如何解

我正在使用EJB2.x。我有两台机器,都在WebSphere7.0上。 在他们每个人身上都部署了不同的应用程序。当我尝试从machine1上的一个应用程序调用machine2上另一个应用程序的EJB时,出现以下错误:

java.rmi.marshallexception:CORBA封送0x4942f999否;嵌套 例外情况是:org.omg.CORBA.MARSHAL:长度的概要文件数据 读取IOR配置文件vmcid:IBM次要代码:999时显示0x3F40000 已完成:否

有没有人知道如何解决这个问题,因为我在这个问题上几乎被卡住了。 塔克斯

编辑:

对于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();...
问题是,此服务调用在远程服务器上被正确地inoked,并且响应被发送,就在客户端,我接收到以下错误:

这就是我收到的错误[SoapConnectorThreadPool:5][]错误 java.rmi.marshallexception:CORBA封送0x4942f999否;嵌套 例外情况是:org.omg.CORBA.MARSHAL:长度的概要文件数据 读取IOR配置文件vmcid:IBM次要代码:999时显示0x3F40000 已完成:没有 com.ibm.CORBA.iiop.UtilDelegateImpl.mapSystemExceptionUtilDelegateImpl.java:277 在javax.rmi.CORBA.Util.mapSystemExceptionUtil.java:84 at com.host.local.manager.\u ServiceManager\u Stub.getMethod\u ServiceManager\u Stub.java:


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

    <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>
另外,要从machine1访问machine2上的远程bean,我需要设置 C:\WINDOWS\system32\drivers\etc\hosts文件,并在列表中添加IP和远程服务器的名称 机器2


希望这些信息对其他人有用。

您如何在另一台服务器上调用EJB?您是否正在使用外部单元格绑定等?详细说明设置并提供详细日志,以便我们可以尝试帮助您。芒鲁