尝试调用另一台服务器上的 EJB 方法时出现 Websphere 错误

发布于 2024-11-28 17:34:59 字数 1569 浏览 4 评论 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 否;嵌套的 例外是:org.omg.CORBA.MARSHAL:长度的配置文件数据 读取 IOR 配置文件 vmcid 时出现 0x3f400000:IBM 次要代码:999 已完成: 否于 com.ibm.CORBA.iiop.UtilDelegateImpl.mapSystemException(UtilDelegateImpl.java:277) 在 javax.rmi.CORBA.Util.mapSystemException(Util.java:84) 处 com.host.local.manager._ServiceManager_Stub.getMethod(_ServiceManager_Stub.java):

I'm using EJB 2.x. I have 2 machines, both of them on WebSphere 7.0.
On each of them deployed different application. When I try from one application (on machine1) to call the EJB of the other application (on machine2), I am getting the following error:

java.rmi.MarshalException: CORBA MARSHAL 0x4942f999 No; nested
exception is: org.omg.CORBA.MARSHAL: Profile data of length
0x3f400000 while reading IOR Profile vmcid: IBM minor code: 999
completed: No

Does anyone have idea how to solve this problem, cause I'm pretty much stuck on this issue.
Thanx!

Edit:

For EJB call I used common approach:

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();...

The thing is that this service call correctly inoked on remote server, and the response is sent, just on the client side, I am receiving following error:

And this is the error I receive[SoapConnectorThreadPool : 5] [] ERROR
java.rmi.MarshalException: CORBA MARSHAL 0x4942f999 No; nested
exception is: org.omg.CORBA.MARSHAL: Profile data of length
0x3f400000 while reading IOR Profile vmcid: IBM minor code: 999
completed: No at
com.ibm.CORBA.iiop.UtilDelegateImpl.mapSystemException(UtilDelegateImpl.java:277)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:84) at
com.host.local.manager._ServiceManager_Stub.getMethod(_ServiceManager_Stub.java):

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

治碍 2024-12-05 17:34:59

我已经成功解决了这个问题。
外部 jar 其中 ServiceManager (远程接口) & ServiceManagerHome(主界面)被保存,已被替换为内部也包含Stubs的jar文件。这些存根是使用 com.ibm.websphere.ant.tasks.WsEjbDeploy ant 任务创建的。您的 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 此外,要从 ma​​chine1 访问远程 bean(在 ma​​chine2 上),我需要设置
C:\WINDOWS\system32\drivers\etc\hosts文件,并在列表中添加远程IP和名称
machine2

希望此信息对某人有用。

I have successfully solved the problem.
The external jar where ServiceManager (remote interface) & ServiceManagerHome (home interface) were held, has been substituted with the jar file also containing Stubs inside. The stubs were created using the com.ibm.websphere.ant.tasks.WsEjbDeploy ant task. Your ant should look somehting like this:

    <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>

After this, stubs will be packaged in ejb.jar. After redeploying with this new jar my application works just fine. Note You will need to populate ibm-ejb-jar-bnd.xmi in order for stubs to be created. Here is the example content of this file:

<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>

P.S. Also, to access remote beans (on machine2) from machine1 I needed to set
C:\WINDOWS\system32\drivers\etc\hosts file, and add in the list IP and the name of remote
machine2

Hope this info is going to be useful for somebody.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文