WG: Problem testing corba application

"Decoster Jean Louis" <[email protected]> Fri, 9 Dec 2005 10:21:03 +0100
Newsgroups gmane.comp.corba.orbacus
Message-ID <[email protected]>

Hi Darren,

I try now to better explain what I am trying to do.

In IDL I have 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 client uses the getNew function to get a new placeCorba:

class obj_Place : virtual public POA_eLockidl::placeCorba {
	public:
			obj_Place(table* inTable);
		virtual	~obj_Place();

		char*	getDescription(); 
		void	setDescription(const char* inDescription);
		void	save();
	private:
		char*	description;
};.

class vdb_placetable: public table, virtual public POA_eLockidl::placetableCorba {
	public:
		vdb_placetable();
		~vdb_placetable();
	public:
		::eLockidl::placeCorba_ptr getNew();
};
//
// This method returns an obj_Place object
//
::eLockidl::placeCorba_ptr	vdb_placetable::getNew() {
		//return new obj_Place(this);
		return	(::eLockidl::placeCorba_ptr) new obj_Place(this);
		}


I am using the default RootPoa and one servant:
Server
	vdb_placetable* serv_vdbplacetable = new vdb_placetable();
	CORBA::String_var s;
	FILE* fileref;
	eLockidl::placetableCorba_var aaa = serv_vdbplacetable->_this();
	s = orb->object_to_string(aaa);
	fileref = fopen("P:/placetable.ref","w");
	fclose(fileref);
	manager->activate();
	orb->run();

Client
	static int run(org.omg.CORBA.ORB orb) {
		org.omg.CORBA.Object objPlace = null;
		try {
			String refFile;
			String refData;
			BufferedReader inBuf;
			refFile = "P:/placetable.ref";
			inBuf = new BufferedReader(new FileReader(refFile));
			refData = inBuf.readLine();
			objPlace = orb.string_to_object(refData);
		}
		catch(java.io.IOException ex) {
			ex.printStackTrace();
			return 1;
		}
		placetableCorba newPlace = placetableCorbaHelper.narrow(objPlace);
		System.out.println("---------- newPlace ----------");
		placeCorba myPlace;
		System.out.println("---------- placeCorbaHelper.narrow(objPlace); ----------");
		myPlace = newPlace.getNew();
		System.out.println("---------- newPlace.getNew(); ----------");
		myPlace.setDescription("bla bla");
		myPlace.save();
		System.out.println("---------- Ende ----------");
		return 0;

 It's now urgent for me to find a solution and I hope I will get some informations to find my failure quickly.
 Thanks a lot for your help. I need to be able to go on with my project during the weekend.
Regards,
Jean-Louis



-----Ursprüngliche Nachricht-----
Von: Decoster Jean Louis 
Gesendet: Mittwoch, 7. Dezember 2005 09:18
An: 'Darren Middleman'
Cc: [email protected]
Betreff: AW: [OB-Users] Problem testing corba application



Hi Darren
Here is the code of getNew()

::eLockidl::placeCorba_ptr	vdb_placetable::getNew() {
		//return new obj_Place(this);
		return	(::eLockidl::placeCorba_ptr) new obj_Place(this);
		}

I hope you will can help me
Thanks for your support
Regards,
Jean-Louis

-----Ursprüngliche Nachricht-----
Von: Darren Middleman [mailto:[email protected]] 
Gesendet: Mittwoch, 7. Dezember 2005 00:53
An: Decoster Jean Louis
Cc: [email protected]
Betreff: Re: [OB-Users] Problem testing corba application

Hi Jean-Louis,

> I am testing some codes using a c++ server and a java client with
> orbacus solution.
> 
> When I perform a request from the client, the server side stops with the
> following:
> 
> C++ console:
> 
> Warning: Servant method raised a non-CORBA exception
> Client receives this exception as CORBA::UBKNOWN
> Operation name:"getNew"
> Id: iiop
> Locale address: ...:2480
> Remote address: .....2490
> 
> Debug window:
> 
> Thread 0xE94 wurde mit Code 0 (0x0) beendet.
> Nicht abgefangene Ausnahme in Cons.exe (OB430D.DLL): 0xC0000005: Access
> Violation.
> Nicht abgefangene Ausnahme in Cons.exe: 0xC0000005: Access Violation.
> Nicht abgefangene Ausnahme in Cons.exe (KERNEL32.DLL): 0xE06D7363:
> Microsoft C++ Exception.
> Nicht abgefangene Ausnahme in Cons.exe (KERNEL32.DLL): 0xE06D7363:
> Microsoft C++ Exception. 
> 
> Skeleton trace:
> 
> void
> POA_TestIdl::placetableCorba::_OB_op_getNew(OB::Upcall_ptr _ob_up)
> {
>     _OB_preUnmarshal(_ob_up);
>     _OB_postUnmarshal(_ob_up);
>     ::TestIdl::placeCorba_var _ob_r = getNew();
>     _OB_postinvoke(_ob_up);
>     OB::OutputStreamImpl* _ob_out = _OB_preMarshal(_ob_up);
>     OBMarshal(_ob_r.in(), _ob_out);
>     _OB_postMarshal(_ob_up);
> }
>  
> void
> OBMarshal(TestIdl::placeCorba_ptr _ob_v, OB::OutputStreamImpl* _ob_out)
> {
>     _ob_out -> write_Object(_ob_v);  System crash during execution of
> this statement !
> }
> 
> I am confused with this failure. Can you help me or send me
> information's how to proceed to solve such failures? 
> 
> Thank you very much for your prompt answer.
> 
> Sincerely yours
> 
> Jean-Louis Decoster

I don't see anything out of the ordinary in the code you provided with your
email.  My guess at the moment is that whatever is being returned from the
'getNew()' function (called in your '_OB_op_getNew()' function) is not 
quite correct and it causes problems later when you try to write the object 
to the stream.  Could you forward the code to the 'getNew()' function so I 
can see what you are returning?

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