首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用netbeans使用时,预期http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}‘会出错

使用netbeans使用时,预期http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}‘会出错
EN

Stack Overflow用户
提问于 2016-07-17 21:58:18
回答 1查看 2K关注 0票数 0

我正在使用jersey.I部署一个restful,我正在阅读本教程并执行说明:http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/RESTfulWebServices/RESTfulWebservices.htm

但我在服务器上部署时遇到了这个错误。

严重:在归档类中部署应用程序PlayerServer2 : org.xml.sax.SAXParseException;lineNumber: 5;columnNumber: 15;部署描述符文件META/sistence.xml时出现异常。2.4.b:元素'persistence‘的内容不完整。{“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

代码语言:javascript
复制
<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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-18 08:11:35

请删除空的<properties/>标记,以便正确处理persistence.xml文件。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38426317

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档