RE: a question about rmi sample

yiming wang <[email protected]> Sat, 7 Jun 2003 00:12:37 -0700 (PDT)
Newsgroups gmane.comp.java.nanning.devel
Message-ID <[email protected]>
i modified 4 files, list below:
MyObject.java
MyStatelessService.java
MyStatelessServiceImpl.java
RemoteCallServerTest.java

and they are attached in test.zip file.
wish to do a little help.

--- Jon_Tirsén <[email protected]> wrote:
> 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: >
> > > ­ðªN¡G
> > > >     §A¦n¡I
> > > >     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() {
> 
=== message truncated ===

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
test.zip (application/zip, 2.5 KB) - not displayed