weblogic 12c不允许匹配“[xX][mM][lL]”的处理指令目标

weblogic 12c The processing instruction target matching "[xX][mM][lL]" is not allowed

我正在将 ejb 1.0 应用程序迁移到 ejb 3.1 应用程序。当前应用程序是 运行 WebLogic Server 版本:12.1.3.0.0 on jdk 8. 对于 POC,我选择了一个会话 bean 和一个实体 bean,并通过提供更新的 ejb-jar.xml、orm.xml 和 persistence.xml(下)。

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="myPersistenceUnit" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>java:/myDataSource</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
 <property name="hibernate.show_sql" value="false"/>
 <property name="useColumnNamesInFindColumn" value="true"/>
 <property name="useOldAliasMetadataBehavior" value="true"/>
</properties>
</persistence-unit>
</persistence>

然而,我收到以下 xml 解析错误:

weblogic.application.ModuleException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6; The processing instruction target matching "[xX][mM][lL]" is not allowed.
    at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)
    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
    at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:175)
    at weblogic.application.internal.flow.ModuleStateDriver.next(ModuleStateDriver.java:170)
    at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:80)
    at weblogic.work.ContextWrap.run(ContextWrap.java:40)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6; The processing instruction target matching "[xX][mM][lL]" is not allowed.

我已经确认 persistence.xml 在我的 ejb-jar/META-INF 目录中。如果我从我的 ejb.jar 中删除 persistence.xml,错误消失,会话 bean 查找发生并且实体 bean 持久性失败。所以我假设错误是 persistence.xml。我已将 persistence.xml 保存为 utf-8 格式。我还确保 <? 之前没有空白 space,正如某些帖子所建议的那样。有什么指点吗?

错误是由我的orm.xml中的第一条评论引起的:

<!-- file to hold Document orm -->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm 
    http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" version="1.0">

    <entity

正如 The processing instruction target matching "[xX][mM][lL]" is not allowed 的回答 - <?xml

之前不能有任何字符