我正在尝试为 mysql 和对应的数据源配置一个数据源。Apache Aries 之上的持久性捆绑包。这是数据源的蓝图文件
<bean id="mysqlDataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<property name="url" value="jdbc:mysql://matteos-mbp:3306/" />
<property name="user" value="root" />
<property name="password" value="root" />
<property name="databaseName" value="testDBBlueprint" />
<property name="createDatabaseIfNotExist" value="true" />
</bean>
<bean id="mysqlXADataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource">
<property name="url" value="jdbc:mysql://matteos-mbp:3306/" />
<property name="user" value="root" />
<property name="password" value="root" />
<property name="databaseName" value="testDBBlueprint" />
<property name="createDatabaseIfNotExist" value="true" />
</bean>
<service ref="mysqlDataSource" interface="javax.sql.DataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/ddauthdb" />
</service-properties>
</service>
<service ref="mysqlXADataSource" interface="javax.sql.XADataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/xaddauthdb" />
</service-properties>
</service>
这些是实体/持久性包(包 com.mycompany.jpa.auth.entities)的 persistence.xml 和 blueprint.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<persistence
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"
version="2.0">
<persistence-unit name="ddauth">
<jta-data-source>
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/xaddauthdb)
</jta-data-source>
<non-jta-data-source>
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/ddauthdb)
</non-jta-data-source>
<class>com.mycompany.persistence.users.TestUser</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property
name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)" />
</properties>
</persistence-unit>
</persistence>
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
<bean id="userService" class="com.mycompany.persistence.users.UserServiceImpl">
<tx:transaction method="*" value="Required" />
<jpa:context property="entityManager" unitname="ddauth"/>
</bean>
<bean
id="populator"
class="com.mycompany.persistence.users.Populator"
init-method="populate"
activation="eager" >
<property
name="userService"
ref="userService" />
</bean>
<service ref="userService" interface="com.mycompany.users.api.UserService" />
</blueprint>
我得到的错误是
org.ops4j.pax.logging.pax-logging-api[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Unable to start blueprint container for bundle com.mycompany.jpa.auth.entities due to unresolved dependencies [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=ddauth))(objectClass=javax.persistence.EntityManagerFactory))]
java.util.concurrent.TimeoutException
at org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:336)
at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
org.ops4j.pax.logging.pax-logging-api[org.apache.aries.blueprint.container.BlueprintEventDispatcher] : Sending blueprint container event BlueprintEvent[type=FAILURE, dependencies=[(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=ddauth))(objectClass=javax.persistence.EntityManagerFactory))], exception=null] for bundle com.mycompany.jpa.auth.entities
我的运行时如下:
START LEVEL 1
ID|State |Level|Name
0|Active | 0|OSGi System Bundle (3.10.2.v20150203-1939)
1|Active | 1|aQute.xray.plugin (1.7.0.201403241317)
2|Active | 1|com.mycompany.db.mysql.auth (0.0.0.201506180714)
3|Active | 1|Oracle Corporation's JDBC Driver for MySQL (5.1.35)
4|Active | 1|Apache Commons Collections (3.2.1)
5|Active | 1|Apache Aries Blueprint Bundle (1.1.0)
6|Active | 1|Apache Aries Blueprint API (1.0.1)
7|Active | 1|Apache Aries Blueprint Core (1.4.2)
8|Active | 1|Aries JPA Container API (1.0.2)
9|Active | 1|Aries JPA Container blueprint integration for Aries blueprint (1.0.4)
10|Active | 1|Aries JPA Container (1.0.2)
11|Active | 1|Aries JPA Container Managed Contexts (1.0.4)
12|Active | 1|Apache Aries Proxy API (1.0.1)
13|Active | 1|Apache Aries Proxy Service (1.0.4)
14|Active | 1|Apache Aries Transaction Blueprint (1.0.2)
15|Active | 1|Apache Aries Transaction Manager (1.0.0)
16|Active | 1|Apache Aries Transaction Manager (1.1.1)
17|Active | 1|Apache Aries Util (1.1.0)
18|Active | 1|Commons Lang (2.6.0)
19|Active | 1|Commons Pool (1.6.0)
20|Active | 1|Apache CXF Core (3.1.1)
21|Active | 1|Apache CXF Runtime HTTP Transport (3.1.1)
22|Active | 1|Apache Felix Configuration Admin Service (1.8.0)
23|Active | 1|Apache Felix Gogo Command (0.14.0)
24|Active | 1|Apache Felix Gogo Runtime (0.12.1)
25|Active | 1|Apache Felix Gogo Shell (0.10.0)
26|Active | 1|Apache Felix Metatype Service (1.0.10)
27|Active | 1|Apache Felix Declarative Services (1.8.2)
28|Active | 1|Apache Felix Web Management Console (3.1.8)
29|Active | 1|Apache Geronimo JSR-317 JPA 2.0 Spec API (1.1.0)
30|Active | 1|geronimo-jta_1.1_spec (1.1.1)
31|Active | 1|OpenJPA Aggregate Jar (2.2.2)
32|Active | 1|Apache ServiceMix :: Bundles :: commons-dbcp (1.4.0.3)
33|Active | 1|XmlSchema Core (2.2.1)
34|Active | 1|Apache XBean OSGI Bundle Utilities (3.18.0)
35|Active | 1|Apache XBean :: Classpath Resource Finder (3.18.0)
36|Active | 1|hibernate-jpa-2.1-api (1.0.0.Final)
37|Active | 1|ASM all classes with debug info (5.0.3)
38|Active | 1|OPS4J Pax Logging - API (1.8.2)
39|Active | 1|OPS4J Pax Web - Jetty Bundle (4.1.2)
40|Active | 1|com.mycompany.jpa.auth.entities (0.0.0.201506180718)
你能帮我找出这里缺少的东西吗?调试这种情况的最佳方法是什么?
谢谢。