I am migrating an ejb 1.0 app to ejb 3.1 app. The current app is running in WebLogic Server Version: 12.1.3.0.0 on jdk 8. For POC I have chosen one session bean and one entity bean and have upgraded to 3.1 by providing updated ejb-jar.xml, orm.xml and persistence.xml (below).
<?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>
I am however getting the xml parsing error below:
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.
I have confirmed that persistence.xml is in my ejb-jar/META-INF directory. If I remove persistence.xml from my ejb.jar, the error goes away, the session bean lookup happens and entity bean persistence fails. So I am assuming that the error is with persistence.xml. I have saved persistence.xml in utf-8 format. I have also made sure that there is no blank space before <?
as suggested by some of the posts. Any pointers?