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

non-void return values in Orbix

1 view
Skip to first unread message

dave jepson

unread,
Jun 11, 2003, 11:29:35 AM6/11/03
to
Hi,

Generally the methods in my CORBA app return void.

I recently added some new stuff and one of the new methods returns a
boolean.
Now the implementation generates an exception after my code has run,
but during marshalling the reply to the client.

If I change the IDL to make the return value void, no exception is
generated.

I've tried changing it to string and short, and the same exception
happens - only voids work!!!!

I've come up with a test case with exhibits this behaviour, and have
posted the IDL, and 2 Java sources (client and server) if anyone is
interested.

I'm using HP-UX 11i, Java 1.3.1_01, and Orbix 3.3.4

I can supply the test case tarball if you like - it includes the
makefiles/start scripts etc - email me direct.

Kind regards, Dave

===================================================
Here's the exception (Orbix diagnostics at 255):
===================================================

[ ServerRequest["testCall"]: marshalling reply result ]
[ ServerRequest["testCall"]: unexpected java exception encountered
dispatching request : java.lang.ClassCastException:
com.sun.corba.se.internal.corba.AnyImpl ]
java.lang.ClassCastException: com.sun.corba.se.internal.corba.AnyImpl
at IE.Iona.OrbixWeb.CORBA.ServerRequest.marshalResult(ServerRequest.java:543)
at IE.Iona.OrbixWeb.CORBA.ServerRequest.marshalReplyArgs(ServerRequest.java:506)
at IE.Iona.OrbixWeb.CORBA.ServerDispatcher.dispatch(ServerDispatcher.java:241)
at IE.Iona.OrbixWeb.CORBA.ServerDispatcher.system_dispatch(ServerDispatcher.java:139)
at IE.Iona.OrbixWeb.CORBA.BOAImpl.processRequest(BOAImpl.java:289)
at IE.Iona.OrbixWeb.CORBA.BOAImpl.processOneEvent(BOAImpl.java:195)
at IE.Iona.OrbixWeb.CORBA.BOAImpl.processEvents(BOAImpl.java:605)
at IE.Iona.OrbixWeb.CORBA.EventHandler.run(EventHandler.java:177)
at java.lang.Thread.run(Unknown Source)
[ ServerRequest["testCall"]: corba system exception thrown, returning
it to client ]

===================================================
Here's the interface
===================================================

module test
{
module idl
{
interface Manager
{
boolean testCall();
};
};
};


===================================================
Here's my server implementation
===================================================

package test;

import org.omg.CORBA.ORB;
import IE.Iona.OrbixWeb._OrbixWeb;

import test.idl._ManagerOperations;
import test.idl._tie_Manager;

public class TestServer implements _ManagerOperations
{
public static void main( String[] args )
{
try
{
TestServer testServer = new TestServer();
}
catch ( Exception e )
{
e.printStackTrace();
}
}

public TestServer()
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init( new String[]{},
null );
final String serverName = System.getProperties().getProperty(
"OrbixWeb.serverName" );
_OrbixWeb.ORB(orb).setServerName( serverName );
_OrbixWeb.ORB(orb).noReconnectOnFailure(true);
_OrbixWeb.ORB(orb).setConfigItem("IT_BIND_USING_IIOP",
String.valueOf(true));
_OrbixWeb.ORB(orb).setConfigItem( "IT_IMPL_READY_IF_CONNECTED",
String.valueOf(true));

_tie_Manager _managerTie = new _tie_Manager( this, "server" );
}

public boolean testCall()
{
return true;
}
}


===================================================
and here's my client
===================================================


package test;

import org.omg.CORBA.ORB;
import org.omg.CORBA.SystemException;
import IE.Iona.OrbixWeb.*;

import test.idl.Manager;
import test.idl.ManagerHelper;

class TestClient
{
public static void main ( String args [] )
{
TestClient t = new TestClient();
}

public TestClient()
{
ORB orb = ORB.init(new String[]{}, null);
_OrbixWeb.ORB(orb).setConfigItem("IT_BIND_USING_IIOP",
String.valueOf(true));
_OrbixWeb.ORB(orb).setConfigItem( "IT_IMPL_READY_IF_CONNECTED",
String.valueOf(true));

boolean bound = false;
Manager manager = null;

while ( ! bound )
{
try
{
System.out.println( "Binding ..." );
manager = ManagerHelper.bind( "server:Server", "localhost"
);
bound = true;
System.out.println( "Bound" );
}
catch ( Throwable t )
{
System.out.println( t.toString() );
try
{
Thread.currentThread().sleep( 1000 );
}
catch ( InterruptedException e )
{
// no worries
}
}
}

boolean result = manager.testCall();
System.out.println( "result=[" + result + "]" );
}
}

Brian Kelly

unread,
Jun 11, 2003, 10:55:56 PM6/11/03
to
Hi Dave,

> I recently added some new stuff and one of the new methods returns a
> boolean.
> Now the implementation generates an exception after my code has run,
> but during marshalling the reply to the client.

<snip>

> [ ServerRequest["testCall"]: marshalling reply result ]
> [ ServerRequest["testCall"]: unexpected java exception encountered
> dispatching request : java.lang.ClassCastException:
> com.sun.corba.se.internal.corba.AnyImpl ]
> java.lang.ClassCastException: com.sun.corba.se.internal.corba.AnyImpl
> at
IE.Iona.OrbixWeb.CORBA.ServerRequest.marshalResult(ServerRequest.java:543)
> at
IE.Iona.OrbixWeb.CORBA.ServerRequest.marshalReplyArgs(ServerRequest.java:506
)

Looks like you're picking up the internal JDK ORB classes,
which is definitely going to cause problems. Have you set
the usual 2 override properties to force these classes to
be ignored?

For more information on these overrides:
http://www.iona.com/support/docs/manuals/orbix/33/html/orbix33java_pguide/GettingStartedJava.html

Hope this helps,

Brian
IONA Technologies

dave jepson

unread,
Jun 12, 2003, 5:40:52 AM6/12/03
to
> Looks like you're picking up the internal JDK ORB classes,
> which is definitely going to cause problems. Have you set
> the usual 2 override properties to force these classes to
> be ignored?
>
> For more information on these overrides:
> http://www.iona.com/support/docs/manuals/orbix/33/html/orbix33java_pguide/GettingStartedJava.html

Brian, thank you very much.

I had this definition

-Dorg.omg.CORBA.ORB=IE.Iona.OrbixWeb.CORBA.ORB

but needed this one

-Dorg.omg.CORBA.ORBSingletonClass=IE.Iona.OrbixWeb.CORBA.singletonORB

in my start script. In my case, adding this to the server start script
suffices.

I don't understand why yet, but this class must have something to do
with enabling return values. Its amazes me we haven't hit this sooner.
Our 3 year old system has never used return values until now.

Anyway, thanks again.

Dave

0 new messages