My web app makes use of Google Cloud SQL.
It works perfectly locally, using mvn gae:run (mave gae plugin) on
local mysql db.

Here's some of my xml spring context config:

<bean id="mySessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
                <property name="dataSource" ref="myDataSource" />
                <property name="annotatedClasses">
                        <list>
                                
<value>it.trew.prove.model.beans.Scadenza</value>
                                
<value>it.trew.prove.model.beans.Fornitore</value>
                                <value>it.trew.prove.model.beans.Societa</value>
                        </list>
                </property>
                <property name="hibernateProperties">
                        <props>
                                <prop 
key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</
prop>
                                <prop key="hibernate.show_sql">true</prop>
                                <prop key="hibernate.hbm2ddl.auto">create</prop>
                        </props>
                </property>
        </bean>

And here's my generic DAO.java:



@Component
public class Dao {

    @Resource(name = "mySessionFactory")
    private SessionFactory sessionFactory;

    @SuppressWarnings("unchecked")
        public <T> T save(final T o){
        return (T) sessionFactory.getCurrentSession().save(o);
    }

    public void delete(final Object object){
        sessionFactory.getCurrentSession().delete(object);
    }

    @SuppressWarnings("unchecked")
        public <T> T get(final Class<T> type, final Long id){
        return (T) sessionFactory.getCurrentSession().get(type, id);
    }

    @SuppressWarnings("unchecked")
        public <T> T merge(final T o)   {
        return (T) sessionFactory.getCurrentSession().merge(o);
    }

    public <T> void saveOrUpdate(final T o){
        sessionFactory.getCurrentSession().saveOrUpdate(o);
    }

    @SuppressWarnings("unchecked")
        public <T> List<T> getAll(final Class<T> type) {
        final Session session = sessionFactory.getCurrentSession();
        final Criteria crit = session.createCriteria(type);
        return crit.list();
    }
}


And one of my services:

@Service
@Transactional
public class ScadenzaService {

        private Dao scadenzaDao;
        private SocietaService societaService;

        public void salvaScadenza(Scadenza scadenza) {
                scadenza.setDataInserimento(new Date());
                scadenza.setSocieta(societaService.getSocietaCorrente());
                scadenzaDao.save(scadenza);
        }

        public List<Scadenza> tutteLeScadenze() {
                return scadenzaDao.getAll(Scadenza.class);
        }

        @Autowired
        public void setScadenzaDao(Dao scadenzaDao) {
                this.scadenzaDao = scadenzaDao;
        }

        @Autowired
        public void setSocietaService(SocietaService societaService) {
                this.societaService = societaService;
        }
}





The error 500 on Appengine is:

Failed startup of context
com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@1079ff{/,/
base/data/home/apps/s~trewnewmedia/1.357617962256387950}
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'scadenziarioController': Injection of
autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire method: public void
it.trew.prove.web.controllers.ScadenziarioController.setScadenzaService(it.trew.prove.services.ScadenzaService);
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'scadenzaService': Injection of autowired
dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire method: public void
it.trew.prove.services.ScadenzaService.setSocietaService(it.trew.prove.services.SocietaService);
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'societaService': Injection of autowired
dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire method: public void
it.trew.prove.services.SocietaService.setSocietaDao(it.trew.prove.model.dao.Dao);
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'dao': Injection of resource dependencies
failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'mySessionFactory': Post-processing of the
FactoryBean's object failed; nested exception is
java.lang.SecurityException: Unable to get members for class
org.hibernate.impl.SessionFactoryImpl


What do you think? Why in local works and not in GAE?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to