我最近开始学习 Spring Roo,并生成了一个在 Jetty 上运行良好的 webapp。我现在想将此原型应用程序移至 Glassfish,以便在完成后将其部署到生产环境中。
现在我面临着让持久层与 Glassfish 3.1 一起工作的艰苦战斗。以下是我为 Glassfish 更新的配置文件中的相关片段。任何解决此错误的帮助/指针将不胜感激。我确实在这里遵循了类似的线程但无济于事。这里似乎有针对此问题的 Jira,但我不知道如何实施评论中提到的解决方法。
提前致谢。
持久性.xml
<persistence-unit name="persistenceUnit" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/CTUDB</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
<!-- value="create" to build a new database on each run; value="update" to modify an existing database; value="create-drop" means the same as "create" but also drops tables when Hibernate closes; value="validate" makes no changes to the database -->
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
<property name="hibernate.connection.charSet" value="UTF-8"/>
<!-- Uncomment the following two properties for JBoss only -->
<!-- property name="hibernate.validator.apply_to_ddl" value="false" /-->
<!-- property name="hibernate.validator.autoregister_listeners" value="false" /-->
</properties>
</persistence-unit>
web.xml
<persistence-unit-ref>
<persistence-unit-ref-name>persistence/persistenceUnit</persistence-unit-ref-name>
<persistence-unit-name>persistenceUnit</persistence-unit-name>
</persistence-unit-ref>
应用程序上下文.xml
<jee:jndi-lookup id="entityManagerFactory" jndi-name="persistence/persistenceUnit"/>
<tx:jta-transaction-manager/>
<tx:annotation-driven/>