2016-11-08 188 views
0

我正在將ejb 1.0應用程序遷移到ejb 3.1應用程序。當前應用程序在jdk 8上的WebLogic Server Version:12.1.3.0.0中運行。對於POC,我選擇了一個會話Bean和一個實體Bean,並通過提供更新的ejb-jar.xml,orm.xml和持久性.xml(如下)。weblogic 12c不允許處理指令目標匹配「[xX] [mM] [lL]」

<?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$1.next(ModuleStateDriver.java:175) 
    at weblogic.application.internal.flow.ModuleStateDriver$1.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。我以utf-8格式保存了persistence.xml。我也確保在<?之前沒有空格,正如某些帖子所建議的。任何指針?

回答

0

錯誤是由我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

之前不能有任何字符