karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david.a.jen...@gmail.com>
Subject Re: rmi to EJB2 / weblogic container
Date Tue, 25 Jul 2017 01:12:44 GMT
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

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 <Matthew.Shaw@ambulance.qld.gov.au> 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 <http://javax.net/>,
> javax.net.ssl,javax.security.auth,javax.security.auth.callback,javax.se <http://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-
> 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 <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,
>         TimesheetSessionFacade remote = null;
>         try {
>             remote = (TimesheetSessionFacade) PortableRemoteObject.narrow(home.create(),
>             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
> 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.

View raw message