I will add an example in Karaf internal using PreHook but it works for
me on my own example.

Regards
JB

On 23/01/2020 10:45, stefang wrote:
> Hi Erwin,
> 
> can you please check the reference example from Christian in your
> environment ?
> 
> https://github.com/cschneider/Karaf-Tutorial/blob/master/liquibase/service/src/main/java/net/lr/tutorial/db/service/Migrator.java
> 
> regards
> Stefan
>  
> 
> 
> Erwin Hogeweg wrote
>> Just this week I upgraded from karaf-1.2.6 and pax-jdbc-1.3.1 to
>> karaf-1.2.8-SNAPSHOT and pax-jdbc-1.4.4 and I didn’t run into any issues.
>>
>> Stupid question, but can you confirm that the Migrator class is
>> instantiated and that the component is active?
>>
>>      com.*.Migrator in bundle 129 (db.init:1.0.0.SNAPSHOT_20200122-1230)
>> enabled, 1 instance.
>>          Id: 18, State:ACTIVE
>>
>> Initially I missed some Package-Imports on the migrator bundle which left
>> the component in the SATISFIED (I believe) state. After scrolling through
>> the logs I discovered a CNFE which pointed me in the right direction.
>>
>> Erwin
>>
>>
>>> On Jan 22, 2020, at 12:53, Alex Soto <
> 
>> alex.soto@
> 
>> > wrote:
>>>
>>> I tested with Karaf 4.2.7 and various versions of Pax-JDBC.
>>> The hook is not being called stating with Pax-JDBC 1.3.4.
>>>
>>> Something must have changed in Pax-JDBC 1.3.4 as everything else remains
>>> the same in my tests.  
>>>
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>
>>>> On Jan 22, 2020, at 12:39 PM, Erwin Hogeweg <
> 
>> erwin.hogeweg@
> 
>>  <mailto:
> 
>> erwin.hogeweg@
> 
>> >> wrote:
>>>>
>>>> Ignore the different datasource names. I messed up the ‘replace all’ :-)
>>>>
>>>>> On Jan 22, 2020, at 12:36, Erwin Hogeweg <
> 
>> erwin.hogeweg@
> 
>>  <mailto:
> 
>> erwin.hogeweg@
> 
>> >> wrote:
>>>>>
>>>>> It seems to work for me with Karaf-4.2.8-SNAPSHOT and pax-jdbc-1.4.4.
>>>>>
>>>>>  12 │ Active   │  80 │ 1.4.4                        │ OPS4J Pax JDBC
>>>>> Generic Driver Extender
>>>>>  13 │ Active   │  80 │ 1.4.4                        │ OPS4J Pax JDBC
>>>>> Config
>>>>>  14 │ Active   │  80 │ 1.4.4                        │ OPS4J Pax JDBC
>>>>> Pooling Support Base
>>>>>
>>>>> [features-2-thread-1] INFO
>>>>> org.ops4j.pax.jdbc.config.impl.DataSourceRegistration - Found
>>>>> DataSourceFactory. Creating DataSource jdbc/mydatasource
>>>>> [features-2-thread-1] INFO
>>>>> org.ops4j.pax.jdbc.config.impl.DataSourceRegistration - Executing pre
>>>>> hook for DataSource jdbc/mydatasource
>>>>> INFO 1/22/20 12:32 PM: liquibase: Successfully acquired change log lock
>>>>> INFO 1/22/20 12:32 PM: liquibase: Reading from
>>>>> seegate.DATABASECHANGELOG
>>>>> INFO 1/22/20 12:32 PM: liquibase: Successfully released change log lock
>>>>> [features-2-thread-1] INFO
>>>>> org.ops4j.pax.jdbc.config.impl.DataSourceRegistration - Pre hook
>>>>> finished. Publishing DataSource jdbc/mydatasource
>>>>> [features-2-thread-1] INFO
>>>>> org.apache.aries.jpa.container.impl.DataSourceTracker - Found
>>>>> DataSource for seegate.pu
>>>>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/mydatasource)
>>>>>
>>>>> FWIW - I did change the exception handling in Migrator to better see
>>>>> when/if the migration fails:
>>>>>
>>>>>     @Override
>>>>>     public void prepare(DataSource ds) throws SQLException {
>>>>>         try (Connection connection = ds.getConnection()) {
>>>>>             prepare(connection);
>>>>>         } catch (LiquibaseException e) {
>>>>>           LOG.error(e.getClass().getName() + ": " + e.getMessage());
>>>>> //            throw new RuntimeException(e);
>>>>>         }
>>>>>     }
>>>>>
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Erwin
>>>>>
>>>>>> On Jan 22, 2020, at 11:11, Alex Soto <
> 
>> alex.soto@
> 
>>  <mailto:
> 
>> alex.soto@
> 
>> >> wrote:
>>>>>>
>>>>>> Same is happening to me, it works with Pax-JDBC 1.3.0, but not with
>>>>>> Pax-JDBC 1.4.0, which is the one included in Karaf 4.2.7.
>>>>>>
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> On Jan 20, 2020, at 9:10 AM, stefang <
> 
>> stefan.guenst@
> 
>>  <mailto:
> 
>> stefan.guenst@
> 
>> >> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> we are not able to run Christian's Example:
>>>>>>>
>>>>>>> https://github.com/cschneider/Karaf-Tutorial/blob/master/liquibase/service/src/main/java/net/lr/tutorial/db/service/Migrator.java
>>>>>>> <https://github.com/cschneider/Karaf-Tutorial/blob/master/liquibase/service/src/main/java/net/lr/tutorial/db/service/Migrator.java>
>>>>>>>
>>>>>>>
>>>>>>> Must be something todo with pax-jdbc 1.4.4 (wich comes with 4.2.8)
>>>>>>>
>>>>>>> Karaf 4.2.6 (pax-jdbc 1.3.5)works fine.
>>>>>>>
>>>>>>> Stefan
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>>>>>>> <http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html>
>>>>>>
>>>>>
>>>>
>>>
> 
> 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to