Discussion:
[omniORB] BAD_TYPECODE: Java <--> Python
EntonH
2009-02-04 20:18:55 UTC
Permalink
Hello Community,

i want to use the omniORB implementation for Python to communicate with a
server that was programmed in Java.
The return type of the called Java-Method is a Object[]. Everytime I call
this method, I receive the BAD_TYPECODE Error.

In the IDL file the method is declared as follows:
any getVariable(in string Name)raises(Exception);

The any instance on java side inherits from
com.sun.corba.se.internal.corba.AnyImpl which inherits from
org.omg.CORBA.Any.

The any data type on java side is filled with
insertObjectArray(org.omg.CORBA.Any a, Object[] objArray).

Do i have to cast the return type before i assign it to a variable on python
client side?

Or is python or omniPy not compatible to the java plugin?

Greetings
EntonH
--
View this message in context: http://www.nabble.com/BAD_TYPECODE%3A-Java-%3C--%3E-Python-tp21831331p21831331.html
Sent from the OmniORB - User mailing list archive at Nabble.com.
Duncan Grisby
2009-02-05 21:42:00 UTC
Permalink
Post by EntonH
i want to use the omniORB implementation for Python to communicate with a
server that was programmed in Java.
The return type of the called Java-Method is a Object[]. Everytime I call
this method, I receive the BAD_TYPECODE Error.
Did you start with a hand-written IDL file, or have you generated the
IDL from the Java with rmic? rmic is famous for generating broken
IDL...
Post by EntonH
any getVariable(in string Name)raises(Exception);
The any instance on java side inherits from
com.sun.corba.se.internal.corba.AnyImpl which inherits from
org.omg.CORBA.Any.
The any data type on java side is filled with
insertObjectArray(org.omg.CORBA.Any a, Object[] objArray).
Do i have to cast the return type before i assign it to a variable on python
client side?
I don't understand what your Java code looks like. Can you post a
minimal example of it? What does the implementation of the
getVariable() method look like?

Run your omniORB client with command line -ORBtraceExceptions 1 . That
will tell you where the BAD_TYPECODE exception comes from. If it comes
from GIOP_C.cc, then the server sent the exception and the problem has
nothing to do with omniORB. If it comes from anywhere else, then omniORB
generated it and the problem could be on either side.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
entonh at gmx.de ()
2009-02-06 17:06:59 UTC
Permalink
Here is an extract from the java implementation:

public Any getVariable(String Name) throws Exception
{
try
{
Object[] objectArray = Server.getVariable(Name);
org.omg.CORBA.Any aAny = orb.create_any();
HelperJava.insertObjectArray(aAny, objectArray);
return aAny;
}
catch (Exception e)
{
throw new Exception(e.getMessage());
}
}

The message after calling getVariable by the python client sounds like:

Exception: BAD_TYPECODE ... COMPLETED YES

The idl was created before the programming started.

Cheers,
EntonH

-------- Original-Nachricht --------
Datum: Thu, 05 Feb 2009 15:41:57 +0000
Betreff: Re: [omniORB] BAD_TYPECODE: Java <--> Python
Post by EntonH
i want to use the omniORB implementation for Python to communicate with
a
Post by EntonH
server that was programmed in Java.
The return type of the called Java-Method is a Object[]. Everytime I
call
Post by EntonH
this method, I receive the BAD_TYPECODE Error.
Did you start with a hand-written IDL file, or have you generated the
IDL from the Java with rmic? rmic is famous for generating broken
IDL...
Post by EntonH
any getVariable(in string Name)raises(Exception);
The any instance on java side inherits from
com.sun.corba.se.internal.corba.AnyImpl which inherits from
org.omg.CORBA.Any.
The any data type on java side is filled with
insertObjectArray(org.omg.CORBA.Any a, Object[] objArray).
Do i have to cast the return type before i assign it to a variable on
python
Post by EntonH
client side?
I don't understand what your Java code looks like. Can you post a
minimal example of it? What does the implementation of the
getVariable() method look like?
Run your omniORB client with command line -ORBtraceExceptions 1 . That
will tell you where the BAD_TYPECODE exception comes from. If it comes
from GIOP_C.cc, then the server sent the exception and the problem has
nothing to do with omniORB. If it comes from anywhere else, then omniORB
generated it and the problem could be on either side.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- http://www.grisby.org --
--
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL
f?r nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
Duncan Grisby
2009-02-10 23:38:53 UTC
Permalink
Post by entonh at gmx.de ()
public Any getVariable(String Name) throws Exception
{
try
{
Object[] objectArray = Server.getVariable(Name);
org.omg.CORBA.Any aAny = orb.create_any();
HelperJava.insertObjectArray(aAny, objectArray);
return aAny;
}
catch (Exception e)
{
throw new Exception(e.getMessage());
}
}
Exception: BAD_TYPECODE ... COMPLETED YES
The idl was created before the programming started.
OK. You didn't answer the other part about the output from
-ORBtraceExceptions 1 . What does that say?

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
entonh at gmx.de ()
2009-02-11 19:32:07 UTC
Permalink
Hello Duncan,

I tried to use your advice. Where do I have to pass this parameter?

Or is this the message that can help you to figure out where the error comes from?

omniORB: Error in network receive (start of message): giop:tcp:10.184.193.56:373
1
omniORB: throw giopStream::CommFailure from giopStream.cc:874(0,NO,COMM_FAILURE_
UnMarshalArguments)

Greetings,
EntonH

-------- Original-Nachricht --------
Datum: Tue, 10 Feb 2009 17:38:51 +0000
Betreff: Re: [omniORB] BAD_TYPECODE: Java <--> Python
Post by entonh at gmx.de ()
public Any getVariable(String Name) throws Exception
{
try
{
Object[] objectArray = Server.getVariable(Name);
org.omg.CORBA.Any aAny = orb.create_any();
HelperJava.insertObjectArray(aAny, objectArray);
return aAny;
}
catch (Exception e)
{
throw new Exception(e.getMessage());
}
}
Exception: BAD_TYPECODE ... COMPLETED YES
The idl was created before the programming started.
OK. You didn't answer the other part about the output from
-ORBtraceExceptions 1 . What does that say?
Duncan.
--
-- Duncan Grisby --
-- http://www.grisby.org --
--
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL
f?r nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
Duncan Grisby
2009-02-20 16:30:11 UTC
Permalink
Post by entonh at gmx.de ()
I tried to use your advice. Where do I have to pass this parameter?
On the command line. Which you clearly have done...
Post by entonh at gmx.de ()
Or is this the message that can help you to figure out where the error
comes from?
omniORB: Error in network receive (start of message): giop:tcp:10.184.193.56:373
1
omniORB: throw giopStream::CommFailure from giopStream.cc:874(0,NO,COMM_FAILURE_
UnMarshalArguments)
That shows that you have the right parameter set. But you need to send
us the line that mentions the BAD_TYPECODE exception. That's the one you
care about.

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Loading...