<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community</title>
		<link>http://www.daniweb.com/forums/</link>
		<description>Tech support, programming, web development, and internet marketing community. Forums to get free computer help and support.</description>
		<language>en-US</language>
		<lastBuildDate>Fri, 04 Dec 2009 19:17:38 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>java RMI: Exception, java.io.EOFException</title>
			<link>http://www.daniweb.com/forums/thread239188.html</link>
			<pubDate>Tue, 17 Nov 2009 11:58:05 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I'm writing my first RMI application, it's an auction system. At the end of the auction period for a particular item the server sends a 'callback' to the winning client telling him that he's won. It works fine till here, but after that i get this exception. It shows on the client console,...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I'm writing my first RMI application, it's an auction system. At the end of the auction period for a particular item the server sends a 'callback' to the winning client telling him that he's won. It works fine till here, but after that i get this exception. It shows on the client console, but i suspect it's coming from the server. Any clues what's going on here? Please let me know if you need to see the client or server code.<br />
<br />
I use java rmi client and server. <br />
This is the exception below:<br />
<br />
<img src="/cgi-bin/mimetex.cgi?java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: <br />
	java.io.EOFException<br />
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:209)<br />
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)<br />
	at das.auction.client.ClientDriver_Stub.notify(Unknown Source)<br />
	at das.auction.server.RemoteAuctionImpl.notifyWinnerInfo(RemoteAuctionImpl.java:220)<br />
	at das.auction.server.RemoteAuctionImpl$BidTimeReached.run(RemoteAuctionImpl.java:75)<br />
	at java.util.TimerThread.mainLoop(Timer.java:512)<br />
	at java.util.TimerThread.run(Timer.java:462)<br />
Caused by: java.io.EOFException<br />
	at java.io.DataInputStream.readByte(DataInputStream.java:250)<br />
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:195)<br />
	... 6 more<br />
" alt="java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: <br />
	java.io.EOFException<br />
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:209)<br />
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)<br />
	at das.auction.client.ClientDriver_Stub.notify(Unknown Source)<br />
	at das.auction.server.RemoteAuctionImpl.notifyWinnerInfo(RemoteAuctionImpl.java:220)<br />
	at das.auction.server.RemoteAuctionImpl$BidTimeReached.run(RemoteAuctionImpl.java:75)<br />
	at java.util.TimerThread.mainLoop(Timer.java:512)<br />
	at java.util.TimerThread.run(Timer.java:462)<br />
Caused by: java.io.EOFException<br />
	at java.io.DataInputStream.readByte(DataInputStream.java:250)<br />
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:195)<br />
	... 6 more<br />
" border="0" /><br />
<br />
This is code where i call client callback method in server. the stack comes from the catch block of this method.<br />
 <pre style="margin:20px; line-height:13px">public void notifyWinnerInfo(String itemCodeId,String userId,Integer maxBidVal)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;update winner and notify clients&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Set&lt;Map.Entry&lt;Subscriber,UserInfo&gt;&gt; subsUserMapArray = subscriberList.entrySet();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Iterator it = subsUserMapArray.iterator();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Subscriber winner;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;# of elements in iterator &quot; + subsUserMapArray.size());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while(it.hasNext())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;element found&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Map.Entry&lt;Subscriber,UserInfo&gt; m = (Map.Entry&lt;Subscriber,UserInfo&gt;)it.next();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UserInfo uid = m.getValue();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Subscriber s = m.getKey();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(uid.getUID().equals(userId))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.notify(itemCodeId,maxBidVal,Boolean.TRUE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.notify(itemCodeId,maxBidVal,Boolean.FALSE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch(Exception re)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;UpdateUserBid&quot;); // This is where the stack comes from, i get this system.out<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; re.printStackTrace();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
This is the client code for this callback<br />
<br />
 <pre style="margin:20px; line-height:13px">public void notify(String itemCodeId,Integer maxBidVal,Boolean winner)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.print((char)27 + &quot;&#91;2J&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;server notification: &quot; + &quot; ItemCodeId: &quot; + itemCodeId + &quot; maxBidVal: &quot; + maxBidVal + &quot; winner?: &quot; + winner);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!winner)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Sorry, you were not the highest bidder&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Congrats !! you have won the bid for this item, Please see our website for payment options&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //sleep here for sometime then go to first screen again<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ClientStateMachine.nextItem = &quot;WELCOME&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ClientStateMachine.run();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</pre><br />
as soon as i do anything on the first screen now, i get the stack.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum9.html">Java</category>
			<dc:creator>Agni</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread239188.html</guid>
		</item>
	</channel>
</rss>
