Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
657 views
in Technique[技术] by (71.8m points)

hibernate - Spring Autowiring stopped working on GAE

I'm sure my app worked right until yesterday, when I got this error:

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.serv ices.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

I am using Hibernate with Google Cloud SQL, and it always worked.

On my local machine, with local MySQL, it still works!

I don't think it's a Cloud SQL issue, because removing some autowiring (a test) it still connects and so on. Here's my xml:

<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>
                <!-- <prop key="hibernate.hbm2ddl.import_files">/setup.sql</prop> -->
            </props>
        </property>
    </bean>

A piece of my DAO:

@Component
public class Dao {

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

And my service:

@Service
@Transactional
public class SocietaService {

    private Dao societaDao;

    @Autowired
    public void setSocietaDao(Dao societaDao) {
        this.societaDao = societaDao;
    }
...

I can't find what's different between GAE and my local (mvn gae:run). And why last week that worked perfectly.

Please GAE team, support me! I'm going crazy on this issue

(I'll probably start a bounty, it's too much urgent)

EDIT my pom.xml hibernate part:

<!-- Hibernate framework -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.3.2.GA</version>
        <type>pom</type>
        <!--hibernate-dependencies is a pom, not needed for hibernate-core-->
      </dependency>
      <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-annotations</artifactId>
        <version>3.4.0.GA</version>
    </dependency>
    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.12.1.GA</version>
    </dependency>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...