This is my client code: 

public class Client 
{
        IUserService userService;
        
        

        public IUserService getUserService() {
                return userService;
        }

        public void setUserService(IUserService userService) {
                this.userService = userService;
        }

        public void callService() 
        {
                
System.out.println("===================================================");
                IUser user = userService.getUser();
                System.out.println(user.getUserString());
                
System.out.println("===================================================");
        }

        public static void main(String[] args) {
                try

                {

                        Resource res = new ClassPathResource("client.xml");
                        BeanFactory factory = new XmlBeanFactory(res);
                        Client client = (Client) factory.getBean("client");
                        client.callService();
                }

                catch (Exception e1)

                {
                        System.out.println("" + e1);
                }

        }




> How are you calling this at the client end?
> 
> ...y ...ich wrote:
> > Greeting,
> >
> > I want to implement a simple client-server application with the following 
> > feature: client receives some remote object and call it's method. I don't 
> > have an intention to use EJBs so my question if this possible with pure 
> > Spring Remoting features like Hessian.
> >
> > The remote object that is being passed is
> >
> > Code:
> >
> > import interfaces.IUser;
> >
> > public class UserImpl implements IUser 
> > {
> >
> >     public String getAge() {
> >             
> >             return " 27 y.o ";
> >     }
> >
> >     public String getName() 
> >     {               
> >             return " John Doe ";
> >     }
> >
> >     public String getSex() 
> >     {               
> >             return " M ";
> >     }
> >
> >     public String getUserString() {
> >             
> >             return getName() + getAge() + getSex();
> >     }
> >
> > }
> >
> > The client side has only IUser in its classpath, not UserImpl. So when I 
> > call Hessian Service, I receive en error like this
> >
> > Code:
> >
> > java.lang.InstantiationException: interfaces.IUser
> >     at java.lang.Class.newInstance0(Unknown Source)
> >     at java.lang.Class.newInstance(Unknown Source)
> >     at 
> > com.caucho.hessian.io.JavaDeserializer.instantiate(JavaDeserializer.java:172)
> >     at 
> > com.caucho.hessian.io.JavaDeserializer.readMap(JavaDeserializer.java:112)
> >     at com.caucho.hessian.io.HessianInput.readObject(HessianInput.java:662)
> >     at com.caucho.hessian.io.HessianInput.readReply(HessianInput.java:241)
> >     at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:179)
> >     at $Proxy0.getUser(Unknown Source)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> >     at java.lang.reflect.Method.invoke(Unknown Source)
> >     at 
> > org.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:163)
> >     at 
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
> >     at 
> > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
> >     at $Proxy1.getUser(Unknown Source)
> >     at client.Client.callService(Client.java:39)
> >     at client.Client.main(Client.java:56)
> >
> >
> > I haven't looked at Hessian source code, but I could presume that it tries 
> > to instantiate UserImpl on the client side, where such class is absent in 
> > the classpath.
> >
> >
> > Can I configure Hessian somehow to send UserImpl class information with 
> > serialized UserImpl object?
> >
> > Thanks in advance!
> >
> > -- реклама -----------------------------------------------------------
> > http://freehost.com.ua - хостинг в UA-IX, домен бесплатно во всех пакетах!
> >
> >
> > _______________________________________________
> > hessian-interest mailing list
> > [email protected]
> > http://maillist.caucho.com/mailman/listinfo/hessian-interest
> >   
> > ------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.432 / Virus Database: 268.16.13/634 - Release Date: 17/01/2007 
> > 4:45 PM
> >

-- реклама -----------------------------------------------------------
http://freehost.com.ua - хостинг в UA-IX, домен бесплатно во всех пакетах!


_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to