Topic
  • 1 reply
  • Latest Post - ‏2007-08-14T09:50:02Z by SystemAdmin
SystemAdmin
SystemAdmin
1215 Posts

Pinned topic How can I use a Java INTERFACE argument for Remote Client<--> Server Calls

‏2007-08-13T14:24:20Z |
Dear IBM Websphere Forum,

perhaps you can help me with my problem.
I use Websphere 6.1 and the related Application Client.
I use JRE-1.5

Communication between J2EE-Client side and J2EE-Server side seems to work.

I seem have to have a problem with serialization of an argument,
wich is a plain interface.
What has to be done different?

Yours,

Frank
I use this Interface to communicate between Client and Server.
The Client creates an instance iof this interface ....

public interface ChatRoomListener extends Serializable {
public void downloadMessage(String user, String message);
}

Inside the Client environment, I use these calls----------------
//chatIncomingMessages is a JTextArea instance to show the downloaded Messages


ChatRoom chatRoom= createChatRoom();

ChatRoomListener listener=new ChatRoomListener(){
private static final long serialVersionUID = -7779005097061534360L;
public void downloadMessage(String user, String message){
chatIncomingMessages.append(""user": "+ message+"\n\r");
}

};

if(chatRoom==null){
System.err.println("Error: createChatRoom: returned 'null'");
}else{
try{
chatRoom.addChatRoomListener(this.nickname, listener);
}catch(RemoteException re){
// TODO Auto-generated catch block
re.printStackTrace();
}

}



At the J2EE-Server Side, the code looks like this
attention: nicknamesListeners and chatterListeners
are Linked Lists of String/ChatRoomListeners



public void addChatRoomListener(String nickname, ChatRoomListener listener){
System.err.print("addChatRoomListener:");
System.err.flush();
for(int idx=0; idx < getInstance().nicknamesListeners.size();idx++){
if(getInstance().nicknamesListeners.get(idx).equals(nickname)){
// This nickanme already is logged in to this chatroom
return;
}

}

System.err.println(nickname);
System.err.flush();

getInstance().chatterListeners.add(listener);
getInstance().nicknamesListeners.add(nickname);

return;

}
=========================================
I receive this error context.
=========================================
java.rmi.MarshalException: CORBA MARSHAL 0x4942f89a No; nested exception is:
org.omg.CORBA.MARSHAL:

>> SERVER (id=4773e3aa, host=depoiw0wk11it39.als.avnet.eu) TRACE START:

>> org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge : null vmcid: IBM minor code: 89A completed: No

>> at com.ibm.rmi.iiop.CDRInputStream.read_value(CDRInputStream.java:2105)

>> at ejbs._EJSRemoteStatefulChatRoom_916715b1_Tie.addChatRoomListener(_EJSRemoteStatefulChatRoom_916715b1_Tie.java:181)

>> at ejbs._EJSRemoteStatefulChatRoom_916715b1_Tie._invoke(_EJSRemoteStatefulChatRoom_916715b1_Tie.java:105)

>> at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:613)

P.S.: if I use a class instead of an interface,
the AddChatRoomListener Caall works without any problem!

Public class ChatRoomListener implements Serializable{;}

Updated on 2007-08-14T09:50:02Z at 2007-08-14T09:50:02Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1215 Posts

    Re: How can I use a Java INTERFACE argument for Remote Client&lt;--&gt; Server Calls

    ‏2007-08-14T09:50:02Z  
    Hi Guys,

    I could trace the error upto the point, where the interface ChatRoomListener is fetched from the InputStream. It throws an Exception:

    cause NullPointerException
    detailMessage "Unable to read value from underlying bridge : null"

    The code is like this........................
    private OutputStream addChatRoomListener(org.omg.CORBA_2_3.portable.InputStream in , ResponseHandler reply) throws Throwable {
    String arg0 = (String) in.read_value(String.class);
    ChatRoomListener arg1 = (ChatRoomListener) in.read_value(ChatRoomListener.class); // here is a null exception thrown
    target.addChatRoomListener(arg0, arg1);
    OutputStream out = reply.createReply();
    return out;
    }