RE: a question about rmi sample
Jon Tirsén <[email protected]> Fri, 6 Jun 2003 20:27:25 +0200
| Newsgroups | gmane.comp.java.nanning.devel |
|---|---|
| Message-ID | <003e01c32c59$486f48b0$6c4a59d5@jon> |
A great help would be if you added a failing test-case to the RemoteCallServerTest. Feel free to modify any other part of the tests. Just send me the files you changed and I will try to implement it if I get time. > -----Original Message----- > From: [email protected] [mailto:nanning- > [email protected]] On Behalf Of yiming wang > Sent: den 5 juni 2003 09:22 > To: [email protected] > Subject: Re: [Nanning-developer] a question about rmi sample > > hi jon, > > Every thing is ok now! > i can use "MyObject" in client side, any operation on > that object will be result at server side. > > more step, i meet another problem: > > In MyStatelessService.java, add following codes > public Collection getAllObjects(); > > then in MyStatelessServiceImpl.java > public Collection getAllObjects() { > return > ((MySystem)CurrentPrevayler.getSystem()).getAllObjects(); > } > > test code: > Collection col = myService.getAllObjects(); > for (Iterator it = col.iterator(); it.hasNext();) { > MyObject o2 = (MyObject)it.next(); > String v2 = o2.getValue(); > System.out.println("value: " + v2); > } > > run test case with "java -ea", but throws following > exception: > java.lang.ClassCastException > at > com.tirsen.nanning.samples.rmi.RemoteAspect.invoke(RemoteAspect.java:21) > at > com.tirsen.nanning.MixinInstance$InvocationImpl.invokeNext(MixinInstance .j > ava:96) > at > com.tirsen.nanning.MixinInstance.invokeMethod(MixinInstance.java:164) > at > com.tirsen.nanning.AspectInstance.invoke(AspectInstance.java:96) > at $Proxy2.getValue(Unknown Source) > at > com.tirsen.nanning.samples.rmi.RemoteCallServerTest.testStatelessRemoteC al > l(RemoteCallServerTest.java:90) > .... > > MyObject has been already add @remote tag, but when > they in a Collection, they can't be marshal as remote > stub, is it current restrict? any solution to resolve > such requirement? > > thanks again! > > --- Jon Tirsén <[email protected]> wrote: > > Ni hao! > > > > Try to make sure that the attributes really are > > loaded, for example do: > > assertTrue(Attributes.hasAttribute(MyObject.class, > > "remote")); > > > > Also try to execute java with asserts enabled, ie: > > "java -ea". You may get a different more helpful > > error-message. > > > > If this doesn't help you either I need to look > > deeper > > into the problem. I can to that later this weekend. > > > > --- yiming wang <[email protected]> skrev: > > > 唐杰: > > > 你好! > > > Firstly, i wish your speach on Nanning will > > get > > > successful. > > > > > > I am sure the attributes are correct, because > > > the > > > other test cases can pass with no problem. > > > > > > As your said: > > > "Basically the framework doesn't know that it > > > should > > > marshal this object as a client stub and > > > therefor > > > the object is incorrect on the client side." > > > > > > I guess that it is usage of aspect instance in > > > > > client side, may be not a bug. so, how to declare > > > "MyObject.java" then it can be marshal as a client > > > stub? > > > > > > i have been add @remote and @service tag to > > > "MyObject.java", but not work. > > > > > > 王亦明 > > > 2003.6.3 > > > > > > --- Jon Tirsén <[email protected]> wrote: > > > > I am currently in London and using an internet > > > cafe > > > > to > > > > answer. Therefor I don't have access to the code > > > and > > > > can't verify this. But... > > > > > > > > I think you haven't compiled the attributes or > > > > haven't > > > > included them in the classpath or haven't added > > it > > > > to > > > > the search-path with Attributes.addSearchPath. > > > > Basically the framework doesn't know that it > > > should > > > > marshal this object as a client stub and > > therefor > > > > the > > > > object is incorrect on the client side. > > > > > > > > If the error persists please answer back and I > > > will > > > > try to have a closer look at this when I get > > back > > > > from > > > > London. > > > > > > > > Btw, if any of you guys are in London tomorrow > > > > evening > > > > come by XTC. I will be there and might give an > > > > improvised speach on Nanning. See > > > > www.xpdeveloper.com > > > > > > > > Tip: If you execute Nanning with assertions > > > enabled > > > > (using java -ea) better error-messages will > > > appear. > > > > > > > > tang jie > > > > > > > > --- yiming wang <[email protected]> skrev: > hi > > > jon, > > > > > > > > > > In MyStatelessService.java, add following > > codes: > > > > > > > > > > public MyObject getMyObject(); > > > > > > > > > > then, in MyStatelessServiceImpl.java: > > > > > > > > > > public MyObject getMyObject() { > > > > > return > > > > > > > > > > > > > > > ((MySystem)CurrentPrevayler.getSystem()).getMyObject(); > > > > > } > > > > > > > > > > finally, in RemoteCallServerTest.java, add > > > > following > > > > > test codes: > > > > > > > > > > MyObject myObject = myService.getMyObject(); > > > > > String value = myObject.getValue(); > > > > > > > > > > when i run the test case, throws the following > > > > > exception: > > > > > > > > > > java.lang.ClassCastException > > > > > at > > > > > > > > > > > > > > > com.tirsen.nanning.samples.rmi.RemoteAspect.invoke(RemoteAspect.java:21) > > > > > at > > > > > > > > > > > > > > > com.tirsen.nanning.MixinInstance$InvocationImpl.invokeNext(MixinInstance .j > ava:96) > > > > > at > > > > > > > > > > > > > > > com.tirsen.nanning.MixinInstance.invokeMethod(MixinInstance.java:164) > > > > > at > > > > > > > > > > > > > > > com.tirsen.nanning.AspectInstance.invoke(AspectInstance.java:96) > > > > > at $Proxy2.getValue(Unknown Source) > > > > > at > > > > > > > > > > > > > > > com.tirsen.nanning.samples.rmi.RemoteCallServerTest.testStatelessRemoteC al > l(RemoteCallServerTest.java:77) > > > > > at > > > > > > > > > > > > > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native > > > > > Method) > > > > > at > > > > > > > > > > > > > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a: > 39) > > > > > at > > > > > > > > > > > > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Im > pl.java:25) > > > > > at > > > > java.lang.reflect.Method.invoke(Method.java:324) > > > > > at > > > > > > > > > > > > > > junit.framework.TestCase.runTest(TestCase.java:154) > > > > > at > > > > > > > > > > > > > > junit.framework.TestCase.runBare(TestCase.java:127) > > > > > at > > > > > > > > > > > > > > > junit.framework.TestResult$1.protect(TestResult.java:106) > > > > > at > > > > > > > > > > > > > > > junit.framework.TestResult.runProtected(TestResult.java:124) > > > > > at > > > > > > > > > > > > > > junit.framework.TestResult.run(TestResult.java:109) > > > > > at > > > > junit.framework.TestCase.run(TestCase.java:118) > > > > > at > > > > > > > > > > > > > > > junit.framework.TestSuite.runTest(TestSuite.java:208) > > > > > at > > > > > > > > junit.framework.TestSuite.run(TestSuite.java:203) > > > > > ...... > > > > > > > > > > how to resolve such problem? > > > > > > > > > > i have two scenarios: > > > > > 1. at client, i only use MyObject to get Data, > > > not > > > === message truncated === > > > __________________________________ > Do you Yahoo!? > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). > http://calendar.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The best > thread debugger on the planet. Designed with thread debugging features > you've never dreamed of, try TotalView 6 free at www.etnus.com. > _______________________________________________ > Nanning-developer mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nanning-developer ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com.