Hello.
I have an application that runs on Karaf 3.0.3 and would like to migrate to
Karaf 4.0.1.
The main problem I have with the migration of data service: I do not get
that blueprint inject the EntityManager.

*This is my pom:*

    <artifactId>dataService</artifactId>
    <version>0.0.1</version>
    <packaging>bundle</packaging>

    <name>DataBaseService</name>
    <description>Servicio de base de datos.</description>

    <build>
        <plugins>
        
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>        
        
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.5.4</version>
                <extensions>true</extensions>
                <inherited>true</inherited>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>salazarDB</Bundle-SymbolicName>
                        <Bundle-Version>${project.version}</Bundle-Version>
                       
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
                        <Export-Package>
                           
es.salazaryasociados.db.*;version=${project.version}
                        </Export-Package>
                        
                        <Import-Package>
                            *
                        </Import-Package>
                        <Dynamic-Import-Package>*, org.hibernate.proxy,
javassist.util.proxy</Dynamic-Import-Package>
                        <excludeDependencies>
                        </excludeDependencies>                        
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
        <dependencies>
                <dependency>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-jpa_2.0_spec</artifactId>
                        <version>1.1</version>
                        <scope>provided</scope>
                </dependency>
        
        <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>5.0.3.Final</version>
                <scope>provided</scope>
        </dependency>
        
                <dependency>
                    <groupId>javax.inject</groupId>
                    <artifactId>javax.inject</artifactId>
                    <version>1</version>
                    <optional>true</optional>
                </dependency>

                <dependency>
                        <groupId>javax.transaction</groupId>
                        <artifactId>javax.transaction-api</artifactId>
                        <version>1.2</version>
                </dependency>
        </dependencies>

*And this is the definition of the service:*

<?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/jpan/v1.0.0";
    xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    >
           
        <jpa:enable/>                   
        <service ref="dataService"
                interface="es.salazaryasociados.db.service.IDataService" />
                                                
        <bean id="dataService" 
class="es.salazaryasociados.db.service.DataService">
                <property name="fileDao" ref="fileDao"/>
                <property name="clientDao" ref="clientDao"/>
                <property name="responsableDao" ref="responsableDao"/>
                <property name="userDao" ref="userDao"/>
                <property name="pagoDao" ref="pagoDao"/>
                <property name="documentoDao" ref="documentDao"/>
                <tx:transaction method="*" value="Required" />
        </bean>
                   
        <bean id="clientDao"
                class="es.salazaryasociados.db.control.ClientDao">
        </bean>
                        
        <bean id="fileDao"
                class="es.salazaryasociados.db.control.ExpedienteDao">
        </bean>
        
        <bean id="responsableDao"
                class="es.salazaryasociados.db.control.ResponsableDao">
        </bean>

        <bean id="userDao" class="es.salazaryasociados.db.control.UserDao">
        </bean>

        <bean id="pagoDao" class="es.salazaryasociados.db.control.PagoDao">
        </bean>
        
        <bean id="documentDao"
class="es.salazaryasociados.db.control.DocumentoDao">
        </bean> 
                                
</blueprint>

And finally the class:

@Transactional
public class DataService implements IDataService  {

        private ClientDao clientDao;
        private ExpedienteDao fileDao;
        private ResponsableDao responsableDao;
        private UserDao userDao;
        private PagoDao pagoDao;
        private DocumentoDao documentoDao;
        
        @PersistenceContext(unitName="salazarJPA")
        EntityManager entityManager;
                
        public EntityManager getEntityManager() {
                return entityManager;
        }

        public void setEntityManager(EntityManager entityManager) {
                this.entityManager = entityManager;
        }


I've been mulling over time and can not see why not inject the EntityManager
blueprint.

Can you help me?
Thank you.



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Migration-to-Karaf-4-0-1-tp4042982.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to