RMI Problem --> java.rmi.UnmarshalException:

I am having a client and a server.... when i am trying to bring the client into server. but when i am doing it... i am getting an exception as below as...

java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:

java.io.EOFException

at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)

at sun.rmi.server.UnicastRef.invoke(Unknown Source)

at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)

at java.rmi.Naming.lookup(Unknown Source)

at hsmsgui.rmtmgmt.RmtMgmtHandler.contactClient(RmtMgmtHandler.java:176)

at hsmsgui.display.AddClientWzd.onFinishBtnClicked(AddClientWzd.java:488)

at hsmsgui.display.AddClientWzd.actionPerformed(AddClientWzd.java:346)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.Dialog$1.run(Unknown Source)

at java.awt.Dialog$3.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.awt.Dialog.show(Unknown Source)

at hsmsgui.display.AddClientAction.actionPerformed(AddClientAction.java:38)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

Caused by: java.io.EOFException

at java.io.DataInputStream.readByte(Unknown Source)

... 60 more

can any one help me out to solve this problem.......

[4440 byte] By [PalHoneya] at [2007-11-27 1:57:30]
# 1
Is there a ClassNotFoundException anywhere in the complete stack trace?And why are you contacting clients via the Registry? Normally you only put one server in there per server JVM.
ejpa at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 2

Is there a ClassNotFoundException anywhere in the complete stack trace?

No there is no ClassNotFoundException.

Sometimes the client is getting added with the server . in some cases i getting this error message.

And why are you contacting clients via the Registry? Normally you only put one server in there per server JVM.

yes in this case if u r going to add the client to the server the registry count will be increased. here also one server per server JVM....

PalHoneya at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 3
Is the client really a server? or is it exporting callbacks? in which case they would normally be registered directly with the server, not bound into a Registry.
ejpa at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 4

Thanks for ur reply...Now i' m getting the access denied problem..

I am able to create the rmi registry successfully on the server, Then Binding is also done successfully. but when i try to connect the client to the server the exception is thrownPlease help me..

TEST - client PC name.

java.security.AccessControlException: access denied (java.net.SocketPermission TEST resolve)

at java.security.AccessControlContext.checkPermission(Unknown Source)

at java.security.AccessController.checkPermission(Unknown Source)

at java.lang.SecurityManager.checkPermission(Unknown Source)

at java.lang.SecurityManager.checkConnect(Unknown Source)

at java.net.InetAddress.getAllByName0(Unknown Source)

at java.net.InetAddress.getAllByName0(Unknown Source)

at java.net.InetAddress.getAllByName(Unknown Source)

at java.net.InetAddress.getByName(Unknown Source)

at java.net.InetSocketAddress.<init>(Unknown Source)

at java.net.Socket.<init>(Unknown Source)

at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)

at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)

at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)

at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)

at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)

at sun.rmi.server.UnicastRef.newCall(Unknown Source)

at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)

at java.rmi.Naming.lookup(Unknown Source)

at hsmsgui.rmtmgmt.RmtMgmtHandler.contactClient(RmtMgmtHandler.java:176)

at hsmsgui.display.AddClientWzd.onFinishBtnClicked(AddClientWzd.java:488)

at hsmsgui.display.AddClientWzd.actionPerformed(AddClientWzd.java:346)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.Dialog$1.run(Unknown Source)

at java.awt.Dialog$3.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.awt.Dialog.show(Unknown Source)

at hsmsgui.display.AddClientAction.actionPerformed(AddClientAction.java:38)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

PalHoneya at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 5
So you have a security manager in the client, so you need to grant it the appropriate SocketPermissions to make that connection.
ejpa at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 6

I have already changed the java.policy file and i have given the permission

i took the policy file from the beow directory

D:\Program Files\Java\jdk1.5.0_06\jre\lib\security\java.poicy

and added the below line

permission java.net.SocketPermission "*:1024-65535", "accept,connect ,resolve,listen";

but still i'm not abe to solve the problem.. can u please help me out..

PalHoneya at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 7
Run it with -Djava.security.debug=access,failure and show what it prints.
ejpa at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 8
can u pls explain me in detail how should i run the command that was sent by u.
PalHoneya at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 9
http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/java.html http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html
ejpa at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 10
I am using Eclipse to run the server GUI. and in that how can i use these commands.
PalHoneya at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 11
now i am able to get the client into the server when i am running it through the Eclipse 3.2. But i am unable to add the client into the server through the setup which i created. can u help me out......
PalHoneya at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 12
As I don' t know anything about 'the setup which [you] created' the answer is obviously 'no', but all you have to do is add that argument to the java command line wherever it is.
ejpa at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...
# 13
Thank you very much for the reply the problem is now solved.......
PalHoneya at 2007-7-12 1:33:08 > top of Java-index,Core,Core APIs...