Re: Unexpected return type from space.read()

Zsolt Kúti <[email protected]>
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <20060627144529.11eae5fc@tinca>
Hello,

In the meantime tracked outrigger sources down to this:

final Object rslt = 
                space.read(repFor(tmpl), txn, serverTimeout,
queryCookie); if (rslt == null) {
                // should never get null from a non-ifExists query
                throw new AssertionError("space.read() returned null");
            } else if (rslt instanceof EntryRep) {
                // Got an answer, return it
                return entryFrom((EntryRep)rslt);
            } else if (rslt instanceof OutriggerServer.QueryCookie) {
                /* Will still want to go on if there is time, but pass
                 * the new cookie
                 */
                queryCookie = (OutriggerServer.QueryCookie)rslt;
            } else {
                throw new AssertionError(
                    "Unexpected return type from space.read()");
            }

Although my IDE shows for rslt (on reading space):
EntryRep[kuti.service.DealEntry]

the conditional fails regardless:
} else if (rslt instanceof EntryRep) {


resulting in AssertError (I realized why exception handling part works
so)

I'm puzzled...

Zsolt


On Tue, 27 Jun 2006 04:16:46 -0600
Zsolt Kúti <[email protected]> wrote:

> Hello,
> 
> I am a newbie at Jini/JS and now experimenting with them (as of 2.1).
> Successfully wrote a Jini service, that can be seen in Browser (phuh,
> took some time resolve some codebase issue). This service writes into
> a space (the one started by Jini starter kit), the entry written can
> be seen among the Javaspace05 instance's entries. So far...
> Now, as I try to read it back I get the following:
> 
> java.rmi.ServerError: Error in server thread; nested exception is:
>  java.lang.AssertionError: Unexpected return type from space.read()
>  at
> net.jini.jeri.BasicInvocationDispatcher.dispatch(BasicInvocationDispatcher.java:647)
>  at
> com.sun.jini.jeri.internal.runtime.ObjectTable$6.run(ObjectTable.java:597)
> at
> net.jini.export.ServerContext.doWithServerContext(ServerContext.java:103)
> at
> com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch0(ObjectTable.java:595)
> at
> com.sun.jini.jeri.internal.runtime.ObjectTable$Target.access$700(ObjectTable.java:212)
> at
> com.sun.jini.jeri.internal.runtime.ObjectTable$5.run(ObjectTable.java:568)
> at java.security.AccessController.doPrivileged(Native Method) at
> com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:565)
> at
> com.sun.jini.jeri.internal.runtime.ObjectTable$Target.dispatch(ObjectTable.java:540)
> at
> com.sun.jini.jeri.internal.runtime.ObjectTable$RD.dispatch(ObjectTable.java:778)
> at
> net.jini.jeri.connection.ServerConnectionManager$Dispatcher.dispatch(ServerConnectionManager.java:148)
> at com.sun.jini.jeri.internal.mux.MuxServer$2.run(MuxServer.java:244)
> at java.security.AccessController.doPrivileged(Native Method) at
> com.sun.jini.jeri.internal.mux.MuxServer$1.run(MuxServer.java:241) at
> com.sun.jini.thread.ThreadPool$Worker.run(ThreadPool.java:136) at
> java.lang.Thread.run(Thread.java:595) at
> com.sun.jini.jeri.internal.runtime.Util.__________EXCEPTION_RECEIVED_FROM_SERVER__________(Util.java:108)
> at
> com.sun.jini.jeri.internal.runtime.Util.exceptionReceivedFromServer(Util.java:101)
> at
> net.jini.jeri.BasicInvocationHandler.unmarshalThrow(BasicInvocationHandler.java:1303)
> at
> net.jini.jeri.BasicInvocationHandler.invokeRemoteMethodOnce(BasicInvocationHandler.java:832)
> at
> net.jini.jeri.BasicInvocationHandler.invokeRemoteMethod(BasicInvocationHandler.java:659)
> at
> net.jini.jeri.BasicInvocationHandler.invoke(BasicInvocationHandler.java:528)
> at $Proxy1.takeOut(Unknown Source) at
> kuti.client.CreditApplicationClient.discovered(CreditApplicationClient.java:76)
> at net.jini.discovery.LookupDiscovery$1.run(LookupDiscovery.java:977)
> 
> 
> The code fragment doing this has nothing special:
>         DealEntry d = new DealEntry(n);
>         try {
>             Entry en = space.read(d, null, 10000L);
>         }
>         catch(Exception e) {...}
> 
> Further strange thing is that despite catch presence it doesn't show
> up at server side, but on client side does.
> 
> I've no idea what I do wrong and  could'nt find any hint on the web.
> 
> Thanks for your help!
> 

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.