rmi to EJB2 / weblogic container

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

rmi to EJB2 / weblogic container

Matthew Shaw

Hi All,

 

I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6.

 

The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:

 

Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906

 

The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:

 

@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

   
public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
   
public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

   
public String mediate(Integer eTimesheetId) {

        Hashtable env =
new Hashtable();
        env.put(Context.
INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.
PROVIDER_URL, "t3://poldesaps02:5013");
        env.put(Context.
SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.
SECURITY_CREDENTIALS, "passw0rd");

        Context ic =
null;
       
try {
            ic =
new InitialContext(env);
           
return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }
catch (NamingException e) {
           
throw new RuntimeException(e);
        }



    }



   
public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject =
null;

       
try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.
JNDI_NAME);
        }
catch (NamingException e) {
           
throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.
class);

        TimesheetSessionFacade remote =
null;
       
try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.
class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        }
catch (ClassCastException e) {
            
throw new RuntimeException(e);
        }
catch (RemoteException e) {
           
throw new RuntimeException(e);
        }
catch (CreateException e) {
           
throw new RuntimeException(e);
        }
catch (AFTimesheetException e) {
           
throw new RuntimeException(e);
        }
    }

 

 

Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:

 

org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No

 

The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.

 

I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle.

 

The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.

 

One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?

 

Regards,

Matt.

 

 

 

 

 

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: rmi to EJB2 / weblogic container

David Jencks-2
Its a bit difficult to tell, and I’ve never used weblogic, but your setup might end up using the JRE orb rather than a working orb.  Generally the JRE orb doesn’t work at all for EJBs.  

In any case, I think the error indicates that one side or the other cannot find the CORBA description of the exception class so the exception can’t be either serialized or deserialized.  I suspect this functionality is not implemented in the client orb; generally orbs only implement functionality someone with a lot of clout actually needs, leaving vast swathes of spec behavior missing.

Replacing the ORB with e.g. the unreleased trunk Yoko orb which does work for EJBS, at least for IBM Websphere Liberty, is quite difficult.  I thought WebLogic had a proprietary transport not using CORBA.  Is there any chance you can use that?

good luck,

David Jencks

On Jul 24, 2017, at 5:02 PM, Matthew Shaw <[hidden email]> wrote:

Hi All,
 
I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6. 
 
The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:
 
Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906
 
The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:
 
@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

   
public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
   
public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

   
public String mediate(Integer eTimesheetId) {

        Hashtable env =
new Hashtable();
        env.put(Context.
INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.
PROVIDER_URL, "<a href="t3://poldesaps02:5013" style="color: rgb(149, 79, 114); text-decoration: underline;" class="">t3://poldesaps02:5013");
        env.put(Context.
SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.
SECURITY_CREDENTIALS, "passw0rd");

        Context ic =
null;
       
try {
            ic =
new InitialContext(env);
           
return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }
catch (NamingException e) {
           
throw new RuntimeException(e);
        }



    }



   
public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject =
null;

       
try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.
JNDI_NAME);
        }
catch (NamingException e) {
           
throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.
class);

        TimesheetSessionFacade remote =
null;
       
try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.
class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        }
catch (ClassCastException e) {
            
throw new RuntimeException(e);
        }
catch (RemoteException e) {
           
throw new RuntimeException(e);
        }
catch (CreateException e) {
           
throw new RuntimeException(e);
        }
catch (AFTimesheetException e) {
           
throw new RuntimeException(e);
        }
    }
 
 
Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:
 
org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No
 
The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.
 
I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle. 
 
The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.
 
One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?
 
Regards,
Matt.
 
 
 
 
 
 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: rmi to EJB2 / weblogic container

Matthew Shaw

Thanks David, you might be onto something there. Just taking a quick look at the weblogic docs and there is the t3 protocol, which uses IIOP and RMI, which I think is what you may be referring to. I’ll give that a go.

 

From: David Jencks [mailto:[hidden email]]
Sent: Tuesday, 25 July 2017 11:13 AM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

Its a bit difficult to tell, and I’ve never used weblogic, but your setup might end up using the JRE orb rather than a working orb.  Generally the JRE orb doesn’t work at all for EJBs.  

 

In any case, I think the error indicates that one side or the other cannot find the CORBA description of the exception class so the exception can’t be either serialized or deserialized.  I suspect this functionality is not implemented in the client orb; generally orbs only implement functionality someone with a lot of clout actually needs, leaving vast swathes of spec behavior missing.

 

Replacing the ORB with e.g. the unreleased trunk Yoko orb which does work for EJBS, at least for IBM Websphere Liberty, is quite difficult.  I thought WebLogic had a proprietary transport not using CORBA.  Is there any chance you can use that?

 

good luck,

 

David Jencks

 

On Jul 24, 2017, at 5:02 PM, Matthew Shaw <[hidden email]> wrote:

 

Hi All,

 

I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6. 

 

The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:

 

Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906

 

The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:

 

@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

    public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
    public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

    public String mediate(Integer eTimesheetId) {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "<a href="t3://poldesaps02:5013">t3://poldesaps02:5013");
        env.put(Context.SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.SECURITY_CREDENTIALS, "passw0rd");

        Context ic = null;
        try {
            ic = new InitialContext(env);
            return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }catch (NamingException e) {
            throw new RuntimeException(e);
        }



    }



    public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject = null;

        try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.JNDI_NAME);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.class);

        TimesheetSessionFacade remote = null;
        try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        } catch (ClassCastException e) {
            throw new RuntimeException(e);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        } catch (CreateException e) {
            throw new RuntimeException(e);
        }catch (AFTimesheetException e) {
            throw new RuntimeException(e);
        }
    }

 

 

Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:

 

org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No

 

The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.

 

I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle. 

 

The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.

 

One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?

 

Regards,

Matt.

 

 

 

 

 

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: rmi to EJB2 / weblogic container

David Jencks-2
On a slightly less pessimistic note, if I were you I’d try to get your code (suitably modified) running in a plain JRE to try to distinguish between an ORB problem and a OSGI problem.

From my position of complete ignorance I thought t3 didn’t use IIOP…. if that is it’s only choice then it may be what the web logic client library is already using.  Does the client library include an orb?

more good luck :-)

david jencks

On Jul 24, 2017, at 6:24 PM, Matthew Shaw <[hidden email]> wrote:

Thanks David, you might be onto something there. Just taking a quick look at the weblogic docs and there is the t3 protocol, which uses IIOP and RMI, which I think is what you may be referring to. I’ll give that a go.
 
From: David Jencks [[hidden email]] 
Sent: Tuesday, 25 July 2017 11:13 AM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container
 
Its a bit difficult to tell, and I’ve never used weblogic, but your setup might end up using the JRE orb rather than a working orb.  Generally the JRE orb doesn’t work at all for EJBs.  
 
In any case, I think the error indicates that one side or the other cannot find the CORBA description of the exception class so the exception can’t be either serialized or deserialized.  I suspect this functionality is not implemented in the client orb; generally orbs only implement functionality someone with a lot of clout actually needs, leaving vast swathes of spec behavior missing.
 
Replacing the ORB with e.g. the unreleased trunk Yoko orb which does work for EJBS, at least for IBM Websphere Liberty, is quite difficult.  I thought WebLogic had a proprietary transport not using CORBA.  Is there any chance you can use that?
 
good luck,
 
David Jencks
 
On Jul 24, 2017, at 5:02 PM, Matthew Shaw <[hidden email]> wrote:
 
Hi All,
 
I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6. 
 
The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:
 
Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906
 
The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:
 
@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

    public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
    public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

    public String mediate(Integer eTimesheetId) {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "<a href="t3://poldesaps02:5013" style="color: purple; text-decoration: underline;" class="">t3://poldesaps02:5013");
        env.put(Context.SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.SECURITY_CREDENTIALS, "passw0rd");

        Context ic = null;
        try {
            ic = new InitialContext(env);
            return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }catch (NamingException e) {
            throw new RuntimeException(e);
        }



    }



    public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject = null;

        try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.JNDI_NAME);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.class);

        TimesheetSessionFacade remote = null;
        try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        } catch (ClassCastException e) {
            throw new RuntimeException(e);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        } catch (CreateException e) {
            throw new RuntimeException(e);
        }catch (AFTimesheetException e) {
            throw new RuntimeException(e);
        }
    }
 
 
Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:
 
org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No
 
The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.
 
I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle. 
 
The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.
 
One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?
 
Regards,
Matt.
 
 
 
 
 
 
This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.
Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.
If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.
If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.
Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.
Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.
********************************************************************************
The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.
 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: rmi to EJB2 / weblogic container

Matthew Shaw

I’ve re-configured my client to use t3, which requires the wlfullclient.jar (54MB) on client classpath now. Re.IIOP David you’re right it is not t3 related.

 

Anyhow, I’m now getting the following error:

Root exception is java.net.ConnectException: t3://10.47.20.11:5013: Bootstrap to poldesaps02.desqld.internal/10.47.20.11:5013 failed. It is likely that the remote side declared peer gone on this JVM]

 

Which is even more confusing because the weblogic server is definitely listening on that address and port, having checked the console and connected to it via other means. Yikes!

 

From: David Jencks [mailto:[hidden email]]
Sent: Tuesday, 25 July 2017 12:24 PM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

On a slightly less pessimistic note, if I were you I’d try to get your code (suitably modified) running in a plain JRE to try to distinguish between an ORB problem and a OSGI problem.

 

From my position of complete ignorance I thought t3 didn’t use IIOP…. if that is it’s only choice then it may be what the web logic client library is already using.  Does the client library include an orb?

 

more good luck :-)

 

david jencks

 

On Jul 24, 2017, at 6:24 PM, Matthew Shaw <[hidden email]> wrote:

 

Thanks David, you might be onto something there. Just taking a quick look at the weblogic docs and there is the t3 protocol, which uses IIOP and RMI, which I think is what you may be referring to. I’ll give that a go.

 

From: David Jencks [[hidden email]] 
Sent: Tuesday, 25 July 2017 11:13 AM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

Its a bit difficult to tell, and I’ve never used weblogic, but your setup might end up using the JRE orb rather than a working orb.  Generally the JRE orb doesn’t work at all for EJBs.  

 

In any case, I think the error indicates that one side or the other cannot find the CORBA description of the exception class so the exception can’t be either serialized or deserialized.  I suspect this functionality is not implemented in the client orb; generally orbs only implement functionality someone with a lot of clout actually needs, leaving vast swathes of spec behavior missing.

 

Replacing the ORB with e.g. the unreleased trunk Yoko orb which does work for EJBS, at least for IBM Websphere Liberty, is quite difficult.  I thought WebLogic had a proprietary transport not using CORBA.  Is there any chance you can use that?

 

good luck,

 

David Jencks

 

On Jul 24, 2017, at 5:02 PM, Matthew Shaw <[hidden email]> wrote:

 

Hi All,

 

I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6. 

 

The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:

 

Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906

 

The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:

 

@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

    public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
    public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

    public String mediate(Integer eTimesheetId) {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "<a href="t3://poldesaps02:5013">t3://poldesaps02:5013");
        env.put(Context.SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.SECURITY_CREDENTIALS, "passw0rd");

        Context ic = null;
        try {
            ic = new InitialContext(env);
            return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }catch (NamingException e) {
            throw new RuntimeException(e);
        }



    }



    public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject = null;

        try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.JNDI_NAME);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.class);

        TimesheetSessionFacade remote = null;
        try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        } catch (ClassCastException e) {
            throw new RuntimeException(e);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        } catch (CreateException e) {
            throw new RuntimeException(e);
        }catch (AFTimesheetException e) {
            throw new RuntimeException(e);
        }
    }

 

 

Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:

 

org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No

 

The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.

 

I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle. 

 

The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.

 

One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?

 

Regards,

Matt.

 

 

 

 

 

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: rmi to EJB2 / weblogic container

Matthew Shaw

I might also add that establishing a connection through non osgi runtime works. So it’s definitely osgi/felix/karaf related I think. There seems to be a few people on google with the same issue but no solution.

 

From: Matthew Shaw [mailto:[hidden email]]
Sent: Tuesday, 25 July 2017 1:49 PM
To: [hidden email]
Subject: RE: rmi to EJB2 / weblogic container

 

I’ve re-configured my client to use t3, which requires the wlfullclient.jar (54MB) on client classpath now. Re.IIOP David you’re right it is not t3 related.

 

Anyhow, I’m now getting the following error:

Root exception is java.net.ConnectException: t3://10.47.20.11:5013: Bootstrap to poldesaps02.desqld.internal/10.47.20.11:5013 failed. It is likely that the remote side declared peer gone on this JVM]

 

Which is even more confusing because the weblogic server is definitely listening on that address and port, having checked the console and connected to it via other means. Yikes!

 

From: David Jencks [[hidden email]]
Sent: Tuesday, 25 July 2017 12:24 PM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

On a slightly less pessimistic note, if I were you I’d try to get your code (suitably modified) running in a plain JRE to try to distinguish between an ORB problem and a OSGI problem.

 

From my position of complete ignorance I thought t3 didn’t use IIOP…. if that is it’s only choice then it may be what the web logic client library is already using.  Does the client library include an orb?

 

more good luck :-)

 

david jencks

 

On Jul 24, 2017, at 6:24 PM, Matthew Shaw <[hidden email]> wrote:

 

Thanks David, you might be onto something there. Just taking a quick look at the weblogic docs and there is the t3 protocol, which uses IIOP and RMI, which I think is what you may be referring to. I’ll give that a go.

 

From: David Jencks [[hidden email]] 
Sent: Tuesday, 25 July 2017 11:13 AM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

Its a bit difficult to tell, and I’ve never used weblogic, but your setup might end up using the JRE orb rather than a working orb.  Generally the JRE orb doesn’t work at all for EJBs.  

 

In any case, I think the error indicates that one side or the other cannot find the CORBA description of the exception class so the exception can’t be either serialized or deserialized.  I suspect this functionality is not implemented in the client orb; generally orbs only implement functionality someone with a lot of clout actually needs, leaving vast swathes of spec behavior missing.

 

Replacing the ORB with e.g. the unreleased trunk Yoko orb which does work for EJBS, at least for IBM Websphere Liberty, is quite difficult.  I thought WebLogic had a proprietary transport not using CORBA.  Is there any chance you can use that?

 

good luck,

 

David Jencks

 

On Jul 24, 2017, at 5:02 PM, Matthew Shaw <[hidden email]> wrote:

 

Hi All,

 

I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6. 

 

The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:

 

Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906

 

The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:

 

@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

    public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
    public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

    public String mediate(Integer eTimesheetId) {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "<a href="t3://poldesaps02:5013">t3://poldesaps02:5013");
        env.put(Context.SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.SECURITY_CREDENTIALS, "passw0rd");

        Context ic = null;
        try {
            ic = new InitialContext(env);
            return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }catch (NamingException e) {
            throw new RuntimeException(e);
        }



    }



    public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject = null;

        try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.JNDI_NAME);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.class);

        TimesheetSessionFacade remote = null;
        try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        } catch (ClassCastException e) {
            throw new RuntimeException(e);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        } catch (CreateException e) {
            throw new RuntimeException(e);
        }catch (AFTimesheetException e) {
            throw new RuntimeException(e);
        }
    }

 

 

Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:

 

org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No

 

The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.

 

I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle. 

 

The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.

 

One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?

 

Regards,

Matt.

 

 

 

 

 

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: rmi to EJB2 / weblogic container

Jens J Parappallil

Hi Mathew,

 

I had done an integration with weblogic jms from karaf, the application consumed messages from the weblogic jms server . I had encountered class encountered class cast exception and such and finally got it working. I created a bundle which registered a CamelJmsComponent into the OSGi service registry which was used by other bundles in thie camel routes. I think you can use similar patterns for the weblogic EJB lookups etc.

 

This is how I made it work,

 

Bundle : weblogic-connector

I embedded wlthint3client.jar inside this bundle.

 

Pom.xml snippet

<plugin>

                           <groupId>org.apache.felix</groupId>

                           <artifactId>maven-bundle-plugin</artifactId>

                           <configuration>

                                  <instructions>

                                       

                                        <Private-Package>com.x.z.connector.weblogic.*</Private-Package>

                                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>

                                        <Bundle-Version>${project.version}</Bundle-Version>

                                         <!—I had to consume object messages so the packages of those classes are added in dynamic imports à

                                        <DynamicImport-Package> com.x.z.clinet.*,com.a.b.*</DynamicImport-Package>

                                         <!—This is a non osgi jar which is embedded inside this bundle ( the connector bundle ) à

                                        <Bundle-ClassPath>.,lib/wlthint3client.jar</Bundle-ClassPath>

                                        <Import-Package>

                                               org.slf4j.*;version="${slf4j.version-range}";provider=paxlogging,

                                               org.springframework.*;version="${spring.version-range}",

                                               org.apache.camel.*;version="${camel.version-range}",

                                               javax.jms;version="[1.1,3)",

                                               *;resolution:=optional

                                               </Import-Package>

                                  </instructions>

                           </configuration>

                    </plugin>

 

The connector bundle had do initial context lookups etc, I used spring jms for this purpose. To get it working I found that weblogic used ContextClassLoader internally.

 

WeblogicJndiTemplate (@See how the context classloader is swapped before doing the lookup operations)

 

  protected Context createInitialContext()

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      Context context = super.createInitialContext();

      return context;

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

 

  public Object lookup(String name)

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      return super.lookup(name);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

 

  public <T> T lookup(String name, Class<T> requiredType)

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      return (T)super.lookup(name, requiredType);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

}

 

Similarly inside the ConnectionFactory implementation

 

 

  protected Session createSession(Connection con, Integer mode)

    throws JMSException

  {

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(this.bundleClassLoader);

      return super.createSession(con, mode);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

}

 

 

From: Matthew Shaw [mailto:[hidden email]]
Sent: Tuesday, July 25, 2017 7:08 AM
To: [hidden email]
Subject: [External] RE: rmi to EJB2 / weblogic container

 

I might also add that establishing a connection through non osgi runtime works. So it’s definitely osgi/felix/karaf related I think. There seems to be a few people on google with the same issue but no solution.

 

From: Matthew Shaw [[hidden email]]
Sent: Tuesday, 25 July 2017 1:49 PM
To: [hidden email]
Subject: RE: rmi to EJB2 / weblogic container

 

I’ve re-configured my client to use t3, which requires the wlfullclient.jar (54MB) on client classpath now. Re.IIOP David you’re right it is not t3 related.

 

Anyhow, I’m now getting the following error:

Root exception is java.net.ConnectException: t3://10.47.20.11:5013: Bootstrap to poldesaps02.desqld.internal/10.47.20.11:5013 failed. It is likely that the remote side declared peer gone on this JVM]

 

Which is even more confusing because the weblogic server is definitely listening on that address and port, having checked the console and connected to it via other means. Yikes!

 

From: David Jencks [[hidden email]]
Sent: Tuesday, 25 July 2017 12:24 PM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

On a slightly less pessimistic note, if I were you I’d try to get your code (suitably modified) running in a plain JRE to try to distinguish between an ORB problem and a OSGI problem.

 

From my position of complete ignorance I thought t3 didn’t use IIOP…. if that is it’s only choice then it may be what the web logic client library is already using.  Does the client library include an orb?

 

more good luck :-)

 

david jencks

 

On Jul 24, 2017, at 6:24 PM, Matthew Shaw <[hidden email]> wrote:

 

Thanks David, you might be onto something there. Just taking a quick look at the weblogic docs and there is the t3 protocol, which uses IIOP and RMI, which I think is what you may be referring to. I’ll give that a go.

 

From: David Jencks [[hidden email]] 
Sent: Tuesday, 25 July 2017 11:13 AM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

Its a bit difficult to tell, and I’ve never used weblogic, but your setup might end up using the JRE orb rather than a working orb.  Generally the JRE orb doesn’t work at all for EJBs.  

 

In any case, I think the error indicates that one side or the other cannot find the CORBA description of the exception class so the exception can’t be either serialized or deserialized.  I suspect this functionality is not implemented in the client orb; generally orbs only implement functionality someone with a lot of clout actually needs, leaving vast swathes of spec behavior missing.

 

Replacing the ORB with e.g. the unreleased trunk Yoko orb which does work for EJBS, at least for IBM Websphere Liberty, is quite difficult.  I thought WebLogic had a proprietary transport not using CORBA.  Is there any chance you can use that?

 

good luck,

 

David Jencks

 

On Jul 24, 2017, at 5:02 PM, Matthew Shaw <[hidden email]> wrote:

 

Hi All,

 

I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6. 

 

The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:

 

Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906

 

The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:

 

@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

    public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
    public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

    public String mediate(Integer eTimesheetId) {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "<a href="t3://poldesaps02:5013">t3://poldesaps02:5013");
        env.put(Context.SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.SECURITY_CREDENTIALS, "passw0rd");

        Context ic = null;
        try {
            ic = new InitialContext(env);
            return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }catch (NamingException e) {
            throw new RuntimeException(e);
        }



    }



    public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject = null;

        try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.JNDI_NAME);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.class);

        TimesheetSessionFacade remote = null;
        try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        } catch (ClassCastException e) {
            throw new RuntimeException(e);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        } catch (CreateException e) {
            throw new RuntimeException(e);
        }catch (AFTimesheetException e) {
            throw new RuntimeException(e);
        }
    }

 

 

Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:

 

org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No

 

The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.

 

I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle. 

 

The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.

 

One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?

 

Regards,

Matt.

 

 

 

 

 

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.



DISCLAIMER: "The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: rmi to EJB2 / weblogic container

Matthew Shaw

Thanks a lot Jens, yes I also suspected weblogic was using the thread classloader, I’ll try adding what the spring template is doing in terms of setting it below and report back.

 

From: Jens J Parappallil [mailto:[hidden email]]
Sent: Tuesday, 25 July 2017 10:35 PM
To: [hidden email]
Subject: RE: rmi to EJB2 / weblogic container

 

Hi Mathew,

 

I had done an integration with weblogic jms from karaf, the application consumed messages from the weblogic jms server . I had encountered class encountered class cast exception and such and finally got it working. I created a bundle which registered a CamelJmsComponent into the OSGi service registry which was used by other bundles in thie camel routes. I think you can use similar patterns for the weblogic EJB lookups etc.

 

This is how I made it work,

 

Bundle : weblogic-connector

I embedded wlthint3client.jar inside this bundle.

 

Pom.xml snippet

<plugin>

                           <groupId>org.apache.felix</groupId>

                           <artifactId>maven-bundle-plugin</artifactId>

                           <configuration>

                                  <instructions>

                                       

                                        <Private-Package>com.x.z.connector.weblogic.*</Private-Package>

                                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>

                                        <Bundle-Version>${project.version}</Bundle-Version>

                                         <!—I had to consume object messages so the packages of those classes are added in dynamic imports à

                                        <DynamicImport-Package> com.x.z.clinet.*,com.a.b.*</DynamicImport-Package>

                                         <!—This is a non osgi jar which is embedded inside this bundle ( the connector bundle ) à

                                        <Bundle-ClassPath>.,lib/wlthint3client.jar</Bundle-ClassPath>

                                        <Import-Package>

                                               org.slf4j.*;version="${slf4j.version-range}";provider=paxlogging,

                                               org.springframework.*;version="${spring.version-range}",

                                               org.apache.camel.*;version="${camel.version-range}",

                                               javax.jms;version="[1.1,3)",

                                               *;resolution:=optional

                                               </Import-Package>

                                  </instructions>

                           </configuration>

                    </plugin>

 

The connector bundle had do initial context lookups etc, I used spring jms for this purpose. To get it working I found that weblogic used ContextClassLoader internally.

 

WeblogicJndiTemplate (@See how the context classloader is swapped before doing the lookup operations)

 

  protected Context createInitialContext()

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      Context context = super.createInitialContext();

      return context;

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

 

  public Object lookup(String name)

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      return super.lookup(name);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

 

  public <T> T lookup(String name, Class<T> requiredType)

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      return (T)super.lookup(name, requiredType);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

}

 

Similarly inside the ConnectionFactory implementation

 

 

  protected Session createSession(Connection con, Integer mode)

    throws JMSException

  {

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(this.bundleClassLoader);

      return super.createSession(con, mode);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

}

 

 

From: Matthew Shaw [[hidden email]]
Sent: Tuesday, July 25, 2017 7:08 AM
To: [hidden email]
Subject: [External] RE: rmi to EJB2 / weblogic container

 

I might also add that establishing a connection through non osgi runtime works. So it’s definitely osgi/felix/karaf related I think. There seems to be a few people on google with the same issue but no solution.

 

From: Matthew Shaw [[hidden email]]
Sent: Tuesday, 25 July 2017 1:49 PM
To: [hidden email]
Subject: RE: rmi to EJB2 / weblogic container

 

I’ve re-configured my client to use t3, which requires the wlfullclient.jar (54MB) on client classpath now. Re.IIOP David you’re right it is not t3 related.

 

Anyhow, I’m now getting the following error:

Root exception is java.net.ConnectException: t3://10.47.20.11:5013: Bootstrap to poldesaps02.desqld.internal/10.47.20.11:5013 failed. It is likely that the remote side declared peer gone on this JVM]

 

Which is even more confusing because the weblogic server is definitely listening on that address and port, having checked the console and connected to it via other means. Yikes!

 

From: David Jencks [[hidden email]]
Sent: Tuesday, 25 July 2017 12:24 PM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

On a slightly less pessimistic note, if I were you I’d try to get your code (suitably modified) running in a plain JRE to try to distinguish between an ORB problem and a OSGI problem.

 

From my position of complete ignorance I thought t3 didn’t use IIOP…. if that is it’s only choice then it may be what the web logic client library is already using.  Does the client library include an orb?

 

more good luck :-)

 

david jencks

 

On Jul 24, 2017, at 6:24 PM, Matthew Shaw <[hidden email]> wrote:

 

Thanks David, you might be onto something there. Just taking a quick look at the weblogic docs and there is the t3 protocol, which uses IIOP and RMI, which I think is what you may be referring to. I’ll give that a go.

 

From: David Jencks [[hidden email]] 
Sent: Tuesday, 25 July 2017 11:13 AM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

Its a bit difficult to tell, and I’ve never used weblogic, but your setup might end up using the JRE orb rather than a working orb.  Generally the JRE orb doesn’t work at all for EJBs.  

 

In any case, I think the error indicates that one side or the other cannot find the CORBA description of the exception class so the exception can’t be either serialized or deserialized.  I suspect this functionality is not implemented in the client orb; generally orbs only implement functionality someone with a lot of clout actually needs, leaving vast swathes of spec behavior missing.

 

Replacing the ORB with e.g. the unreleased trunk Yoko orb which does work for EJBS, at least for IBM Websphere Liberty, is quite difficult.  I thought WebLogic had a proprietary transport not using CORBA.  Is there any chance you can use that?

 

good luck,

 

David Jencks

 

On Jul 24, 2017, at 5:02 PM, Matthew Shaw <[hidden email]> wrote:

 

Hi All,

 

I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6. 

 

The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:

 

Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906

 

The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:

 

@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

    public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
    public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

    public String mediate(Integer eTimesheetId) {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "<a href="t3://poldesaps02:5013">t3://poldesaps02:5013");
        env.put(Context.SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.SECURITY_CREDENTIALS, "passw0rd");

        Context ic = null;
        try {
            ic = new InitialContext(env);
            return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }catch (NamingException e) {
            throw new RuntimeException(e);
        }



    }



    public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject = null;

        try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.JNDI_NAME);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.class);

        TimesheetSessionFacade remote = null;
        try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        } catch (ClassCastException e) {
            throw new RuntimeException(e);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        } catch (CreateException e) {
            throw new RuntimeException(e);
        }catch (AFTimesheetException e) {
            throw new RuntimeException(e);
        }
    }

 

 

Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:

 

org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No

 

The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.

 

I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle. 

 

The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.

 

One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?

 

Regards,

Matt.

 

 

 

 

 

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.



DISCLAIMER:
"The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: rmi to EJB2 / weblogic container

Matthew Shaw
In reply to this post by Jens J Parappallil

Hi Jens,

 

I’m getting a ClassNotFoundException: weblogic.rmi.internal.DefaultRMIEnvironment

 

Reading up on the weblogic doco on the thint3client, it says to enable network classloading on the jvm. Is this something you also did on the server side?

 

Cheers,

Matt.

 

From: Jens J Parappallil [mailto:[hidden email]]
Sent: Tuesday, 25 July 2017 10:35 PM
To: [hidden email]
Subject: RE: rmi to EJB2 / weblogic container

 

Hi Mathew,

 

I had done an integration with weblogic jms from karaf, the application consumed messages from the weblogic jms server . I had encountered class encountered class cast exception and such and finally got it working. I created a bundle which registered a CamelJmsComponent into the OSGi service registry which was used by other bundles in thie camel routes. I think you can use similar patterns for the weblogic EJB lookups etc.

 

This is how I made it work,

 

Bundle : weblogic-connector

I embedded wlthint3client.jar inside this bundle.

 

Pom.xml snippet

<plugin>

                           <groupId>org.apache.felix</groupId>

                           <artifactId>maven-bundle-plugin</artifactId>

                           <configuration>

                                  <instructions>

                                       

                                        <Private-Package>com.x.z.connector.weblogic.*</Private-Package>

                                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>

                                        <Bundle-Version>${project.version}</Bundle-Version>

                                         <!—I had to consume object messages so the packages of those classes are added in dynamic imports à

                                        <DynamicImport-Package> com.x.z.clinet.*,com.a.b.*</DynamicImport-Package>

                                         <!—This is a non osgi jar which is embedded inside this bundle ( the connector bundle ) à

                                        <Bundle-ClassPath>.,lib/wlthint3client.jar</Bundle-ClassPath>

                                        <Import-Package>

                                               org.slf4j.*;version="${slf4j.version-range}";provider=paxlogging,

                                               org.springframework.*;version="${spring.version-range}",

                                               org.apache.camel.*;version="${camel.version-range}",

                                               javax.jms;version="[1.1,3)",

                                               *;resolution:=optional

                                               </Import-Package>

                                  </instructions>

                           </configuration>

                    </plugin>

 

The connector bundle had do initial context lookups etc, I used spring jms for this purpose. To get it working I found that weblogic used ContextClassLoader internally.

 

WeblogicJndiTemplate (@See how the context classloader is swapped before doing the lookup operations)

 

  protected Context createInitialContext()

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      Context context = super.createInitialContext();

      return context;

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

 

  public Object lookup(String name)

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      return super.lookup(name);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

 

  public <T> T lookup(String name, Class<T> requiredType)

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      return (T)super.lookup(name, requiredType);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

}

 

Similarly inside the ConnectionFactory implementation

 

 

  protected Session createSession(Connection con, Integer mode)

    throws JMSException

  {

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(this.bundleClassLoader);

      return super.createSession(con, mode);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

}

 

 

From: Matthew Shaw [[hidden email]]
Sent: Tuesday, July 25, 2017 7:08 AM
To: [hidden email]
Subject: [External] RE: rmi to EJB2 / weblogic container

 

I might also add that establishing a connection through non osgi runtime works. So it’s definitely osgi/felix/karaf related I think. There seems to be a few people on google with the same issue but no solution.

 

From: Matthew Shaw [[hidden email]]
Sent: Tuesday, 25 July 2017 1:49 PM
To: [hidden email]
Subject: RE: rmi to EJB2 / weblogic container

 

I’ve re-configured my client to use t3, which requires the wlfullclient.jar (54MB) on client classpath now. Re.IIOP David you’re right it is not t3 related.

 

Anyhow, I’m now getting the following error:

Root exception is java.net.ConnectException: t3://10.47.20.11:5013: Bootstrap to poldesaps02.desqld.internal/10.47.20.11:5013 failed. It is likely that the remote side declared peer gone on this JVM]

 

Which is even more confusing because the weblogic server is definitely listening on that address and port, having checked the console and connected to it via other means. Yikes!

 

From: David Jencks [[hidden email]]
Sent: Tuesday, 25 July 2017 12:24 PM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

On a slightly less pessimistic note, if I were you I’d try to get your code (suitably modified) running in a plain JRE to try to distinguish between an ORB problem and a OSGI problem.

 

From my position of complete ignorance I thought t3 didn’t use IIOP…. if that is it’s only choice then it may be what the web logic client library is already using.  Does the client library include an orb?

 

more good luck :-)

 

david jencks

 

On Jul 24, 2017, at 6:24 PM, Matthew Shaw <[hidden email]> wrote:

 

Thanks David, you might be onto something there. Just taking a quick look at the weblogic docs and there is the t3 protocol, which uses IIOP and RMI, which I think is what you may be referring to. I’ll give that a go.

 

From: David Jencks [[hidden email]] 
Sent: Tuesday, 25 July 2017 11:13 AM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

Its a bit difficult to tell, and I’ve never used weblogic, but your setup might end up using the JRE orb rather than a working orb.  Generally the JRE orb doesn’t work at all for EJBs.  

 

In any case, I think the error indicates that one side or the other cannot find the CORBA description of the exception class so the exception can’t be either serialized or deserialized.  I suspect this functionality is not implemented in the client orb; generally orbs only implement functionality someone with a lot of clout actually needs, leaving vast swathes of spec behavior missing.

 

Replacing the ORB with e.g. the unreleased trunk Yoko orb which does work for EJBS, at least for IBM Websphere Liberty, is quite difficult.  I thought WebLogic had a proprietary transport not using CORBA.  Is there any chance you can use that?

 

good luck,

 

David Jencks

 

On Jul 24, 2017, at 5:02 PM, Matthew Shaw <[hidden email]> wrote:

 

Hi All,

 

I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6. 

 

The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:

 

Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906

 

The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:

 

@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

    public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
    public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

    public String mediate(Integer eTimesheetId) {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "<a href="t3://poldesaps02:5013">t3://poldesaps02:5013");
        env.put(Context.SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.SECURITY_CREDENTIALS, "passw0rd");

        Context ic = null;
        try {
            ic = new InitialContext(env);
            return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }catch (NamingException e) {
            throw new RuntimeException(e);
        }



    }



    public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject = null;

        try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.JNDI_NAME);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.class);

        TimesheetSessionFacade remote = null;
        try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        } catch (ClassCastException e) {
            throw new RuntimeException(e);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        } catch (CreateException e) {
            throw new RuntimeException(e);
        }catch (AFTimesheetException e) {
            throw new RuntimeException(e);
        }
    }

 

 

Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:

 

org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No

 

The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.

 

I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle. 

 

The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.

 

One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?

 

Regards,

Matt.

 

 

 

 

 

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.



DISCLAIMER:
"The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: rmi to EJB2 / weblogic container

Matthew Shaw
In reply to this post by Jens J Parappallil

SOLVED!

 

Basically following what you said Jen, with a minor change. Added the wlfullclient.jar to karaf as its own bundle to include all the rmi packages, rather than using a network class loader. Now my manifest looks like the following:

 

Manifest-Version: 1.0
Bnd-LastModified: 1501028494889
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: org.apache.camel;version="[2.19,3)",org.apache.camel.bui
lder;version="[2.19,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,java
x.naming,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mod
el.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jac
kson.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;versio
n="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.s
cr;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.sql
,javax.xml.bind.annotation,javax.xml.namespace,javax.xml.transform,java
x.xml.transform.sax,javax.xml.transform.stream,org.apache.log4j,javax.e
jb,javax.naming.spi,javax.net,javax.net.ssl,javax.security.auth,javax.s
ecurity.auth.callback,javax.security.auth.login,javax.security.auth.spi
,org.omg.CORBA,org.omg.CORBA.portable,org.omg.CORBA_2_3,org.omg.CORBA_2
_3.portable,weblogic.jndi
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906

 

Note I am importing corba (which I don’t think I need to anymore), weblogic.jndi and javax.ejb.

 

Big thanks to Jens with setting the threadcontext classloader to the bundles. Make sure you do it to every remote invocation!

 

From: Jens J Parappallil [mailto:[hidden email]]
Sent: Tuesday, 25 July 2017 10:35 PM
To: [hidden email]
Subject: RE: rmi to EJB2 / weblogic container

 

Hi Mathew,

 

I had done an integration with weblogic jms from karaf, the application consumed messages from the weblogic jms server . I had encountered class encountered class cast exception and such and finally got it working. I created a bundle which registered a CamelJmsComponent into the OSGi service registry which was used by other bundles in thie camel routes. I think you can use similar patterns for the weblogic EJB lookups etc.

 

This is how I made it work,

 

Bundle : weblogic-connector

I embedded wlthint3client.jar inside this bundle.

 

Pom.xml snippet

<plugin>

                           <groupId>org.apache.felix</groupId>

                           <artifactId>maven-bundle-plugin</artifactId>

                           <configuration>

                                  <instructions>

                                       

                                        <Private-Package>com.x.z.connector.weblogic.*</Private-Package>

                                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>

                                        <Bundle-Version>${project.version}</Bundle-Version>

                                         <!—I had to consume object messages so the packages of those classes are added in dynamic imports à

                                        <DynamicImport-Package> com.x.z.clinet.*,com.a.b.*</DynamicImport-Package>

                                         <!—This is a non osgi jar which is embedded inside this bundle ( the connector bundle ) à

                                        <Bundle-ClassPath>.,lib/wlthint3client.jar</Bundle-ClassPath>

                                        <Import-Package>

                                               org.slf4j.*;version="${slf4j.version-range}";provider=paxlogging,

                                               org.springframework.*;version="${spring.version-range}",

                                               org.apache.camel.*;version="${camel.version-range}",

                                               javax.jms;version="[1.1,3)",

                                               *;resolution:=optional

                                               </Import-Package>

                                  </instructions>

                           </configuration>

                    </plugin>

 

The connector bundle had do initial context lookups etc, I used spring jms for this purpose. To get it working I found that weblogic used ContextClassLoader internally.

 

WeblogicJndiTemplate (@See how the context classloader is swapped before doing the lookup operations)

 

  protected Context createInitialContext()

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      Context context = super.createInitialContext();

      return context;

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

 

  public Object lookup(String name)

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      return super.lookup(name);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

 

  public <T> T lookup(String name, Class<T> requiredType)

    throws NamingException

  {

    ClassLoader bundleCL = getClass().getClassLoader();

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(bundleCL);

      return (T)super.lookup(name, requiredType);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

}

 

Similarly inside the ConnectionFactory implementation

 

 

  protected Session createSession(Connection con, Integer mode)

    throws JMSException

  {

    ClassLoader tccl = Thread.currentThread().getContextClassLoader();

    try

    {

      Thread.currentThread().setContextClassLoader(this.bundleClassLoader);

      return super.createSession(con, mode);

    }

    finally

    {

      Thread.currentThread().setContextClassLoader(tccl);

    }

  }

}

 

 

From: Matthew Shaw [[hidden email]]
Sent: Tuesday, July 25, 2017 7:08 AM
To: [hidden email]
Subject: [External] RE: rmi to EJB2 / weblogic container

 

I might also add that establishing a connection through non osgi runtime works. So it’s definitely osgi/felix/karaf related I think. There seems to be a few people on google with the same issue but no solution.

 

From: Matthew Shaw [[hidden email]]
Sent: Tuesday, 25 July 2017 1:49 PM
To: [hidden email]
Subject: RE: rmi to EJB2 / weblogic container

 

I’ve re-configured my client to use t3, which requires the wlfullclient.jar (54MB) on client classpath now. Re.IIOP David you’re right it is not t3 related.

 

Anyhow, I’m now getting the following error:

Root exception is java.net.ConnectException: t3://10.47.20.11:5013: Bootstrap to poldesaps02.desqld.internal/10.47.20.11:5013 failed. It is likely that the remote side declared peer gone on this JVM]

 

Which is even more confusing because the weblogic server is definitely listening on that address and port, having checked the console and connected to it via other means. Yikes!

 

From: David Jencks [[hidden email]]
Sent: Tuesday, 25 July 2017 12:24 PM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

On a slightly less pessimistic note, if I were you I’d try to get your code (suitably modified) running in a plain JRE to try to distinguish between an ORB problem and a OSGI problem.

 

From my position of complete ignorance I thought t3 didn’t use IIOP…. if that is it’s only choice then it may be what the web logic client library is already using.  Does the client library include an orb?

 

more good luck :-)

 

david jencks

 

On Jul 24, 2017, at 6:24 PM, Matthew Shaw <[hidden email]> wrote:

 

Thanks David, you might be onto something there. Just taking a quick look at the weblogic docs and there is the t3 protocol, which uses IIOP and RMI, which I think is what you may be referring to. I’ll give that a go.

 

From: David Jencks [[hidden email]] 
Sent: Tuesday, 25 July 2017 11:13 AM
To: [hidden email]
Subject: Re: rmi to EJB2 / weblogic container

 

Its a bit difficult to tell, and I’ve never used weblogic, but your setup might end up using the JRE orb rather than a working orb.  Generally the JRE orb doesn’t work at all for EJBs.  

 

In any case, I think the error indicates that one side or the other cannot find the CORBA description of the exception class so the exception can’t be either serialized or deserialized.  I suspect this functionality is not implemented in the client orb; generally orbs only implement functionality someone with a lot of clout actually needs, leaving vast swathes of spec behavior missing.

 

Replacing the ORB with e.g. the unreleased trunk Yoko orb which does work for EJBS, at least for IBM Websphere Liberty, is quite difficult.  I thought WebLogic had a proprietary transport not using CORBA.  Is there any chance you can use that?

 

good luck,

 

David Jencks

 

On Jul 24, 2017, at 5:02 PM, Matthew Shaw <[hidden email]> wrote:

 

Hi All,

 

I’ve been dealing with a perplexing issue for some weeks now. I’m running karaf 4.1.1 with a client bundle deployed that I would like to communicate via rmi using java serialization / deserialization with an EJB2 container, namely weblogic 10.3.6. 

 

The ejb container has two jars deployed timesheet-ejb.jar and common.jar as part of a EAR. I have packaged these jars in addition to the wlclient.jar for 10.3.6 as embedded dependencies in my bundle see the following client bundle manifest:

 

Manifest-Version: 1.0
Bnd-LastModified: 1500856210705
Build-Jdk: 1.8.0_131
Built-By: mshaw
Bundle-ClassPath: .,common-5.0.0.jar,timesheet-ejb-5.0.0.jar,wlclient-10
.3.6.jar
Bundle-ManifestVersion: 2
Bundle-Name: legacywrapper
Bundle-SymbolicName: au.gov.qld.ambulance.tams.legacywrapper
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: common|timesheet-ejb|wlclient;scope=compile|runtime
Embedded-Artifacts: common-5.0.0.jar;g="au.gov.qld.des.aftimesheet";a="c
ommon";v="5.0.0",timesheet-ejb-5.0.0.jar;g="au.gov.qld.des.aftimesheet"
;a="timesheet-ejb";v="5.0.0",wlclient-10.3.6.jar;g="weblogic";a="wlclie
nt";v="10.3.6"
Export-Package: au.gov.qld.ambulance.services.legacywrapper;version="0.0
.1";uses:="javax.naming,org.apache.camel,org.apache.camel.scr",au.gov.q
ld.ambulance.services.legacywrapper.domain;version="0.0.1";uses:="javax
.xml.bind,javax.xml.bind.annotation"
Import-Package: javax.rmi.CORBA,org.omg.CORBA,org.omg.CORBA.portable,org
.apache.camel;version="[2.19,3)",org.apache.camel.builder;version="[2.1
9,3)",org.slf4j;version="[1.7,2)",javax.xml.bind,javax.naming,javax.nam
ing.spi,org.apache.camel.model;version="[2.19,3)",org.apache.camel.mode
l.rest;version="[2.19,3)",org.restlet.data,javax.rmi,com.fasterxml.jack
son.databind;version="[2.8,3)",com.fasterxml.jackson.annotation;version
="[2.8,3)",org.apache.camel.impl;version="[2.19,3)",org.apache.camel.sc
r;version="[2.19,3)",org.apache.camel.spi;version="[2.19,3)",javax.net,
javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se
curity.auth.login,javax.security.auth.spi,javax.sql,javax.xml.bind.anno
tation,javax.xml.namespace,javax.xml.transform,javax.xml.transform.sax,
javax.xml.transform.stream,org.apache.avalon.framework.logger,org.apach
e.log4j,org.omg.CORBA.ORBPackage,org.omg.CosNaming,org.omg.CosNaming.Na
mingContextExtPackage,org.omg.CosNaming.NamingContextPackage,org.omg.Dy
namicAny,org.omg.DynamicAny.DynAnyFactoryPackage,org.omg.DynamicAny.Dyn
AnyPackage,org.omg.IOP,org.omg.IOP.CodecPackage,org.omg.PortableInterce
ptor,org.xml.sax,org.omg.CORBA_2_3,org.omg.CORBA_2_3.portable
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/au.gov.qld.ambulance.services.legacywrapper.
eTimesheetMediation.xml,OSGI-INF/au.gov.qld.ambulance.services.legacywr
apper.eTimesheetEJB2Bean.xml
Tool: Bnd-3.3.0.201609221906

 

The jars on both client and server are exactly the same. There is a session façade in the timesheet-ejb.jar called TimesheetSessionFacade which I am calling the method getTimesheet(id) throws AFTimesheetException, remotely. I am making this call via apache camel and declarative services in my bundle. Here is the service which makes the call:

 

@Service(value = IeTimesheetEJB2Bean.class)
@Component(immediate = true)
public class eTimesheetEJB2Bean implements IeTimesheetEJB2Bean {

    public static final String COMPONENT_LABEL = "au.gov.qld.ambulance.services.legacywrapper.eTimesheetEJB2Bean";
    public static final String COMPONENT_DESCRIPTION = "The eTimesheet EJB remote invocation";

    public String mediate(Integer eTimesheetId) {

        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
        env.put(Context.PROVIDER_URL, "<a href="t3://poldesaps02:5013">t3://poldesaps02:5013");
        env.put(Context.SECURITY_PRINCIPAL, "testuser4");
        env.put(Context.SECURITY_CREDENTIALS, "passw0rd");

        Context ic = null;
        try {
            ic = new InitialContext(env);
            return marshallTimesheetToJSON(ic ,getTimesheet(ic, eTimesheetId));

        }catch (NamingException e) {
            throw new RuntimeException(e);
        }



    }



    public TimesheetTransferObject getTimesheet (Context ic, Integer eTimesheetId) {
        Object homeObject = null;

        try {
            homeObject = ic.lookup(TimesheetSessionFacadeHome.JNDI_NAME);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }

        TimesheetSessionFacadeHome home = (TimesheetSessionFacadeHome) PortableRemoteObject.narrow(homeObject, TimesheetSessionFacadeHome.class);

        TimesheetSessionFacade remote = null;
        try {
            remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(), TimesheetSessionFacade.class);
            TimesheetTransferObject result = remote.getTimesheet(eTimesheetId);
//            TimesheetTransferObject result = new TimesheetTransferObject();

           
return result;
        } catch (ClassCastException e) {
            throw new RuntimeException(e);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        } catch (CreateException e) {
            throw new RuntimeException(e);
        }catch (AFTimesheetException e) {
            throw new RuntimeException(e);
        }
    }

 

 

Everything works fine when I retrieve a valid timesheet. However if I force the server to throw a TimesheetNotFoundException by passing an invalid Id, the server throws the following corba error:

 

org.omg.CORBA.BAD_PARAM: Could not find FVD class for: RMI:au.gov.qld.des.aftimesheet.exception.TimesheetNotFoundException:7CF87A9F87EF5638:00000000000003E8  vmcid: 0x0  minor code: 0  completed: No

 

The TimesheetNotFoundException is in the common.jar on the server. Both the common.jar and timesheet-ejb.jar are deployed as one app in an EAR file on the server. I am assuming this is a classloading problem on my client side.

 

I’ve tried all sorts of bundle deployment options on my client to no avail, such as deploying the server jars on the karaf system classpath, etc. I thought embedding the server jars into my bundle was the more sound approach as then they would all share the same classloader as the bundle. 

 

The only other thing I can think of at the moment is removing apache camel from the equation and see if that works. I’ve re-read up on classloading in osgi versus weblogic/j2ee to try and find some answers but I am at a loss at the moment. If anyone has any insight into this I would greatly appreciate your assistance.

 

One other thing I have noticed is that karaf has a completely separate RMI thread running for the JMX functionality it provides. Could this be confusing things as I am using jndi to lookup the remote EJB?

 

Regards,

Matt.

 

 

 

 

 

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

 

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.



DISCLAIMER:
"The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."

This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure this email does not contain malicious software, the Queensland Ambulance Service does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government.

********************************************************************************

The content presented in this publication is distributed by the Queensland Government as an information source only. The State of Queensland makes no statements, representations or warranties about the accuracy, completeness or reliability of any information contained in this publication. The State of Queensland disclaims all responsibility and all liability (including without limitation for liability in negligence) for all expenses, losses, damages and costs you might incur as a result of the information being inaccurate or incomplete in any way, and for any reason reliance was placed on such information.

Loading...