Hibernate SessionFactory:无法实例化bean

时间:2012-03-21 13:44:39

标签: spring hibernate google-app-engine google-cloud-sql

有人认出这个错误吗?

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 

好吧,我有这个Spring3配置:

<bean id="myDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.google.appengine.api.rdbms.AppEngineDriver" />
        <property name="url" value="jdbc:google:rdbms://xx:xx/nomedb" />
    </bean>


    <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>

    <tx:annotation-driven transaction-manager="transactionManager" />

    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="mySessionFactory" />
    </bean> 

我在这段代码中看不出任何错误,我有所有依赖项,最新版本。

编辑:我的一些pom.xml

<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>

    <!-- Google App Engine meta-package -->
    <dependency>
      <groupId>net.kindleit</groupId>
      <artifactId>gae-runtime</artifactId>
      <version>${gae.version}</version>
      <type>pom</type>
    </dependency>

1 个答案:

答案 0 :(得分:1)

虽然此页面涉及Struts,但问题是相同的:http://struts.apache.org/2.2.1/docs/google-app-engine-gae.html