阅读背景:

使用JPA 2和Hibernate的Google Cloud Dataflow应用程序无法与BlockingDataflowPipelineRunner一起运行。无法找到persistence.xml

来源:互联网 

I have a Google Cloud Dataflow application that as part of a transform records some information to a MySQL database through JPA 2 and Hibernate. When running this application with the DirectPipelineRunner it locates the persistence.xml and runs fine.

我有一个Google Cloud Dataflow应用程序,作为转换的一部分,通过JPA 2和Hibernate将一些信息记录到MySQL数据库中。使用DirectPipelineRunner运行此应用程序时,它会找到persistence.xml并运行正常。

However, when I try to make use of the BlockingDataflowPipelineRunner the persistence context won't initialize because it can't find the persistence.xml. Maybe it can't be loaded from the CLASSPATH? The message being that the only persistence unit named in the persistence.xml isn't found.

但是,当我尝试使用BlockingDataflowPipelineRunner时,持久化上下文不会初始化,因为它无法找到persistence.xml。也许它无法从CLASSPATH加载?消息是找不到persistence.xml中唯一的持久性单元。

Has anyone successfully used JPA 2 and Hibernate with a Dataflow application? If so, what hoops did you have to jump through to get it working when using the BlockingDataflowPipelineRunner?

有没有人成功使用JPA 2和Hibernate与Dataflow应用程序?如果是这样,在使用BlockingDataflowPipelineRunner时,你必须跳过什么来使其工作?

1 个解决方案

#1


1  

Hibernate by default looks for the persistence.xml file in potentially many locations. You may want to confirm that the jars that get uploaded contain META-INF/persistence.xml.

默认情况下,Hibernate在可能的许多位置查找persistence.xml文件。您可能想要确认上传的jar包含META-INF / persistence.xml。

If you add the flag

如果添加标志

--workerLogLevelOverrides=org.hibernate#TRACE

--workerLogLevelOverrides = org.hibernate作为#TRACE

, that should give you much more detailed output related to Hibernate (you may need to configure JBoss logging to go to SLF4J or JUL to get the Hibernate logging to appear, docs.jboss.org/hibernate/orm/4.3/topical/html/logging/…).

,这应该为您提供更多与Hibernate相关的更详细的输出(您可能需要配置JBoss日志记录转到SLF4J或JUL以显示Hibernate日志记录,docs.jboss.org/hibernate/orm/4.3/topical/html/日志/ ...)。


分享到: