Re: corba-to-ejb
"Anoop Ahamad" <[email protected]> Thu, 14 Apr 2005 20:16:14 +0530
| Newsgroups | gmane.comp.corba.orbacus |
|---|---|
| Message-ID | <[email protected]> |
Hi Darren,
1. We have tried with all the options you have told we could generate the
CPP code but we could not compile that. We dropped that option because it is
giving lot of errors.
2. We are trying with the IDL file given in the javaworld site again
(http://www.javaworld.com/javaworld/jw-03-2002/jw-0329-corba-p2.html )
It generated the CPP code properly.
We used this command line to run the Program.
CORBAtoEJB -ORBInitRef
NameService=corbaloc:iiop:[email protected]:7001/NameService
The output of our program given below:
Accessing the naming service
Getting the naming context
Resolving the home interface
Creating a new instance
After this it showing Abnormal Program Termination.
The source code of client I have given below:
#include <OB/CORBA.h>
#include <OB/CosNaming.h>
#include "CorbaEai.h"
int main(int argc, char* argv[])
{
try {
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
cout << "Accessing the naming service" << endl;
CORBA::Object_var o = orb->resolve_initial_references("NameService");
cout<<"Reference:"<< o<<endl;
cout << "Getting the naming context" << endl;
CosNaming::NamingContext_var context =
CosNaming::NamingContext::_narrow(o);
CosNaming::Name name;
name.length(1);
name[0].id = CORBA::string_dup("corba-eai");
name[0].kind = CORBA::string_dup("");
cout << "Resolving the home interface" << endl;
CORBA::Object_var object = context->resolve(name);
eai::CorbaEaiHome_var ceaihome = eai::CorbaEaiHome::_narrow(object);
cout << "Creating a new instance" << endl;
eai::CorbaEai_ptr ceai = ceaihome->create();
cout<<"After creation of new instance";
CORBA::Long r = ceai->sum((CORBA::Long)15,(CORBA::Long)20);
//cout << "Result: " << r << endl;
cout<< "Result"<<endl;
}
catch(const CORBA::Exception& e) {
cout << "Exception: " << e << endl;
}
return 0;
}
Regards
Anoop Ahamad
----- Original Message -----
From: "Darren Middleman" <[email protected]>
To: "Anoop Ahamad" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, April 13, 2005 6:24 PM
Subject: Re: corba-to-ejb
> Hi Anoop,
>
> On Mon, Apr 11, 2005 at 07:06:09PM +0530, Anoop Ahamad wrote:
> >
> > Dear OB-Users,
> >
> > we are trying communication between corba client and ejb server using a
sample, which I referred in
http://www.javaworld.com/javaworld/jw-03-2002/jw-0329-corba-p2.html
> > On the corba client side we are using orabacus and on the Ejb server
side it is weblogic 8.1.
> >
> > 1. we generated the idl using
> > java weblogic.ejbc eai.jar eaiC.jar -idl -idlDirectory ./idl
> >
> > 2. we simplified the generated idl as
> >
> > #include "orb.idl"
> >
> > module javax {
> > module ejb {
> > custom valuetype CreateException : ::java::lang::_Exception {
> >
> > #pragma ID CreateException
"RMI:javax.ejb.CreateException:048A3675A6FD5463:575FB6C03D49AD6A"
> >
> > };
> > };
> > };
> >
> > module javax {
> > module ejb {
> > exception CreateEx {
> > CreateException value;
> > };
> > };
> > };
> >
> > module java {
> > module rmi {
> > typedef Object Remote;
> >
> > };
> > };
> >
> > module java {
> > module io {
> > typedef any Serializable;
> >
> > };
> > };
> >
> > module eai {
> > interface CorbaEai : ::javax::ejb::EJBObject {
> > readonly attribute ::java::util::Collection collection;
> >
> > attribute ::eai::MyType myType;
> >
> > readonly attribute ::java::util::Vector vector;
> >
> > ::java::lang::Integer sumObj( in ::java::lang::Integer arg0, in
::java::lang::Integer arg1);
> > long sum( in long arg0, in long arg1);
> >
> > #pragma ID CorbaEai "RMI:eai.CorbaEai:0000000000000000"
> >
> >
> > };
> > };
> >
> > module eai {
> > interface CorbaEaiHome : ::javax::ejb::EJBHome {
> > ::eai::CorbaEai create() raises (::javax::ejb::CreateEx);
> >
> > #pragma ID CorbaEaiHome "RMI:eai.CorbaEaiHome:0000000000000000"
> >
> > };
> > };
> >
> > module eai {
> > valuetype MyType {
> > public long a;
> >
> > public double b;
> >
> >
> > #pragma ID MyType "RMI:eai.MyType:7B8145F0C5E7A58C:D2D18E8718275264"
> >
> > };
> > };
> >
> > 3. Then we tried to compile idl interfaces using orabacus as
> >
> > c:\idl CorbaEai.idl
> >
> > but it is giving error as
> >
> > CorbaEai.idl:1: orb.idl: No such file or directory
> > CorbaEai.idl(5): error: `::java::lang::Exception' undeclared
> > CorbaEai.idl(40): error: `::javax::ejb::EJBObject' undeclared
> > CorbaEai.idl(41): error: `::java::util::Collection' undeclared
> > CorbaEai.idl(43): error: `::eai::MyType' undeclared
> > CorbaEai.idl(45): error: `::java::util::Vector' undeclared
> > CorbaEai.idl(47): error: `::java::lang::Integer' undeclared
> > CorbaEai.idl(58): error: `::javax::ejb::EJBHome' undeclared
> >
> > Please help us in this regard.
> >
> > Anoop Ahamad
>
> There are a couple of things to watch out for here when trying this demo
> using the Orbacus IDL compiler.
>
> 1. The "java weblogic.ejbc" generated IDL files all include the file
> "orb.idl". If you want to use the Orbacus IDL compiler, these should
> be changed to #include <OB/orb.idl>.
>
> 2. You are not providing any include paths to your IDL command in step
3.
> You should be using the -I option to provide paths to all of the
> include files that you will be needing. At the very least, you
should
> provide the include path to the Orbacus IDL files, located in the
idl/
> folder of your installation. For example:
>
> C:\idl -I<orbacus install path>\idl\ MyIdlFile.idl
>
> You will also likely need to provide the path to the additional IDL
> files genereated in step 1 of your description.
>
> 3. The undeclared errors that you are seeing are likely caused by you
not
> including the appropriate declaration files in your main IDL file
> (CorbaEai.idl). These additional IDL files should have been
generated
> along with your main IDL file in step 1 of your desciption. For
> example, the declaration for ::javax::ejb::EJBHome should be located
> in the file 'javax\ejb\EJBHome.idl' of the idl\ folder you specified
> to the "java weblogic.ejbc" command. You will need to include this
in
> your combined CorbaEai.idl file using:
>
> #include "javax/ejb/EJBHome.idl"
>
> You should have similarly generated files for all the other types
that
> you have undeclared.
>
> There should be no problems using Orbacus to implement this demo. I was
> able to successfully generate, compile, and build this demo application
> using the Orbacus IDL compiler. Keep in mind, however, that this was done
> using the instructions provided in the tutorial you sent the link for. I
> have been unable to test your IDL file because it appears you have added
> some new features to the basic demo that I do not have access to.
>
> Regards,
> Darren
>
> --
> Darren Middleman, Software Engineer
> Team Orbacus - Your CORBA Source
> Email: mailto:[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