Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: CORBA object by value

2 views
Skip to first unread message

Frank Hermes

unread,
Aug 16, 2000, 3:00:00 AM8/16/00
to
Hello all,

I am just trying out the object by value functionality of VisiBroker for
Java 4.1 /RMI over IIOP.

I have a class named cosima.common.component.ComponentInformationValues
which encapsulates some String values and arrays.

I generated IDL from it using Sun's/IBM's JAVA-IDL compiler. With the IDL I
have generated new classes placed in the package
com.dcx.cosima.common.component.

My server class returns all primitive types (e.g. strings) but if I try to
retrieve my ComponentInformationValues object I got the following excpetion:

org.omg.CORBA.MARSHAL: Error unmarshaling value [Could not get class for
repository id =
RMI:cosima.common.component.ComponentInformationValues:47E67B77F22A8F82:982C
08B33FBCA797] minor code: 0 completed: No
at
com.inprise.vbroker.orb.CDRInputStream$ValueTypeReader.octets(CDRInputStream
.java:1125)
at
com.inprise.vbroker.orb.CDRInputStream$ValueTypeReader.state(CDRInputStream.
java:924)
at
com.inprise.vbroker.orb.CDRInputStream$ValueTypeReader.value(CDRInputStream.
java:868)
at
com.inprise.vbroker.orb.CDRInputStream.readValueType(CDRInputStream.java:132
7)
at
com.inprise.vbroker.orb.CDRInputStream.read_value(CDRInputStream.java:1747)
at
com.dcx.cosima.common.component.ComponentInformationValuesHelper.read(Compon
entInformationValuesHelper.java:154)
at
com.dcx.cosima.common.component._CosimaComponentStub.componentInformation(_C
osimaComponentStub.java:148)
at
cosima.managers.impl.configuration.DependencyManagementImpl.removeComponent(
DependencyManagementImpl.java:136)
at
cosima.managers.impl.configuration.CosimaConfigurationManager.removeComponen
t(CosimaConfigurationManager.java:538)
at
cosima.managers.impl.configuration.CosimaConfigurationManager.rebind(CosimaC
onfigurationManager.java:180)
at
cosima.managers.configuration.ConfigurationManagerPOA._invoke(ConfigurationM
anagerPOA.java:176)
at
cosima.managers.configuration.ConfigurationManagerPOA._invoke(ConfigurationM
anagerPOA.java:76)
at com.inprise.vbroker.poa.POAImpl.invoke(POAImpl.java:2152)
at
com.inprise.vbroker.poa.ActivationRecord.invoke(ActivationRecord.java:101)
at
com.inprise.vbroker.GIOP.GiopProtocolAdapter.doRequest(GiopProtocolAdapter.j
ava:392)
at
com.inprise.vbroker.GIOP.GiopProtocolAdapter.dispatchMessage(GiopProtocolAda
pter.java:527)
at
com.inprise.vbroker.orb.TPDispatcherImpl$TPDispatcher.run(TPDispatcherImpl.j
ava:100)
at
com.inprise.vbroker.orb.ThreadPool$PoolWorker.run(ThreadPool.java:76)

This should mean that the ORB does not find the Factory class I have
implemented?! So I added the following lines to register the factory at the
ORB:

org.omg.CORBA_2_3.ORB orb=(org.omg.CORBA_2_3.ORB)
org.omg.CORBA_2_3.ORB.init(new String[0], null);
ComponentInformationValuesDefaultFactory cidf=new
ComponentInformationValuesDefaultFactory();

orb.register_value_factory(com.dcx.cosima.common.component.ComponentInformat
ionValuesHelper.id(), cidf);

But still I get the same error! I have tried to do the lookup_value_factory
call. If I do it in another method/class (e.g. in the Helper class) I also
get an exception that the factory is not registered.If I do it just behind
the above registration the object is returned!

How can I register my value factory, or is it maybe another error? Are there
maybe more instances of the ORB, but I thougth the ORB.init(..) call
implements a singleton pattern?

Thanks,

Frank


pite...@my-deja.com

unread,
Aug 16, 2000, 3:00:00 AM8/16/00
to
Judging by the name "DefaultFactory" it seems that you are registering
the factory that IDL compiler created for you. Well, don't -- create
your own. Here are the two Factories -- first is the one created by IDL
compiler, the other is hand-coded (you should register the second one)

// ------------------ Created by IDL compiler -------------
public class ArlDefaultFactory implements
org.omg.CORBA.portable.ValueFactory {
public java.io.Serializable read_value
(org.omg.CORBA.portable.InputStream is) {
java.io.Serializable val = null;
// create and initialize value
val = ((org.omg.CORBA_2_3.portable.InputStream)is).read_value(val);
return val;
}
}
// ----------------- Hand crafted -----------------------
public class ArlFactory implements org.omg.CORBA.portable.ValueFactory {
public java.io.Serializable read_value
(org.omg.CORBA.portable.InputStream is) {
java.io.Serializable val = new ArlImpl();
// create and initialize value
val = ((org.omg.CORBA_2_3.portable.InputStream)is).read_value(val);
return val;
}
}
// -------------------------------------------------------

The difference is one line, but it is crucial


To register the factory I do the following (and it seems to work):

static public void registerFactoryWithOrb(org.omg.CORBA_2_3.ORB orb) {
Arl someArl = new ArlImpl();
String arlId = someArl._truncatable_ids()[0];
orb.register_value_factory(arlId, new ArlFactory());
}

// ----------------------------------------------------------------

Hope this helps.
-Vladimir

In article <8ne6mf$mfl$1...@news.sns-felb.debis.de>,


"Frank Hermes" <Frank....@DaimlerChrysler.com> wrote:
> Hello all,
>
> I am just trying out the object by value functionality of VisiBroker
for
> Java 4.1 /RMI over IIOP.
>

> org.omg.CORBA_2_3.ORB orb=(org.omg.CORBA_2_3.ORB)
> org.omg.CORBA_2_3.ORB.init(new String[0], null);
> ComponentInformationValuesDefaultFactory cidf=new
> ComponentInformationValuesDefaultFactory();
>
> orb.register_value_factory
(com.dcx.cosima.common.component.ComponentInformat
> ionValuesHelper.id(), cidf);


Sent via Deja.com http://www.deja.com/
Before you buy.

0 new messages