Igor
Igor

Reputation: 1511

Websphere error while trying to call EJB methods on another server

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

Upvotes: 0

Views: 4487

Answers (1)

Igor
Igor

Reputation: 1511

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.

Upvotes: 0

Related Questions