我目前正在Felix(v4.0.3)上做一个OSGi项目。我需要使用JPA,所以我安装了Apache Aries JPA捆绑包。我还安装了OpenJPA,我需要它使用MySQL连接器捆绑包连接到MySQL数据库。不幸的是,它不起作用,OpenJPA说它找不到MySQL JDBC类,我也不知道是什么坏了,也许我做错了什么。我将在下面解释我安装了什么,以及persistence.xml文件和我得到的实际异常。
以下是我安装的ApacheAries捆绑包的列表:
- org.apache.aaries.jpa.api-0.3.jar
- org.apache.aries.jpa.container.text-0.3.jar
- org.apache.aries.jpa.container-03.jar
- org.apache.aries.util-0.4.jar
然后我安装了那些ApacheAries JPA捆绑包的依赖项。我从Springsource下载了它们:
- com.springsource.javax.transaction-1.10.jar
- com.springsource.org.apache.log4j-1.2.16.jar
- com.springsource.slf4j.api-1.6.1.jar
- com.springsource.slf4j.log4j-1.6.1.jar
- javax.persistence_2.0.4.v201112161009.jar(如果重要的话,这个来自EclipseLink)
我还安装了OpenJPA及其所有依赖项。我在apache-openjpa-2.2.0下载文件夹的lib文件夹中发现了捆绑包2到5(commons-*)。我在这里下载了Serp,因为在lib文件夹中找到的jar不是OSGi捆绑包。最后,我在Springsource中找到了最后两个bundle(#7和#8):
- openjpa-2.2.0.jar
- commons-collections-3.2.1.jar
- 通用-dbcp-1.4.jar
- commons-lang-2.4.jar
- 公共泳池-1.5.4.jar
- org.apache.servicemix.bundles.serp-1.13.1_4.jar
- com.springsource.javax.servlet-2.5.0.jar
- com.springsource.org.objectweb.asm-3.2.0.jar
一旦我最终安装了OpenJPA,我仍然需要MySQL JDBC驱动程序捆绑包,它也是我从Springsource存储库中获得的,以及它的公共日志依赖项:
- com.springsource.com.mysql.jdbc-5.1.6.jar
- com.springsource.org.apache.commons.loggin-1.1.1.1.jar
现在,安装的捆绑包列表越来越大。我说我安装了OpenJPA,但这只是因为我不知道如何使用Aries的任何其他提供商。我最初想使用EclipseLink,但显然Apache Aries没有检测到它是一个提供商,根据这个博客,你必须制作另一个包含你自己的激活程序的捆绑包,Aries才能注意到EclipseLink。我试过了,但没有成功,所以我转而使用OpenJPA。
现在我有两个问题:
- 如何让OpenJPA注意到我的MySQL捆绑包
或者:
- 如何让Apache Aries注意到EclipseLink
这是我使用的persistence.xml文件:
<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="userManager.model" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>org.project.dao.entity.UserEntity</class>
<properties>
<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
<property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/usermanager?autoReconnect=true" />
<property name="openjpa.ConnectionUserName" value="root" />
<property name="openjpa.ConnectionPassword" value="root" />
</properties>
</persistence-unit>
</persistence>
当我的DAO类的以下构造函数被执行时,会发生错误:
@PersistenceContext(unitName="userManager.model")
private EntityManager em;
private EntityManagerFactory emf;
public UserDAOBean() {
em = emf.createEntityManager();
}
以下是我在OpenJPA找不到MySQL时遇到的错误。当然,值得一提的是,URL和用户名/密码都有效:
<openjpa-2.2.0-r422266:1244990 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "com.mysql.jdbc.Driver" and URL "jdbc:mysql://localhost:3306/usermanager?autoReconnect=true". You may have specified an invalid URL.
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:123)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:844)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:732)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1671)
at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:646)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
at org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:64)
at javax.persistence.EntityManagerFactory$$Proxy.createEntityManager(Unknown Source)
我已经删除了例外(它一直在继续),直到这一点:
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver not found by org.apache.openjpa [12]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:85)
... 108 more
PS:由于垃圾邮件限制,我无法发布到Aries、OpenJPA或EclipseLink的链接,对不起:/
感谢Holly Cummins,经过几个小时的研究,我终于找到了解决问题的方法。我将在下面详细介绍,这将是一个非常长的答案。
如果您想将EclipseLink与ApacheAries一起使用(我发现它的安装比OSGi的OpenJPA简单几个数量级,因为它只包含在的5个捆绑包中),您必须直接从Apache签出EclipseLink-Aryes适配器,因为它还没有发布。
转到适当的文件夹并执行以下命令以获取它:
svn checkout https://svn.apache.org/repos/asf/aries/trunk/jpa/jpa-container-eclipselink-adapter/
您应该得到一个名为jpa-container-eclipselink adapter的文件夹。现在,假设您使用的是Linux并安装了Maven,运行以下命令:
cd jpa-container-eclipselink-adapter
mvn clean install
一旦Maven成功编译了适配器的源代码,您将使用路径在Maven存储库中找到它
<maven-repo>/org/apache/aries/jpa/org.apache.aries.jpa.eclipselink.adapter/0.3.1-SNAPSHOT/org.apache.aries.jpa.eclipselink.adapter-0.3.1-SNAPSHOT.jar
您必须将此捆绑包与其他捆绑包一起部署(将其复制到Felix的bundle文件夹中)。
这就是EclipseLink的部分,现在为了让你的坚持真正奏效,你必须使用白羊座的蓝图。以下是您需要从[http://aries.apache.org/downloads/currentrelease.html](Apache Aries下载页面)
- org.apache.aries.blueprint
- org.apache.aries.proxy
- org.apache.aries.jndi.api
- org.apache.aries.jndi
- org.apache.aries.blueprint
- org.apache.aries.jpa.api
- org.apache.aries.jpa.container.text
- org.apache.aries.jpa.container
- org.apache.aries.transaction.blueprint
- org.apache.aries.transaction.manager(这个在他们的网站上列出了两次,只是重复)
- org.apache.aries.util
下载完Aries后,您仍然需要依赖项(从SpringSource获取)。这些是SLF4J、Log4J、SLF4J Log4J Binding和javax.transaction 1.1 API的捆绑包。
- http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.slf4j.api&版本=1.6.1
- http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.slf4j.log4j&版本=1.6.1
- http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.javax.transaction&版本=1.1.0
- http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.log4j&版本=1.2.16
您还需要来自EclipseLink的捆绑包(您需要OSGi捆绑包版本)
http://www.eclipse.org/eclipselink/downloads/
打开zip并获得以下文件:
- org.eclipse.persistence.antlr
- org.eclipse.persistence.asm
- org.eclipse.persistence.core
- org.eclipse.persistence.jpa
- javax.persistence
最后,假设您想要使用MySQL数据库,您将需要MySQL JDBC驱动程序的捆绑包(从Springsource下载)
- http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.mysql.jdbc&版本=5.1.6
- http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.commons.logging&版本=1.1.1
一旦安装了所有这些捆绑包,就需要使用将通过JNDI获得的非jta数据源。这里有一个persistence.xml文件,您可以根据需要进行更改:
<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="userManager" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/userManagerDS)</non-jta-data-source>
<class>com.example.dao.entity.UserEntity</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<!-- EclipseLink should create the database schema automatically -->
<!-- <property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" /> -->
</properties>
</persistence-unit>
</persistence>
是否查看非jta数据源标记中的javax.sql.Datasource?这就是我们将使用Blueprint xml定义的内容。为了做到这一点,您首先需要在持久性捆绑包(包含DAO和实体的文件夹)中添加OSGI-INF/bluent/文件夹。这是蓝图xml文件所在的默认文件夹,位于此处的任何xml文件都将被扫描。完成后,创建blueprint.xml文件(名称可以更改)并粘贴(和修改)以下代码:
<bean id="dataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<property name="url" value="jdbc:mysql://localhost:3306/usermanager?autoReconnect=true" />
<property name="user" value="root" />
<property name="password" value="root" />
</bean>
<service id="MySQLDataSource" interface="javax.sql.DataSource" ref="dataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/userManagerDS" />
</service-properties>
</service>
<service id="userDAOService" interface="com.example.dao.remote.UserDAORemote">
<bean class="com.example.dao.beans.UserDAOBean">
<jpa:unit index="0" unitname="userManager" />
</bean>
</service>
</blueprint>
在这里,我们正在做两件事。首先,我们告诉Aries创建userManagerDS数据源,并使用JDBC驱动程序、URL、用户和密码对其进行配置。这与我们在persistence.xml文件中使用的数据源相同。
然后,我们在DAO中注入EntityManagerFactory。我们的DAO是com.example.DAO.beans.UserDAOBean类,我们需要将其名称添加到bean标记中。这个类必须实现一个接口,我们需要将这个接口添加到服务标记中。现在,最后的jpa:unit标记告诉Aries通过使用UserDAOBean的第一个构造函数,注入与名为userManager(与我们在persistence.xml中使用的名称相同)的持久性单元相关的EntityManagerFactory。这是通过使用index="0"属性来完成的。这也意味着您的DAO中必须有一些类似以下的代码:
private EntityManager em;
private EntityManagerFactory emf;
public UserDAOBean(EntityManagerFactory emf) {
this.emf = emf;
this.em = emf.createEntityManager();
}
也可以使用setter注入EMF。以下是帮助您使用蓝图的更多资源:
- http://aries.apache.org/modules/jpaproject.html
- http://aries.apache.org/modules/blueprint.html
- http://mail-archives.apache.org/mod_mbox/aries-user/201104.mbox/%3C15F2C30E-2A71-4320-9992-DBCF181B58E4@gmail.com%3E
可选:请注意,如果您使用的是Felix,添加javax.transaction捆绑包将导致"使用约束冲突",因为系统捆绑包(捆绑包0)也导出此API。您必须通过更改config.properties中的以下行来阻止它导出:
#org.osgi.framework.system.packages=
您必须在此处列出上一个捆绑包导出的所有包的列表。不幸的是,无法"删除"包,您必须重新定义要导出的整个包列表。这是我的,我希望它能有所帮助(是的,它非常非常长):
org.osgi.framework.system.packages=org.osgi.framework;version=1.6.0, org.osgi.framework.launch;version=1.0.0, org.osgi.framework.wiring;version=1.0.0, org.osgi.framework.startlevel;version=1.0.0, org.osgi.framework.hooks.bundle;version=1.0.0, org.osgi.framework.hooks.resolver;version=1.0.0, org.osgi.framework.hooks.service;version=1.1.0, org.osgi.framework.hooks.weaving;version=1.0.0, org.osgi.service.packageadmin;version=1.2.0, org.osgi.service.startlevel;version=1.1.0, org.osgi.service.url;version=1.0.0, org.osgi.util.tracker;version=1.5.0, javax.accessibility;version=0.0.0.1_006_JavaSE, javax.activation;version=0.0.0.1_006_JavaSE, javax.activity;version=0.0.0.1_006_JavaSE, javax.annotation.processing;version=0.0.0.1_006_JavaSE, javax.annotation;version=0.0.0.1_006_JavaSE, javax.crypto.interfaces;version=0.0.0.1_006_JavaSE, javax.crypto.spec;version=0.0.0.1_006_JavaSE, javax.crypto;version=0.0.0.1_006_JavaSE, javax.imageio.event;version=0.0.0.1_006_JavaSE, javax.imageio.metadata;version=0.0.0.1_006_JavaSE, javax.imageio.plugins.bmp;version=0.0.0.1_006_JavaSE, javax.imageio.plugins.jpeg;version=0.0.0.1_006_JavaSE, javax.imageio.spi;version=0.0.0.1_006_JavaSE, javax.imageio.stream;version=0.0.0.1_006_JavaSE, javax.imageio;version=0.0.0.1_006_JavaSE, javax.jws.soap;version=0.0.0.1_006_JavaSE, javax.jws;version=0.0.0.1_006_JavaSE, javax.lang.model.element;version=0.0.0.1_006_JavaSE, javax.lang.model.type;version=0.0.0.1_006_JavaSE, javax.lang.model.util;version=0.0.0.1_006_JavaSE, javax.lang.model;version=0.0.0.1_006_JavaSE, javax.management.loading;version=0.0.0.1_006_JavaSE, javax.management.modelmbean;version=0.0.0.1_006_JavaSE, javax.management.monitor;version=0.0.0.1_006_JavaSE, javax.management.openmbean;version=0.0.0.1_006_JavaSE, javax.management.relation;version=0.0.0.1_006_JavaSE, javax.management.remote.rmi;version=0.0.0.1_006_JavaSE, javax.management.remote;version=0.0.0.1_006_JavaSE, javax.management.timer;version=0.0.0.1_006_JavaSE, javax.management;version=0.0.0.1_006_JavaSE, javax.naming.directory;version=0.0.0.1_006_JavaSE, javax.naming.event;version=0.0.0.1_006_JavaSE, javax.naming.ldap;version=0.0.0.1_006_JavaSE, javax.naming.spi;version=0.0.0.1_006_JavaSE, javax.naming;version=0.0.0.1_006_JavaSE, javax.net.ssl;version=0.0.0.1_006_JavaSE, javax.net;version=0.0.0.1_006_JavaSE, javax.print.attribute.standard;version=0.0.0.1_006_JavaSE, javax.print.attribute;version=0.0.0.1_006_JavaSE, javax.print.event;version=0.0.0.1_006_JavaSE, javax.print;version=0.0.0.1_006_JavaSE, javax.rmi.CORBA;version=0.0.0.1_006_JavaSE, javax.rmi.ssl;version=0.0.0.1_006_JavaSE, javax.rmi;version=0.0.0.1_006_JavaSE, javax.script;version=0.0.0.1_006_JavaSE, javax.security.auth.callback;version=0.0.0.1_006_JavaSE, javax.security.auth.kerberos;version=0.0.0.1_006_JavaSE, javax.security.auth.login;version=0.0.0.1_006_JavaSE, javax.security.auth.spi;version=0.0.0.1_006_JavaSE, javax.security.auth.x500;version=0.0.0.1_006_JavaSE, javax.security.auth;version=0.0.0.1_006_JavaSE, javax.security.cert;version=0.0.0.1_006_JavaSE, javax.security.sasl;version=0.0.0.1_006_JavaSE, javax.sound.midi.spi;version=0.0.0.1_006_JavaSE, javax.sound.midi;version=0.0.0.1_006_JavaSE, javax.sound.sampled.spi;version=0.0.0.1_006_JavaSE, javax.sound.sampled;version=0.0.0.1_006_JavaSE, javax.sql.rowset.serial;version=0.0.0.1_006_JavaSE, javax.sql.rowset.spi;version=0.0.0.1_006_JavaSE, javax.sql.rowset;version=0.0.0.1_006_JavaSE, javax.sql;version=0.0.0.1_006_JavaSE, javax.swing.border;version=0.0.0.1_006_JavaSE, javax.swing.colorchooser;version=0.0.0.1_006_JavaSE, javax.swing.event;version=0.0.0.1_006_JavaSE, javax.swing.filechooser;version=0.0.0.1_006_JavaSE, javax.swing.plaf.basic;version=0.0.0.1_006_JavaSE, javax.swing.plaf.metal;version=0.0.0.1_006_JavaSE, javax.swing.plaf.multi;version=0.0.0.1_006_JavaSE, javax.swing.plaf.synth;version=0.0.0.1_006_JavaSE, javax.swing.plaf;version=0.0.0.1_006_JavaSE, javax.swing.table;version=0.0.0.1_006_JavaSE, javax.swing.text.html.parser;version=0.0.0.1_006_JavaSE, javax.swing.text.html;version=0.0.0.1_006_JavaSE, javax.swing.text.rtf;version=0.0.0.1_006_JavaSE, javax.swing.text;version=0.0.0.1_006_JavaSE, javax.swing.tree;version=0.0.0.1_006_JavaSE, javax.swing.undo;version=0.0.0.1_006_JavaSE, javax.swing;version=0.0.0.1_006_JavaSE, javax.tools;version=0.0.0.1_006_JavaSE, javax.transaction.xa;version=0.0.0.1_006_JavaSE, javax.transaction;version=0.0.0.1_006_JavaSE, javax.xml.bind.annotation.adapters;version=0.0.0.1_006_JavaSE, javax.xml.bind.annotation;version=0.0.0.1_006_JavaSE, javax.xml.bind.attachment;version=0.0.0.1_006_JavaSE, javax.xml.bind.helpers;version=0.0.0.1_006_JavaSE, javax.xml.bind.util;version=0.0.0.1_006_JavaSE, javax.xml.bind;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dom;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig.dom;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig.keyinfo;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig.spec;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig;version=0.0.0.1_006_JavaSE, javax.xml.crypto;version=0.0.0.1_006_JavaSE, javax.xml.datatype;version=0.0.0.1_006_JavaSE, javax.xml.namespace;version=0.0.0.1_006_JavaSE, javax.xml.parsers;version=0.0.0.1_006_JavaSE, javax.xml.soap;version=0.0.0.1_006_JavaSE, javax.xml.stream.events;version=0.0.0.1_006_JavaSE, javax.xml.stream.util;version=0.0.0.1_006_JavaSE, javax.xml.stream;version=0.0.0.1_006_JavaSE, javax.xml.transform.dom;version=0.0.0.1_006_JavaSE, javax.xml.transform.sax;version=0.0.0.1_006_JavaSE, javax.xml.transform.stax;version=0.0.0.1_006_JavaSE, javax.xml.transform.stream;version=0.0.0.1_006_JavaSE, javax.xml.transform;version=0.0.0.1_006_JavaSE, javax.xml.validation;version=0.0.0.1_006_JavaSE, javax.xml.ws.handler.soap;version=0.0.0.1_006_JavaSE, javax.xml.ws.handler;version=0.0.0.1_006_JavaSE, javax.xml.ws.http;version=0.0.0.1_006_JavaSE, javax.xml.ws.soap;version=0.0.0.1_006_JavaSE, javax.xml.ws.spi;version=0.0.0.1_006_JavaSE, javax.xml.ws.wsaddressing;version=0.0.0.1_006_JavaSE, javax.xml.ws;version=0.0.0.1_006_JavaSE, javax.xml.xpath;version=0.0.0.1_006_JavaSE, javax.xml;version=0.0.0.1_006_JavaSE, org.ietf.jgss;version=0.0.0.1_006_JavaSE, org.omg.CORBA.DynAnyPackage;version=0.0.0.1_006_JavaSE, org.omg.CORBA.ORBPackage;version=0.0.0.1_006_JavaSE, org.omg.CORBA.TypeCodePackage;version=0.0.0.1_006_JavaSE, org.omg.CORBA.portable;version=0.0.0.1_006_JavaSE, org.omg.CORBA;version=0.0.0.1_006_JavaSE, org.omg.CORBA_2_3.portable;version=0.0.0.1_006_JavaSE, org.omg.CORBA_2_3;version=0.0.0.1_006_JavaSE, org.omg.CosNaming.NamingContextExtPackage;version=0.0.0.1_006_JavaSE, org.omg.CosNaming.NamingContextPackage;version=0.0.0.1_006_JavaSE, org.omg.CosNaming;version=0.0.0.1_006_JavaSE, org.omg.Dynamic;version=0.0.0.1_006_JavaSE, org.omg.DynamicAny.DynAnyFactoryPackage;version=0.0.0.1_006_JavaSE, org.omg.DynamicAny.DynAnyPackage;version=0.0.0.1_006_JavaSE, org.omg.DynamicAny;version=0.0.0.1_006_JavaSE, org.omg.IOP.CodecFactoryPackage;version=0.0.0.1_006_JavaSE, org.omg.IOP.CodecPackage;version=0.0.0.1_006_JavaSE, org.omg.IOP;version=0.0.0.1_006_JavaSE, org.omg.Messaging;version=0.0.0.1_006_JavaSE, org.omg.PortableInterceptor.ORBInitInfoPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableInterceptor;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.CurrentPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.POAManagerPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.POAPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.ServantLocatorPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.portable;version=0.0.0.1_006_JavaSE, org.omg.PortableServer;version=0.0.0.1_006_JavaSE, org.omg.SendingContext;version=0.0.0.1_006_JavaSE, org.omg.stub.java.rmi;version=0.0.0.1_006_JavaSE, org.w3c.dom.bootstrap;version=0.0.0.1_006_JavaSE, org.w3c.dom.events;version=0.0.0.1_006_JavaSE, org.w3c.dom.ls;version=0.0.0.1_006_JavaSE, org.w3c.dom;version=0.0.0.1_006_JavaSE, org.xml.sax.ext;version=0.0.0.1_006_JavaSE, org.xml.sax.helpers;version=0.0.0.1_006_JavaSE, org.xml.sax;version=0.0.0.1_006_JavaSE
使用JNDI数据源而不是直接的jdbc连接可能会更好。Aries博客示例有一个blog.datasource捆绑包,该捆绑包使用Blueprint注册数据源。所需捆绑包的列表比您目前拥有的要长,但您可以从博客程序集/目标目录或pom.xml中复制所有捆绑包
或者,白羊座有一个org.apache.Aries.jpa.eclipselink.adapter,它和你链接的文章做同样的事情。白羊座用它来测试eclipselink,所以它肯定会起作用。你也可以看看白羊座的测试,看看它是如何使用的,看看是否有EclipseLink测试可以复制。
使用gemini blueprint dbAccess插件时,事情可能会更容易(http://www.eclipse.org/gemini/dbaccess/),我认为这对白羊座也适用。对于MySQL,请确保包含连接器插件(例如。http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.mysql.jdbc&version=5.1.6)。这应该足以让数据库启动并运行,前提是blueprint.xml(使用上面的示例)如上所述正确配置。