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

Using Valuetypes in Visibroker, Help.

0 views
Skip to first unread message

Shankar

unread,
Jun 3, 2003, 3:29:14 PM6/3/03
to
Hi,
I am learning how to use OBVs in CORBA by trying out a simple
example. I am using Visibroker 4.0 with java 1.3 on a Solaris machine.
The code compiles fine but the program gives a runtime error which is,

phoenix{avi155: vbj Client 3 + 4
java.lang.ClassNotFoundException: Demos.AcmeCalculatorDefaultFactory
An exception occurred: org.omg.CORBA.MARSHAL: minor code: 1
completed: Maybe
org.omg.CORBA.MARSHAL: minor code: 1 completed: Maybe
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at com.inprise.vbroker.orb.SE.read(SE.java:28)
at com.inprise.vbroker.orb.DelegateImpl.handleReply(DelegateImpl.java:579)
at com.inprise.vbroker.orb.DelegateImpl.invoke(DelegateImpl.java:519)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:294)
at Demos._CustomerStub.calculate(_CustomerStub.java:46)
at Client.main(Client.java:97)import Demos.*;


__________________________________________________
The portion of the code where I am getting the above error, I
indicated below.

Here is the idl that i am using
__________________________________________________

module Demos {

abstract valuetype Calculator {
long calculate();
};

valuetype AcmeCalculator : Calculator {
public long operand1;
public long operand2;
public char op;
factory create(in long opn1, in long opn2, in char op);
};


interface Customer {
long calculate(in AcmeCalculator cal);
// kill myself:
oneway void kill();
};
};
__________________________________________________

Here is the implementation for the factory class,
AcmeCalculatorFactoryImpl.java that I am using.
__________________________________________________

public class AcmeCalculatorFactoryImpl implements
AcmeCalculatorValueFactory {

public java.io.Serializable
read_value(org.omg.CORBA_2_3.portable.InputStream$
return in.read_value(new AcmeCalculatorImpl());
}

public AcmeCalculator create(int opn1, int opn2, char op) {
AcmeCalculator result = new AcmeCalculatorImpl();
result.operand1 = opn1;
result.operand2 = opn2;
result.op = op;

return result;
}

public static AcmeCalculatorValueFactory install(org.omg.CORBA.ORB
orb) {
org.omg.CORBA_2_3.ORB an_orb = (org.omg.CORBA_2_3.ORB)orb;
AcmeCalculatorValueFactory result = new
AcmeCalculatorFactoryImpl();
an_orb.register_value_factory(AcmeCalculatorHelper.id(), result);
return result;
}
}
_________________________________________________

This is how I am registering the factory. Is this right?
_________________________________________________

((org.omg.CORBA_2_3.ORB)orb).register_value_factory("IDL:Employee:1.0",new
AcmeCalculatorFactoryImpl());

The ior is written out to a text file and the Client reads it to get a
handle to the object.

__________________________________________________

This is how the client gets a handle to the calculator object.
__________________________________________________

AcmeCalculatorFactoryImpl factory = new AcmeCalculatorFactoryImpl();

AcmeCalculator acme_cal = factory.create(left_operand,
right_operand,
op);


__________________________________________________

Here is the Client side code that I am using.
__________________________________________________


AcmeCalculatorFactoryImpl factory = new AcmeCalculatorFactoryImpl();
//factory.install(orb);
AcmeCalculator acme_cal = factory.create(left_operand,
right_operand,
op);
// Calculate the result.

int result = customer.calculate(acme_cal); <<<---------- I get the
ERROR here
System.out.println("Result is " + result);

I appreciate any help in solving this.
Thank you,
Ravi Shankar.

Note:-
-------
The code in the above is an example from Orb2Java from 2AB
Technologies.

Carol Burt

unread,
Jun 27, 2003, 11:13:02 AM6/27/03
to
Ravi,

> Note:-
> -------
> The code in the above is an example from Orb2Java from 2AB
> Technologies.

You have either modified the demo code or cut/pasted from the demo
into another program you were using with Visi. The sample you provide
does not match the demo we shipped. I think if you look carefully at
the areas you modified you will find your error. I suspect if you run
the demo unaltered with Visi it will work as well with their orb as it
does with ours.
Regards,
Carol
2AB

0 new messages