【发布时间】:2016-07-17 21:58:18
【问题描述】:
我正在使用 jersey 部署一个 RESTful Web 服务。我正在阅读本教程并执行说明: http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/RESTfulWebServices/RESTfulWebservices.htm
但在服务器上部署时出现此错误。
严重:部署应用程序 [PlayerServer2] 时出现异常: org.xml.sax.SAXParseException;行号:5;列号:15; 存档中的部署描述符文件 META-INF/persistence.xml [类]。 cvc-complex-type.2.4.b:元素的内容 “坚持”是不完整的。之一 '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' 是 预计。
我正在使用 netbean 8.0.1、glassfish 服务器 4.1、JDK 1.8.91、JPA 2.1
已编辑:
persistence.xml
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="PlayerServer2PU" transaction-type="JTA">
<jta-data-source>jdbc/playerdb2</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties/>
</persistence-unit>
</persistence>
【问题讨论】:
-
请发布您的
persistence.xml -
@Apostolos 我编辑了我的帖子。谢谢。
-
你能把空的
properties标签去掉再试一次吗? -
@Apostolos 它有效。非常感谢。请添加您的答案,以便我接受。
标签: java jakarta-ee netbeans jersey jax-rs