Monday, February 28, 2011

Re: Pb returning custom type on RPC call with Gilead

Hi,

Tks for reply.

I had 2 versions of beanlib.jar in the buildpath... i kept the last
version (the same as gilead) and it works !


tks.

On 24 fév, 17:01, David Chandler <drfibona...@google.com> wrote:
> It looks like Gilead requires a compatible version of the beanlib jar in
> WEB-INF/lib.
>
> HTH,
> /dmc
>
>
>
>
>
>
>
> On Thu, Feb 24, 2011 at 7:09 AM, sebastien <seba.mo...@gmail.com> wrote:
> > my config is GWT 2.1 and Gilead 1.3.2.1839, hibernate3.jar
>
> > my project is named oppv.
>
> > my LoginService.java -- (package com.oppv.client.remote)
>
> > public interface LoginService extends RemoteService{
>
> >        public String getNameUser(String value);
>
> >        public Iuser getUser(String value);
>
> > }
>
> > my LoginServiceAsynch.java -- (package com.oppv.client.remote)
>
> > public interface LoginServiceAsync{
>
> >        public void getNameUser(String value, AsyncCallback<String>
> > callback);
>
> >        public void getUser(String value, AsyncCallback<Iuser> callback);
> > }
>
> > my oppv.java -- (package com.oppc.client)
>
> >        LoginService.getNameUser(login.getValue(), getNameCallBack);
>
> >        and callback :
>
> >        private AsyncCallback<String> getNameCallBack = new
> > AsyncCallback<String>()  {
>
> >                public void onFailure(Throwable caught) {
> >                        GWT.log(caught.getMessage(), caught);
> >                   }
> >                public void onSuccess(String UserName) {
> >                        if (!UserName.isEmpty()) {
> >                                System.out.println("My Result getName is  :
> > " + UserName);
> >                        }
> >                        else {
> >                                System.out.println("No UserName found.");
> >                        }
> >                }
> >        };
>
> >        LoginService.getUser(login.getValue(), getUserCallBack);
>
> >        and callback :
>
> >        private AsyncCallback<Iuser> getUserCallBack = new
> > AsyncCallback<Iuser>()  {
>
> >                public void onFailure(Throwable caught) {
> >                        GWT.log(caught.getMessage(), caught);
> >                   }
> >                public void onSuccess(Iuser user) {
> >                        if (user != null) {
> >                                System.out.println("My result getUser is : "
> > + user.getName());
> >                        }
> >                        else {
> >                                System.out.println("No UserName found.");
> >                        }
> >                }
> >        };
>
> > my LoginServiceImpl.java -- (package com.oppv.server)
>
> >        /**
> >          * Constructor
> >          */
>
> >        public LoginServiceImpl() {
> >            HibernateUtil gileadHibernateUtil = new HibernateUtil();
>
> > gileadHibernateUtil.setSessionFactory(HibernateContext.getSessionFactory()) ;
>
> >            PersistentBeanManager persistentBeanManager = new
> > PersistentBeanManager();
> >            persistentBeanManager.setPersistenceUtil(gileadHibernateUtil);
> >            persistentBeanManager.setProxyStore(new StatelessProxyStore());
> >            setBeanManager(persistentBeanManager);
> >        }
>
> >        @Override
> >        public Iuser getNameUser(String value) {
> >                Session session = null;
> >                Transaction transaction = null;
> >                try {
> >                        session =
> > HibernateContext.getSessionFactory().openSession();
> >                        transaction = session.beginTransaction();
> >                    Iuser iuser = (Iuser)
> > session.createCriteria(Iuser.class).add(Restrictions.eq("email",
> > value))
>
> >                                                     .uniqueResult();
> >                    return iuser.getName();
> >                }
> >                catch (RuntimeException e) {
> >                        transaction.rollback();
> >                        throw e;
> >                }
> >                finally {
> >                        session.close();
> >                }
> >        }
>
> >        @Override
> >        public Iuser getUser(String value) {
> >                Session session = null;
> >                Transaction transaction = null;
> >                try {
> >                        session =
> > HibernateContext.getSessionFactory().openSession();
> >                        transaction = session.beginTransaction();
> >                    Iuser iuser = (Iuser)
> > session.createCriteria(Iuser.class).add(Restrictions.eq("email",
> > value))
>
> >                                                     .uniqueResult();
> >                    return iuser;
> >                }
> >                catch (RuntimeException e) {
> >                        transaction.rollback();
> >                        throw e;
> >                }
> >                finally {
> >                        session.close();
> >                }
> >        }
>
> > My HibernateContext.java --
>
> > package com.oppv.server;
>
> > import org.apache.commons.logging.Log;
> > import org.apache.commons.logging.LogFactory;
> > import org.hibernate.SessionFactory;
> > import org.hibernate.cfg.Configuration;
>
> > /**
> >  * Hibernate context utility class
> >  * @author bruno.marchesson
> >  *
> >  */
> > public class HibernateContext
> > {
>
> >        //----
> >        // Constants
> >        //----
> >        /**
> >         * The stateful configuration file
> >         */
> >        private static final String CONFIGURATION_FILE =
> >                "hibernate.cfg.xml";
>
> >        //----
> >        // Attributes
> >        //----
> >        /**
> >         * Log channel
> >         */
> >        private static Log _log = LogFactory.getLog(HibernateContext.class);
>
> >        /**
> >         * The current session factory
> >         */
> >        private static SessionFactory _sessionFactory;
>
> >  //-------------------------------------------------------------------------
> >        //
> >        // Public interface
> >        //
>
> >  //-------------------------------------------------------------------------
> >        /**
> >         * @return the created session factory
> >         */
> >        public static SessionFactory getSessionFactory()
> >        {
> >        if (_sessionFactory == null)
> >                {
> >                        try
> >                        {
>
> >                                // Create the SessionFactory from
> > hibernate.cfg.xml
> >                                _sessionFactory = new
> > Configuration().configure(CONFIGURATION_FILE).buildSessionFactory();
> >                        }
> >                        catch (Throwable ex)
> >                        {
> >                                // Make sure you log the exception, as it
> > might be swallowed
> >                                _log.error("Initial SessionFactory creation
> > failed.", ex);
> >                                throw new ExceptionInInitializerError(ex);
> >                        }
> >                }
> >                return _sessionFactory;
> >        }
> > }
>
> > my Iuser.java -- (in com.oppv.domain) --
>
> > /**
> >  * Iuser generated by hbm2java
> >  */
>
> > public class Iuser extends LightEntity implements Serializable {
>
> >        private String email;
> >        private Integer id;
> >        private String name;
>
> >        public Iuser() {
> >        }
>
> >        public Iuser(String Name, String email) {
> >                this.email = email;
> >                this.name = name;
> >        }
>
> >        public Integer getId() {
> >                return this.id;
> >        }
>
> >        public void setId(Integer id) {
> >                this.id = id;
> >        }
>
> >        public String getEmail() {
> >                return this.email;
> >        }
> >        public void setEmail(String email) {
> >                this.email = email;
> >        }
> >                public String getName() {
> >                return this.name;
> >        }
>
> >        public void setName(String name) {
> >                this.name = name;
> >        }
>
> > .. Other fields for sure but not interresting
>
> > }
>
> > In my hibernate.cfg.xml i have this line : <mapping resource="/com/
> > oppv/domain/Iuser.hbm.xml"/>
>
> > In my oppv.gwt.xml i have these one :
>
> > <inherits name='net.sf.gilead.Gilead4Gwt'/>
> > <!-- Specify the paths for translatable code                    -->
> >   <source path='client'/>
> >   <source path='domain'/>
>
> > And my Trace is here : (It works for UserName and Not for Iuser... )
>
> > [WARN] Server class 'com.google.gwt.junit.server.JUnitHostImpl' could
> > not be found in the web app, but was found on the system classpath
> >   [WARN] Adding classpath entry 'file:/D:/eclipse/plugins/
> > com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127/gwt-2.1.1/
> > gwt-user.jar' to the web app classpath for this session
> >   For additional info see: file:/D:/eclipse/plugins/
> > com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127/gwt-2.1.1/
> > doc/helpInfo/webAppClassPath.html
> >   Reload completed successfully
> > [WARN] Server class 'net.sf.beanlib.hibernate.HibernateBeanReplicator'
> > could not be found in the web app, but was found on the system
> > classpath
> >   [WARN] Adding classpath entry 'file:/D:/workspace/gilead-1.3.2.1839/
> > gilead-core/lib/beanlib-hibernate-5.0.2beta.jar' to the web app
> > classpath for this session
> >   For additional info see: file:/D:/eclipse/plugins/
> > com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127/gwt-2.1.1/
> > doc/helpInfo/webAppClassPath.html
> > [WARN] Server class 'net.sf.beanlib.spi.BeanPopulatorBaseSpi' could
> > not be found in the web app, but was found on the system classpath
> >   [WARN] Adding classpath entry 'file:/D:/workspace/gilead-1.3.2.1839/
> > gilead-core/lib/beanlib-5.0.2beta.jar' to the web app classpath for
> > this session
> >   For additional info see: file:/D:/eclipse/plugins/
> > com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127/gwt-2.1.1/
> > doc/helpInfo/webAppClassPath.html
> > [WARN] Server class 'org.apache.commons.collections.SequencedHashMap'
> > could not be found in the web app, but was found on the system
> > classpath
> >   [WARN] Adding classpath entry 'file:/D:/eclipse/plugins/
> > com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127/gwt-2.1.1/
> > gwt-dev.jar' to the web app classpath for this session
> >   For additional info see: file:/D:/eclipse/plugins/
> > com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127/gwt-2.1.1/
> > doc/helpInfo/webAppClassPath.html
> > [WARN]
>
> ...
>
> plus de détails »

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment