You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Jonathan Vila Lopez <jo...@gmail.com> on 2014/11/15 11:25:17 UTC
EntityManager injected is always null
Hello
I have a bundle with persistence.xml, and I have created a command that I
would like to execute an operation with the EntityManager .
But everytime I get a NPE because the entitymanager is null.
I have this in my blueprint.xml
<bean id="test"
class="com.tesipro.conectores.api.service.impl.TestSvcImpl">
<jpa:context property="entityManager" unitname="persistencia" />
</bean>
<bean id="command" class="com.tesipro.conectores.osgi.ApiCommand">
<property name="testSvc" ref="test"/>
</bean>
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
<command name="tesipro:test">
<action class="com.tesipro.conectores.osgi.ApiCommand">
</action>
</command>
</command-bundle>
Maybe the problem is related that in the command I use the class but not
the bean with the service injected ? How do I use a bean as the command ?
Kind regards.
[image: Inline image 2]
* Jonathan Vila ** <https://www.twitter.com/jonathan_vila>
<http://www.linkedin.com/in/jonathanvila>*
* jonathan.vila@gmail.com <jo...@gmail.com>*