Generally speaking, the JDBC feature in Karaf 4 is a change compared to Karaf 3. We should document better (I started to update documentation yesterday).

Due to the lack of documentation, it's not easy at all for end users to use JDBC in Karaf 4: it's not obvious that pax-jdbc should be installed, the config created from the factory should be explained, the JDBC datasources described using blueprint (as in Karaf 3) are still valid, but not well supported in the jdbc commands, etc.

My goal is to improve this for 4.0.3.

Regards
JB

On 10/10/2015 12:15 AM, conejo wrote:
Hello Christian. Thanks for your help.

*My DataSource is in the deploy folder and has the following contents:
*

<?xml version="1.0" encoding="UTF-8"?>


<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";      
                   
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";>

        <cm:property-placeholder persistent-id="GestorConfig"
update-strategy="reload">
                <cm:default-properties>
                        <cm:property name="db.url"
                        
value="jdbc:hsqldb:file:C:/Desarrollo/Pruebas/SalazarYAsociados/OSGI_Version/BBDD/hsqldb/salazar"
/>
                </cm:default-properties>
        </cm:property-placeholder>

        <bean id="dataSource" class="org.hsqldb.jdbc.JDBCDataSource">
                <property name="url" value="${db.url}" />
                <property name="user" value="salazar" />
                <property name="password" value="salazar" />
                
        </bean>
        
        <service interface="javax.sql.DataSource" ref="dataSource">
                <service-properties>
                        <entry key="osgi.jndi.service.name" value="jdbc/gestords" 
/>
                </service-properties>
        </service>
</blueprint>

On the other hand the data service (salazarDB) is a service that is
installed as part of the distribution (it's in the system folder, if I'm not
mistaken).

*In the log the following lines appear:*

2015-10-09 23:53:12,851 | INFO  | pool-2-thread-1  |
PersistenceBundleTracker         | 38 - org.apache.aries.jpa.container -
2.1.0 | Found persistence unit salazarJPA in bundle salazarDB with provider
org.hibernate.jpa.HibernatePersistenceProvider.
2015-10-09 23:53:12,867 | INFO  | pool-2-thread-1  |
PersistenceProviderTracker       | 38 - org.apache.aries.jpa.container -
2.1.0 | Found provider for salazarJPA
org.hibernate.jpa.HibernatePersistenceProvider

2015-10-09 23:53:13,165 | INFO  | pool-2-thread-1  | DataSourceTracker
| 38 - org.apache.aries.jpa.container - 2.1.0 | Tracking DataSource for
punit salazarJPA with filter
(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name=jdbc/gestords))
2015-10-09 23:53:13,165 | INFO  | pool-2-thread-1  | DataSourceTracker
| 38 - org.apache.aries.jpa.container - 2.1.0 | Found DataSource for
salazarJPA
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/gestords)
2015-10-09 23:53:13,165 | INFO  | jpa.salazarJPA]) | ManagedEMF
| 38 - org.apache.aries.jpa.container - 2.1.0 | Registering
EntityManagerFactory for persistence unit salazarJPA


*If you need the full log I can provide it for. You tell me.*

I can wait for version 4.0.2, if not much delay. We are evaluating it Karaf
for a larger project and the possibility of using JPA 2.0 seems more
attractive.



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


--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to