两个Meta-Inf文件夹 - 正常结构? [英] Two Meta-Inf folders - normal structure?

查看:435
本文介绍了两个Meta-Inf文件夹 - 正常结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是发现我们有两个Meta-Inf文件夹...在eclipse和War文件中。

I just "discovered" that we have two Meta-Inf folders ... In eclipse and also in the War file.

第一个是(在战争):

/ META-INF /

/META-INF/

第二,奇怪的是:

/ WEB-INF / classes / META-INF /

/WEB-INF/classes/META-INF/

在第二个文件夹中是persistance.xml和一些东西。 taglib.xml ...

In the second folder is a persistance.xml and a something.taglib.xml...

如果我将文件移动到第一个meta-inf文件夹,我会从休眠中获得异常..

If i move the files into the first meta-inf folder i get exceptions from hibernate..

第二个和奇怪放置的meta-inf文件夹的目的是什么?

这是一个普通文件夹结构?

推荐答案

奇怪的一个位置是正确的;第6.2 / 8.2节中的JSR-220 / JSR-317(Java持久性API 1.0 / 2.0)说:

The "weird one" location is correct; JSR-220/JSR-317 (Java Persistence API 1.0/2.0) in section 6.2/8.2 say:


其文件或目录的jar文件或目录META-INF目录包含persistence.xml文件,称为持久性单元的根。在Java EE中,持久性单元的根可以是以下之一:

The jar file or directory whose META-INF directory contains the persistence.xml file is termed the root of the persistence unit. In Java EE, the root of a persistence unit may be one of the following:


  • EJB-JAR文件

  • WAR文件的WEB-INF / classes目录

  • WAR文件的WEB-INF / lib目录中的jar文件

  • EAR根目录中的jar文件*

  • EAR库目录中的jar文件

  • 应用程序客户端jar文件。

  • an EJB-JAR file
  • the WEB-INF/classes directory of a WAR file
  • a jar file in the WEB-INF/lib directory of a WAR file
  • a jar file in the root of the EAR*
  • a jar file in the EAR library directory
  • an application client jar file.

*)仅对JPA 1.0有效

*) Only valid for JPA 1.0

因此,直接在WAR文件中,唯一正确的位置是 WEB-INF / classes / META-INF /

So, directly in a WAR file, the only correct location is WEB-INF/classes/META-INF/.

这篇关于两个Meta-Inf文件夹 - 正常结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆