1 Reply Latest reply on Jul 31, 2012 4:46 PM by michal.warecki

    Issue when trying to import javax.ejb in my OSGI bundle

    vmahe

      Hello everyone,

       

      I am trying to use JPA and Hibernate in order to handle my Bean persistency in my bundle.

       

      It was quite hard to have hibernate work with Fuse ESB but I found out that when you install the following custom feature, it works fine :

        <feature name="my-jpa-hibernate" version="4.4.1-fuse-07-11">

              <feature>jpa-hibernate</feature>

              <bundle>mvn:com.mysql.jdbc/com.springsource.com.mysql.jdbc/5.1.6</bundle>

        </feature>

       

      I wanted to share this with you all because it was very difficult to find this

       

      Now the issue I have is that I have the following DAO declared as an <osgi:service> in my Spring config :

      @Repository("userDaoRepo")

      public class UserDAOImpl implements UserDAO {

       

      @PersistenceContext(unitName="c4m-persist-unit")

      private EntityManager em;

       

      But for some reason I don't know, my EntityManager variable is null.

      Looking at the following article

      I thought I could solve this by adding the @Stateless EJB annotation to my DAO class.

       

      But now the issue I have when I deploy my bundle is that Karaf tells me it can't find the missing package javax.ejb.

       

      I'v added the following dependency :

      <dependency>

        <groupId>org.apache.geronimo.specs</groupId>

        <artifactId>geronimo-ejb_3.0_spec</artifactId>

        <version>1.0</version>

      </dependency>

      to my pom.xml file.

      And also added this to my bundle plugin configuration :

      <Import-Package>javax.sql<Import-Package>

      <Embed-Dependency>geronimo-ejb_3.0_spec</Embed-Dependency>

      but it stills tells me that the javax.ejb package is missing.

       

      Any idea ?

       

      Thanks

       

      Regards

       

      Vincent

       

      Edited by: vmahe on Jul 31, 2012 5:00 PM