在Websphere中使用@PersistenceUnit注入EntityManagerFactory的问题
将Web应用程序从Glassfish 3.1移植到Websphere 8.5时遇到问题。 问题在于JPA2的使用: 在Glassfish中运行的以下配置在Websphere中不起作用:在Websphere中使用@PersistenceUnit注入EntityManagerFactory的问题,websphere,jpa-2.0,code-injection,persistence.xml,Websphere,Jpa 2.0,Code Injection,Persistence.xml,将Web应用程序从Glassfish 3.1移植到Websphere 8.5时遇到问题。 问题在于JPA2的使用: 在Glassfish中运行的以下配置在Websphere中不起作用: <persistence-unit name="pippoPU" transaction-type="JTA"> <jta-data-source>jdbc/pippo</jta-data-source> 问题是EntityManagerFactory没有被注入。。它仍然
<persistence-unit name="pippoPU" transaction-type="JTA">
<jta-data-source>jdbc/pippo</jta-data-source>
问题是EntityManagerFactory没有被注入。。它仍然是空的
这两个应用服务器都兼容JEE6
(几个月前,我尝试了Weblogic 10.3,如果我没记错的话,当我直接从Eclipse部署时也遇到了同样的问题……这是一个已知的问题,可以通过在Weblogic Eclipse插件中设置“发布为分解存档”来解决。)
有人有什么建议吗
非常感谢当项目中的任何实体出现问题/错误时,就会发生这种情况。
Websphere只在日志中输出一行-我相信您会发现它:
[ERROR] The server cannot create an EntityManagerFactory factory
您需要将com.ibm.ws.jpa.*
的日志记录级别设置为所有消息和跟踪
。
然后,您将在日志中找到问题的根本原因
[ERROR] The server cannot create an EntityManagerFactory factory