Re: I need help to make a test running ?
David Weir <[email protected]> Tue, 13 Dec 2005 17:15:35 -0330
| Newsgroups | gmane.comp.corba.orbacus |
|---|---|
| Organization | Object Oriented Concepts, Inc. - An IONA Company |
| Message-ID | <[email protected]> |
Hello Jean-Louis,
On Tue, Dec 13, 2005 at 08:55:44AM +0100, Decoster Jean Louis wrote:
>
> Can somebody help me to make my test running ?
> This small test consists of an IDL with two interfaces:
> // IDL
> module eLockidl {
> // Place definition
> interface placeCorba {
> typedef string description;
> string getDescription();
> void setDescription(in string inDescription);
> void save();
> };
> // PlaceTable definition
> interface placetableCorba {
> placeCorba getNew();
> };
> };
>
> The getNew() method raises an unknown exception in the server (memory
> violation)?. I don't understand what is going wrong?.
> As attachments are all the files also in .txt format.
> Server is in C++
> Client is in java.
>
> I HOPE THAT I WILL RECEIVE SOME HELP SOON. THANKS FOR YOUR ANSWER.
> REGARDS,
> Jean-Louis
When submitting a test case or demo for review, I suggest that you pare
it down to the bare minimum. This will make it easier for others to
review your application and offer you some advice or help where
applicable.
First off, I should point out that following standard naming conventions
for IDL definitions would also make your work clearer for others to
review. The main point is that "interface" and "module" definitions are
typically capitalized. If you take a look at the CORBA specification and
its IDL definitions you will get a better indication of what I am
talking about.
Something else that you should be aware of is the idea of an attribute
in IDL. For example, had you simply defined an "attribute string
description" in your "placeCorba" ("PlaceCorba") interface, you would
have gotten an accessor and mutator function for free in your generated
classes. This is not always the best way to go, but it can simplify IDL
definitions to some degree if the explicit methods are not required in
the IDL definition.
As for your main issue, I believe that Darren Middleman suggested the
problem in a previous e-mail. Basically, your "getNew()" method needs to
do more than simply instantiate a C++ object on the server side. It
actually has to be responsible for instantiating a servant on the server
side POA and returning a proper object reference for that servant.
It seems that you are trying to implement a factory type interface with
your "placeTableCorba" interface, which is quite common. But remember,
the idea of returning a CORBA object in that factory interface is to
allow the client to then invoke remote operations on that new object. In
order to do this, however, that new object must exist on a POA on the
server side, otherwise the ORB will not be able to forward requests to
it.
So, the implementation of your "getNew" method should actually know
what POA to activate your "placeCorba" servant on, then proceed to do
that activation. From the code you provided, I do not see this being
done anywhere.
Please take a closer look at the "hello" demo shipped with Orbacus for
C++. In particular look at the inheritance structure of the servant
(Hello_impl.h/.cpp), and what needs to occur in the server (Server.cpp)
to create this implementation object on the POA.
A reference that you may want to consider is "Advanced CORBA Programming
with C++", by Michi Henning and Steve Vinoski.
Cheers,
Dave
--
David Weir
Team Orbacus - Your CORBA Source
E-Mail: [email protected]
WWW: http://www.orbacus.com
_______________________________________________
OB-Users Mailing List - [email protected]
http://mail.ooc.nf.ca/mailman/listinfo/ob-users
Visit our support FAQ before you send a message.
http://www.orbacus.com/faq/support.html