プロジェクトjarファイルをファイルサーバーにエクスポートした後、jpaのentitymanagerの作成は機能しなくなります。
以下の詳細があります:
- Glassfishv3プロジェクトのEclipseLinkを使用しています
- WebサイトからEclipseLink2.4...をダウンロードしました。
- org.eclipse.persistence.core.jar、org.eclipse.persistence.jpa.jar、javax.persistence.jar、およびeclipselink.jarはlibフォルダーにあります。
- persistence.xmlは、src内のMETA-INFフォルダーにあります。(私は日食ヘリオスを使用します)
これはpersistence.xmlのコンテンツです
<?xml version="1.0" encoding="UTF-8"?> <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" version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name="QIS" transaction-type="RESOURCE_LOCAL" > <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <class>com.quoka.qis.lib.persistence.Type</class> </persistence-unit> </persistence>
すべてがEclipse内で機能しますが、ファイルサーバーからは機能しません。:-)
エラーメッセージは次のとおりです。
org.eclipse.persistence.internal.jpa.deployment.xml.parser.XMLException
URI was not reported to parser for entity [document])
Caused By:
Log Exception of type org.eclipse.persistence.internal.jpa.deployment.xml.parser.XMLException :
(1. URI was not reported to parser for entity [document])
(0) org.eclipse.persistence.internal.jpa.deployment.xml.parser.XMLExceptionHandler.error(XMLExceptionHandler.java:28)
(1) org.eclipse.persistence.internal.jpa.deployment.xml.parser.XMLExceptionHandler.warning(XMLExceptionHandler.java:23)
(2) gnu.xml.aelfred2.SAXDriver.warn(SAXDriver.java:935)
(3) gnu.xml.aelfred2.SAXDriver.startExternalEntity(SAXDriver.java:631)
(4) gnu.xml.aelfred2.XmlParser.pushURL(XmlParser.java:3358)
(5) gnu.xml.aelfred2.XmlParser.doParse(XmlParser.java:159)
(6) gnu.xml.aelfred2.SAXDriver.parse(SAXDriver.java:320)
(7) gnu.xml.aelfred2.XmlReader.parse(XmlReader.java:294)
(8) org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:442)
(9) org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:401)
(10) org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:310)
(11) org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchive(JPAInitializer.java:149)
(12) org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchives(JPAInitializer.java:136)
(13) org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfo(JPAInitializer.java:125)
(14) org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:98)
(15) org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
(16) javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78)
(17) com.quoka.qis.admin.QisAdminEntityManager.getInstance(QisAdminEntityManager.java:33)
(18) com.quoka.qis.admin.QisAdminFrame.login(QisAdminFrame.java:574)
(19) com.quoka.qis.admin.QisAdminFrame.testLogin(QisAdminFrame.java:513)
(20) com.quoka.qis.admin.QisAdminFrame.showFrame(QisAdminFrame.java:441)
(21) com.quoka.qis.admin.QisAdminFrame.showFrame(QisAdminFrame.java:417)
(22) com.quoka.qis.admin.QisAdminFrame.access$3(QisAdminFrame.java:416)
(23) com.quoka.qis.admin.QisAdminFrame$DebugPanel.run(QisAdminFrame.java:777)
(24) java.lang.Thread.run(Thread.java:662)
DBConnectionは次のとおりです。
Map<String, String> properties = new HashMap<String, String>();
properties.put("javax.persistence.jdbc.driver", "com.sybase.jdbc3.jdbc.SybDriver");
properties.put("eclipselink.target-database", "Sybase");
properties.put("javax.persistence.jdbc.url", "jdbc:sybase:Tds:"+meta.getServerName()+":"+meta.getPort());
properties.put("javax.persistence.jdbc.user", meta.getUserName());
properties.put("javax.persistence.jdbc.password", meta.getPassword());
properties.put("eclipselink.logging.level", "INFO");
EntityManagerFactory emf = Persistence.createEntityManagerFactory("QIS", properties);
em = emf.createEntityManager();