使用Gernomino 3.0.1尝试使用Aries / Blueprint进行OSGI。由于以下异常而撞墙:
2013-08-06 10:54:54,832 ERROR [BlueprintContainerImpl] Unable to start blueprint container for bundle com.xxx.xxx org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to instantiate components at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:644) at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:331) at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.VerifyError: (class: com/xxx.xxx/services/impl/$UserServiceImpl307032798, method: signature: (Ljava/lang/reflect/InvocationHandler;)V) Call to wrong initialization method at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2398) at java.lang.Class.getConstructor0(Class.java:2708) at java.lang.Class.getConstructor(Class.java:1659) at org.apache.aries.proxy.impl.gen.ProxySubclassGenerator.newProxySubclassInstance(ProxySubclassGenerator.java:159) at org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:81) at org.apache.aries.proxy.impl.AbstractProxyManager.createProxy(AbstractProxyManager.java:50) at org.apache.aries.blueprint.container.BeanRecipe.addInterceptors(BeanRecipe.java:688) at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:728) at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64) at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219) at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147) at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:640) ... 10 more
我的JDK版本在Ubuntu 13.04上是1.7.0_25-b15。
以下是我的Blueprint配置的样子:
<?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">
<!-- DataSource Derby -->
<bean id="dataSourceDerby" class="org.apache.derby.jdbc.EmbeddedDataSource">
<property name="databaseName" value="/home/imme/Data/xxxxdb"/>
<property name="createDatabase" value="create"/>
</bean>
<bean id="dataSourceXADerby" class="org.apache.derby.jdbc.EmbeddedXADataSource">
<property name="databaseName" value="/home/imme/Data/xxxxdb"/>
<property name="createDatabase" value="create"/>
</bean>
<!-- Expose DataSource as JNDI reference -->
<service ref="dataSourceDerby" interface="javax.sql.DataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/xxxxdb"/>
</service-properties>
</service>
<service ref="dataSourceXADerby" interface="javax.sql.XADataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/xaxxxxdb"/>
</service-properties>
</service>
<bean id="userServiceImpl" class="com.xxx.xxx.services.impl.UserServiceImpl">
<tx:transaction method="*" value="Required" />
<jpa:context property="entityManager" unitname="xxx-unit"/>
</bean>
<service id="userService" ref="userServiceImpl" interface="com.xxx.xxxx.services.UserService"/>
</blueprint>
如果我注释掉这条线:
<tx:transaction method="*" value="Required" />
我不再看到异常,但是服务不起作用,因为容器无法打开事务。尝试过使用JDK 1.6,同样的问题。
感谢任何帮助,谢谢!
答案 0 :(得分:0)
此错误已在最新版本的areis.jpa.container中修复,但geronimo仍然保留旧版捆绑包。
错误描述[http://mail-archives.apache.org/mod_mbox/aries-user/201210.mbox/%3CCAJ0TPGK12vVNFyb5TXH-dxLn29aORu_y1MKR2omD_Dmi-8tMOw@mail.gmail.com%3E][1]
捆绑受影响:
aries.jpa.container
org.apache.aries.proxy.impl
org.apache.aries.proxy