Re: Using a Redis connection pool from Karaf
Not sure what the exact usage of command-pool is, but given the stack trace, it could be that a class is loaded from its name (i suspect it comes from the configuration). In such a case, to make it work in OSGi, the correct class loader needs to be used, one can't rely on the thread context class loader, or even the current class' classloader, which may have no visibility to the package. It may require a fix in some code loading the class to behave properly in OSGi. 2015-04-28 13:31 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl : I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of HikariCP. Bone doesn't have this dependency. This appears to work. BoneCP does want to load. Unfortunately I also have a Redis database which also has the dependency on Apache Commons Pool. So I'm back to the same error just one line down in my code. It doesn't look like there are any alternative connection pool libraries for Redis. I want to be able to connect to my Redis db using a connection pool, anyone know how to do that? On 04/23/2015 05:14 PM, Jurgen Voorneveld wrote: I got the maven install to work and installed a bunch of bundles: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 102 | Resolved | 80 | 2.3.0 | Apache Commons Pool 107 | Resolved | 80 | 2.3.6 | HikariCP 110 | Resolved | 80 | 3.19.0.GA | Javassist 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.46 | Analyzer Unfortunately this doesn't actually solve the problem. I'm still getting the same error: Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy despite it existing in the exports list: karaf@root() package:exports | grep commons org.apache.commons.pool2.impl | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2.proxy | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2 | 2.3.0 | 102 | org.apache.commons.pool2 and being included in the Import-Package in the manifest. running out of ideas... Jurgen On 04/23/2015 12:51 PM, Morgan Hautman wrote: Sorry for the typo, it changed to package in Karaf 3. You should install one package that export this service too. Try this: install mvn:com.zaxxer/HikariCP/x.x.x (version you want to use) Regards Morgan On 23/04/2015 12:37, Jurgen Voorneveld wrote: Should have paid more attention. karaf@root() package:exports | grep HikariConfig Returns empty. Which I guess makes sense; there is no library in Karaf exporting these classes by default. But I don't see how that could make it fail. The class is available in the bundle itself. For completeness this is the imports in the manifest: Import-Package: org.osgi.framework, javax.naming Jurgen On 04/23/2015 12:30 PM, Jurgen Voorneveld wrote: Helo Morgan, I get this: karaf@root() packages:exports | grep HikariConfig pipe: org.apache.felix.gogo.runtime.CommandNotFoundException: Command not found: packages:exports I have no idea what this means. Jurgen On 04/23/2015 12:18 PM, Morgan Hautman wrote: Hello Jurgen, What do you get when you're doing a packages:exports | grep HikariConfig? Regards Morgan On 23/04/2015 11:58, Jurgen Voorneveld wrote: Dear list, I have Apache Karaf installed on a production system here at work and I'm trying to install a bundle into it. This is fairly new to me as previously the code was simply running as standalone applications. I'm getting an exception when I try to load the bundle: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 87 | Resolved | 80 | 01.00.27 | Analyzer karaf@root() start 87 Error executing command: Error executing command on bundles: Unable to execute command on bundle 87: Activator start error in bundle nl.redsocks.farm.analyzer [87]. karaf@root() log:display 2015-04-23 11:48:28,700 | ERROR | h for user karaf | ShellUtil | 25 - org.apache.karaf.shell.console - 3.0.3 | Exception caught while executing command org.apache.karaf.shell.console.MultiException: Error executing command on bundles: Unable to execute command on bundle 87: Activator start error in bundle nl.redsocks.farm.analyzer [87]. at org.apache.karaf.shell.console.MultiException.throwIf(MultiException.java:92) at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:58) at
Re: Using a Redis connection pool from Karaf
hi Jurgen, a quick googling for Redis + OSGi gave me this [1]. Looks like someone is using jedis to connect to his redis server via blueprint. Might want to take a look at this. regards, Achim [1] - https://github.com/sneakybeaky/jedis-osgi/blob/master/example-datasource/src/main/resources/OSGI-INF/blueprint/local-redis-datasource.xml 2015-04-28 13:56 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl : I have no idea how Redis uses this library, I haven't read the code. My code does this: new JedisPool(new JedisPoolConfig(), redis_driver[0], Integer.parseInt(redis_driver[1]), 1800, password); On 04/28/2015 01:41 PM, Guillaume Nodet wrote: Not sure what the exact usage of command-pool is, but given the stack trace, it could be that a class is loaded from its name (i suspect it comes from the configuration). In such a case, to make it work in OSGi, the correct class loader needs to be used, one can't rely on the thread context class loader, or even the current class' classloader, which may have no visibility to the package. It may require a fix in some code loading the class to behave properly in OSGi. 2015-04-28 13:31 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of HikariCP. Bone doesn't have this dependency. This appears to work. BoneCP does want to load. Unfortunately I also have a Redis database which also has the dependency on Apache Commons Pool. So I'm back to the same error just one line down in my code. It doesn't look like there are any alternative connection pool libraries for Redis. I want to be able to connect to my Redis db using a connection pool, anyone know how to do that? On 04/23/2015 05:14 PM, Jurgen Voorneveld wrote: I got the maven install to work and installed a bunch of bundles: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 102 | Resolved | 80 | 2.3.0 | Apache Commons Pool 107 | Resolved | 80 | 2.3.6 | HikariCP 110 | Resolved | 80 | 3.19.0.GA http://3.19.0.GA | Javassist 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.46 | Analyzer Unfortunately this doesn't actually solve the problem. I'm still getting the same error: Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy despite it existing in the exports list: karaf@root() package:exports | grep commons org.apache.commons.pool2.impl | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2.proxy | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2 | 2.3.0 | 102 | org.apache.commons.pool2 and being included in the Import-Package in the manifest. running out of ideas... Jurgen On 04/23/2015 12:51 PM, Morgan Hautman wrote: Sorry for the typo, it changed to package in Karaf 3. You should install one package that export this service too. Try this: install mvn:com.zaxxer/HikariCP/x.x.x (version you want to use) Regards Morgan On 23/04/2015 12:37, Jurgen Voorneveld wrote: Should have paid more attention. karaf@root() package:exports | grep HikariConfig Returns empty. Which I guess makes sense; there is no library in Karaf exporting these classes by default. But I don't see how that could make it fail. The class is available in the bundle itself. For completeness this is the imports in the manifest: Import-Package: org.osgi.framework, javax.naming Jurgen On 04/23/2015 12:30 PM, Jurgen Voorneveld wrote: Helo Morgan, I get this: karaf@root() packages:exports | grep HikariConfig pipe: org.apache.felix.gogo.runtime.CommandNotFoundException: Command not found: packages:exports I have no idea what this means. Jurgen On 04/23/2015 12:18 PM, Morgan Hautman wrote: Hello Jurgen, What do you get when you're doing a packages:exports | grep HikariConfig? Regards Morgan On 23/04/2015 11:58, Jurgen Voorneveld wrote: Dear list, I have Apache Karaf installed on a production
Re: Using a Redis connection pool from Karaf
On 04/28/2015 01:59 PM, Achim Nierbeck wrote: hi Jurgen, a quick googling for Redis + OSGi gave me this [1]. Looks like someone is using jedis to connect to his redis server via blueprint. Might want to take a look at this. regards, Achim [1] - https://github.com/sneakybeaky/jedis-osgi/blob/master/example-datasource/src/main/resources/OSGI-INF/blueprint/local-redis-datasource.xml yeah I've run into a couple of people using redis with karaf. One guy was using it together with spring which doesn't help me much. I did find this page: https://github.com/sneakybeaky/karaf-jedis Which gives an example of how to install the redis bundle. I tried it and it gives me two problems. One is that it uses a really old version of the pool library that would conflict with my newer version of Hikari, now that I'm using Bone its less of an issue but worth keeping in mind. Second problem is more serious: karaf@root() install -s mvn:redis.clients/com.ninedemons.jedis/2.1.0-SNAPSHOT Bundle IDs: Error executing command: Error installing bundles: Unable to install bundle mvn:redis.clients/com.ninedemons.jedis/2.1.0-SNAPSHOT Caused by: java.io.IOException: Error resolving artifact redis.clients:com.ninedemons.jedis:jar:2.1.0-SNAPSHOT: Could not find artifact redis.clients:com.ninedemons.jedis:jar:2.1.0-SNAPSHOT in apache (http://repository.apache.org/content/groups/snapshots-group/) looks like the bundle no longer exists. On 04/28/2015 02:00 PM, Achim Nierbeck wrote: Oh and one, more I think there is a redis OSGi client available from the servicemix bundles. Might want to look at that too. Could be that you need to split your application a lot faster then you thought :D Yeah, every fix I do seems to require some form of splitting. Oh well, as long as it works in the end. :) 2015-04-28 13:56 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I have no idea how Redis uses this library, I haven't read the code. My code does this: new JedisPool(new JedisPoolConfig(), redis_driver[0], Integer.parseInt(redis_driver[1]), 1800, password); On 04/28/2015 01:41 PM, Guillaume Nodet wrote: Not sure what the exact usage of command-pool is, but given the stack trace, it could be that a class is loaded from its name (i suspect it comes from the configuration). In such a case, to make it work in OSGi, the correct class loader needs to be used, one can't rely on the thread context class loader, or even the current class' classloader, which may have no visibility to the package. It may require a fix in some code loading the class to behave properly in OSGi. 2015-04-28 13:31 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of HikariCP. Bone doesn't have this dependency. This appears to work. BoneCP does want to load. Unfortunately I also have a Redis database which also has the dependency on Apache Commons Pool. So I'm back to the same error just one line down in my code. It doesn't look like there are any alternative connection pool libraries for Redis. I want to be able to connect to my Redis db using a connection pool, anyone know how to do that? On 04/23/2015 05:14 PM, Jurgen Voorneveld wrote: I got the maven install to work and installed a bunch of bundles: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 102 | Resolved | 80 | 2.3.0 | Apache Commons Pool 107 | Resolved | 80 | 2.3.6 | HikariCP 110 | Resolved | 80 | 3.19.0.GA http://3.19.0.GA http://3.19.0.GA | Javassist 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.46 | Analyzer Unfortunately this doesn't actually solve the problem. I'm still getting the same error: Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy despite it existing in the exports list: karaf@root() package:exports | grep commons org.apache.commons.pool2.impl | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2.proxy
Re: Karaf 3.0.1 does not consider service ranking set by Blueprint
Seems to be an issue of the Aries Blueprint implementation. To me it seems that the reference to the service (A1 or A2) is set when the component (X) is created. It only takes those services into account which exist at that moment. If later on another service with a higher ranking is added, the reference is not updated. As a workaround I've created a class which is a service reference listener. When a service is added, the service, ranking and ID is wrapped in an object and put into a TreeMap. The wrapper object implements compare to ensure the correct ordering of the services. With this workaround it is possible to add and remove new services with different rankings at runtime. Regards Jochen -- View this message in context: http://karaf.922171.n3.nabble.com/Karaf-3-0-1-does-not-consider-service-ranking-set-by-Blueprint-tp4039991p4040038.html Sent from the Karaf - User mailing list archive at Nabble.com.
Using a Redis connection pool from Karaf
I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of HikariCP. Bone doesn't have this dependency. This appears to work. BoneCP does want to load. Unfortunately I also have a Redis database which also has the dependency on Apache Commons Pool. So I'm back to the same error just one line down in my code. It doesn't look like there are any alternative connection pool libraries for Redis. I want to be able to connect to my Redis db using a connection pool, anyone know how to do that? On 04/23/2015 05:14 PM, Jurgen Voorneveld wrote: I got the maven install to work and installed a bunch of bundles: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 102 | Resolved | 80 | 2.3.0 | Apache Commons Pool 107 | Resolved | 80 | 2.3.6 | HikariCP 110 | Resolved | 80 | 3.19.0.GA | Javassist 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.46 | Analyzer Unfortunately this doesn't actually solve the problem. I'm still getting the same error: Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy despite it existing in the exports list: karaf@root() package:exports | grep commons org.apache.commons.pool2.impl | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2.proxy | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2 | 2.3.0 | 102 | org.apache.commons.pool2 and being included in the Import-Package in the manifest. running out of ideas... Jurgen On 04/23/2015 12:51 PM, Morgan Hautman wrote: Sorry for the typo, it changed to package in Karaf 3. You should install one package that export this service too. Try this: install mvn:com.zaxxer/HikariCP/x.x.x (version you want to use) Regards Morgan On 23/04/2015 12:37, Jurgen Voorneveld wrote: Should have paid more attention. karaf@root() package:exports | grep HikariConfig Returns empty. Which I guess makes sense; there is no library in Karaf exporting these classes by default. But I don't see how that could make it fail. The class is available in the bundle itself. For completeness this is the imports in the manifest: Import-Package: org.osgi.framework, javax.naming Jurgen On 04/23/2015 12:30 PM, Jurgen Voorneveld wrote: Helo Morgan, I get this: karaf@root() packages:exports | grep HikariConfig pipe: org.apache.felix.gogo.runtime.CommandNotFoundException: Command not found: packages:exports I have no idea what this means. Jurgen On 04/23/2015 12:18 PM, Morgan Hautman wrote: Hello Jurgen, What do you get when you're doing a packages:exports | grep HikariConfig? Regards Morgan On 23/04/2015 11:58, Jurgen Voorneveld wrote: Dear list, I have Apache Karaf installed on a production system here at work and I'm trying to install a bundle into it. This is fairly new to me as previously the code was simply running as standalone applications. I'm getting an exception when I try to load the bundle: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 87 | Resolved | 80 | 01.00.27 | Analyzer karaf@root() start 87 Error executing command: Error executing command on bundles: Unable to execute command on bundle 87: Activator start error in bundle nl.redsocks.farm.analyzer [87]. karaf@root() log:display 2015-04-23 11:48:28,700 | ERROR | h for user karaf | ShellUtil | 25 - org.apache.karaf.shell.console - 3.0.3 | Exception caught while executing command org.apache.karaf.shell.console.MultiException: Error executing command on bundles: Unable to execute command on bundle 87: Activator start error in bundle nl.redsocks.farm.analyzer [87]. at org.apache.karaf.shell.console.MultiException.throwIf(MultiException.java:92) at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:58) at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:50) at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:41) at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:33)[25:org.apache.karaf.shell.console:3.0.3] at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:39)[25:org.apache.karaf.shell.console:3.0.3] at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:33)[25:org.apache.karaf.shell.console:3.0.3] at Proxy5f648166_9983_4f8f_acb1_23f0c1d1ea3b.execute(Unknown Source)[:] at
Re: Using a Redis connection pool from Karaf
Hi Jurgen, do you have the right imports for it configured on your bundles? So which bundle doesn't start? Take a look at the bundle:headers ID of this bundle and check if it actually imports the package you are looking for. If not, make sure the bundle does import it. regards, Achim 2015-04-28 13:31 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl : I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of HikariCP. Bone doesn't have this dependency. This appears to work. BoneCP does want to load. Unfortunately I also have a Redis database which also has the dependency on Apache Commons Pool. So I'm back to the same error just one line down in my code. It doesn't look like there are any alternative connection pool libraries for Redis. I want to be able to connect to my Redis db using a connection pool, anyone know how to do that? On 04/23/2015 05:14 PM, Jurgen Voorneveld wrote: I got the maven install to work and installed a bunch of bundles: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 102 | Resolved | 80 | 2.3.0 | Apache Commons Pool 107 | Resolved | 80 | 2.3.6 | HikariCP 110 | Resolved | 80 | 3.19.0.GA | Javassist 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.46 | Analyzer Unfortunately this doesn't actually solve the problem. I'm still getting the same error: Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy despite it existing in the exports list: karaf@root() package:exports | grep commons org.apache.commons.pool2.impl | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2.proxy | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2 | 2.3.0 | 102 | org.apache.commons.pool2 and being included in the Import-Package in the manifest. running out of ideas... Jurgen On 04/23/2015 12:51 PM, Morgan Hautman wrote: Sorry for the typo, it changed to package in Karaf 3. You should install one package that export this service too. Try this: install mvn:com.zaxxer/HikariCP/x.x.x (version you want to use) Regards Morgan On 23/04/2015 12:37, Jurgen Voorneveld wrote: Should have paid more attention. karaf@root() package:exports | grep HikariConfig Returns empty. Which I guess makes sense; there is no library in Karaf exporting these classes by default. But I don't see how that could make it fail. The class is available in the bundle itself. For completeness this is the imports in the manifest: Import-Package: org.osgi.framework, javax.naming Jurgen On 04/23/2015 12:30 PM, Jurgen Voorneveld wrote: Helo Morgan, I get this: karaf@root() packages:exports | grep HikariConfig pipe: org.apache.felix.gogo.runtime.CommandNotFoundException: Command not found: packages:exports I have no idea what this means. Jurgen On 04/23/2015 12:18 PM, Morgan Hautman wrote: Hello Jurgen, What do you get when you're doing a packages:exports | grep HikariConfig? Regards Morgan On 23/04/2015 11:58, Jurgen Voorneveld wrote: Dear list, I have Apache Karaf installed on a production system here at work and I'm trying to install a bundle into it. This is fairly new to me as previously the code was simply running as standalone applications. I'm getting an exception when I try to load the bundle: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 87 | Resolved | 80 | 01.00.27 | Analyzer karaf@root() start 87 Error executing command: Error executing command on bundles: Unable to execute command on bundle 87: Activator start error in bundle nl.redsocks.farm.analyzer [87]. karaf@root() log:display 2015-04-23 11:48:28,700 | ERROR | h for user karaf | ShellUtil | 25 - org.apache.karaf.shell.console - 3.0.3 | Exception caught while executing command org.apache.karaf.shell.console.MultiException: Error executing command on bundles: Unable to execute command on bundle 87: Activator start error in bundle nl.redsocks.farm.analyzer [87]. at org.apache.karaf.shell.console.MultiException.throwIf(MultiException.java:92) at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:58) at org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:50) at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:41) at
Re: Using a Redis connection pool from Karaf
I have no idea how Redis uses this library, I haven't read the code. My code does this: new JedisPool(new JedisPoolConfig(), redis_driver[0], Integer.parseInt(redis_driver[1]), 1800, password); On 04/28/2015 01:41 PM, Guillaume Nodet wrote: Not sure what the exact usage of command-pool is, but given the stack trace, it could be that a class is loaded from its name (i suspect it comes from the configuration). In such a case, to make it work in OSGi, the correct class loader needs to be used, one can't rely on the thread context class loader, or even the current class' classloader, which may have no visibility to the package. It may require a fix in some code loading the class to behave properly in OSGi. 2015-04-28 13:31 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of HikariCP. Bone doesn't have this dependency. This appears to work. BoneCP does want to load. Unfortunately I also have a Redis database which also has the dependency on Apache Commons Pool. So I'm back to the same error just one line down in my code. It doesn't look like there are any alternative connection pool libraries for Redis. I want to be able to connect to my Redis db using a connection pool, anyone know how to do that? On 04/23/2015 05:14 PM, Jurgen Voorneveld wrote: I got the maven install to work and installed a bunch of bundles: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 102 | Resolved | 80 | 2.3.0 | Apache Commons Pool 107 | Resolved | 80 | 2.3.6 | HikariCP 110 | Resolved | 80 | 3.19.0.GA http://3.19.0.GA | Javassist 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.46 | Analyzer Unfortunately this doesn't actually solve the problem. I'm still getting the same error: Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy despite it existing in the exports list: karaf@root() package:exports | grep commons org.apache.commons.pool2.impl | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2.proxy | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2 | 2.3.0 | 102 | org.apache.commons.pool2 and being included in the Import-Package in the manifest. running out of ideas... Jurgen On 04/23/2015 12:51 PM, Morgan Hautman wrote: Sorry for the typo, it changed to package in Karaf 3. You should install one package that export this service too. Try this: install mvn:com.zaxxer/HikariCP/x.x.x (version you want to use) Regards Morgan On 23/04/2015 12:37, Jurgen Voorneveld wrote: Should have paid more attention. karaf@root() package:exports | grep HikariConfig Returns empty. Which I guess makes sense; there is no library in Karaf exporting these classes by default. But I don't see how that could make it fail. The class is available in the bundle itself. For completeness this is the imports in the manifest: Import-Package: org.osgi.framework, javax.naming Jurgen On 04/23/2015 12:30 PM, Jurgen Voorneveld wrote: Helo Morgan, I get this: karaf@root() packages:exports | grep HikariConfig pipe: org.apache.felix.gogo.runtime.CommandNotFoundException: Command not found: packages:exports I have no idea what this means. Jurgen On 04/23/2015 12:18 PM, Morgan Hautman wrote: Hello Jurgen, What do you get when you're doing a packages:exports | grep HikariConfig? Regards Morgan On 23/04/2015 11:58, Jurgen Voorneveld wrote: Dear list, I have Apache Karaf installed on a production system here at work and I'm trying to install a bundle into it. This is fairly new to me as previously the code was simply running as standalone applications. I'm getting an exception when I try to load the bundle: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 87 | Resolved | 80 | 01.00.27 | Analyzer karaf@root() start 87 Error executing command: Error executing
Re: Karaf 3.0.1 does not consider service ranking set by Blueprint
Hi, did you think about upgrading to a newer release of Karaf, cause I think this issue might have been fixed with a newer version of Aries. regards, Achim 2015-04-28 16:13 GMT+02:00 jkraushaar jochen.kraush...@doubleslash.de: Seems to be an issue of the Aries Blueprint implementation. To me it seems that the reference to the service (A1 or A2) is set when the component (X) is created. It only takes those services into account which exist at that moment. If later on another service with a higher ranking is added, the reference is not updated. As a workaround I've created a class which is a service reference listener. When a service is added, the service, ranking and ID is wrapped in an object and put into a TreeMap. The wrapper object implements compare to ensure the correct ordering of the services. With this workaround it is possible to add and remove new services with different rankings at runtime. Regards Jochen -- View this message in context: http://karaf.922171.n3.nabble.com/Karaf-3-0-1-does-not-consider-service-ranking-set-by-Blueprint-tp4039991p4040038.html Sent from the Karaf - User mailing list archive at Nabble.com. -- Apache Member Apache Karaf http://karaf.apache.org/ Committer PMC OPS4J Pax Web http://wiki.ops4j.org/display/paxweb/Pax+Web/ Committer Project Lead blog http://notizblog.nierbeck.de/ Co-Author of Apache Karaf Cookbook http://bit.ly/1ps9rkS Software Architect / Project Manager / Scrum Master
Re: local-broker.xml at startup
Hi above all, a big thank you. aries-blueprint is defined line 51 in standard-2.4.1-features.xml boot features grouping on Karaf 2.4.1 does not work log: Regards JYT -- View this message in context: http://karaf.922171.n3.nabble.com/local-broker-xml-at-startup-tp4039960p4040037.html Sent from the Karaf - User mailing list archive at Nabble.com.
Re: local-broker.xml at startup
Oh correct, it's in 2.x, not in 2.3.x. My bad. I didn't have time to take a look yet. I will keep you posted. Regards JB On 04/28/2015 04:08 PM, sekaijin wrote: Hi above all, a big thank you. aries-blueprint is defined line 51 in standard-2.4.1-features.xml boot features grouping on Karaf 2.4.1 does not work log: Regards JYT -- View this message in context: http://karaf.922171.n3.nabble.com/local-broker-xml-at-startup-tp4039960p4040037.html Sent from the Karaf - User mailing list archive at Nabble.com. -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com
Re: Karaf 3.0.1 does not consider service ranking set by Blueprint
Hi Achim, I checked the release notes of Karaf. According to them, Aries Blueprint was updated in 3.0.3 to 1.4.2. I would really like to update to this version. Unfortunately some of our legacy libraries are incompatible with the updates of the JPA libraries in 3.0.3. :-( Regards Jochen -- View this message in context: http://karaf.922171.n3.nabble.com/Karaf-3-0-1-does-not-consider-service-ranking-set-by-Blueprint-tp4039991p4040042.html Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Karaf 3.0.1 does not consider service ranking set by Blueprint
Blueprint will stay with the service it selected until this service goes away. So for example if you would stop A1 and start it again then blueprint would switch. This is obviously not what people expect when the ranking is used. So I would consider this to be either a bug or a good enhancement request. Can you open an issue at aries if there is none already? I can work on it. Christian On 28.04.2015 16:13, jkraushaar wrote: Seems to be an issue of the Aries Blueprint implementation. To me it seems that the reference to the service (A1 or A2) is set when the component (X) is created. It only takes those services into account which exist at that moment. If later on another service with a higher ranking is added, the reference is not updated. As a workaround I've created a class which is a service reference listener. When a service is added, the service, ranking and ID is wrapped in an object and put into a TreeMap. The wrapper object implements compare to ensure the correct ordering of the services. With this workaround it is possible to add and remove new services with different rankings at runtime. Regards Jochen -- View this message in context: http://karaf.922171.n3.nabble.com/Karaf-3-0-1-does-not-consider-service-ranking-set-by-Blueprint-tp4039991p4040038.html Sent from the Karaf - User mailing list archive at Nabble.com. -- Christian Schneider http://www.liquid-reality.de Open Source Architect http://www.talend.com
Re: Using a Redis connection pool from Karaf
I'd love to know how to do that. This page: https://github.com/sneakybeaky/jedis-osgi lists this information: dependency groupIdredis.clients/groupId artifactIdcom.ninedemons.jedis/artifactId version2.1.0-SNAPSHOT/version /dependency When I go to maven central website and search for redis.clients I get a single hit pointing to jedis. com.ninedemons.jedis is not listed. I also found a different Redis client RJC here: https://github.com/e-mzungu/rjc It claims to be OSGi compliant but it hasn't been updated in four years. And I don't know how many changes to the code I will have to make to get it to work (or if it even has the features I need). And then there is this thing: http://mvnrepository.com/artifact/org.apache.servicemix.bundles/org.apache.servicemix.bundles.jedis Its the same version of the library that I'm using right now but it has zero listed Usages. Gonna see what happens if I install this thing into Karaf. On 04/28/2015 02:15 PM, Achim Nierbeck wrote: Hi, did you check if the bundle you are looking for is now released? Cause usually the snapshots are deleted the minute a release is through. regards, Achim 2015-04-28 14:11 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: On 04/28/2015 01:59 PM, Achim Nierbeck wrote: hi Jurgen, a quick googling for Redis + OSGi gave me this [1]. Looks like someone is using jedis to connect to his redis server via blueprint. Might want to take a look at this. regards, Achim [1] - https://github.com/sneakybeaky/jedis-osgi/blob/master/example-datasource/src/main/resources/OSGI-INF/blueprint/local-redis-datasource.xml yeah I've run into a couple of people using redis with karaf. One guy was using it together with spring which doesn't help me much. I did find this page: https://github.com/sneakybeaky/karaf-jedis Which gives an example of how to install the redis bundle. I tried it and it gives me two problems. One is that it uses a really old version of the pool library that would conflict with my newer version of Hikari, now that I'm using Bone its less of an issue but worth keeping in mind. Second problem is more serious: karaf@root() install -s mvn:redis.clients/com.ninedemons.jedis/2.1.0-SNAPSHOT Bundle IDs: Error executing command: Error installing bundles: Unable to install bundle mvn:redis.clients/com.ninedemons.jedis/2.1.0-SNAPSHOT Caused by: java.io.IOException: Error resolving artifact redis.clients:com.ninedemons.jedis:jar:2.1.0-SNAPSHOT: Could not find artifact redis.clients:com.ninedemons.jedis:jar:2.1.0-SNAPSHOT in apache (http://repository.apache.org/content/groups/snapshots-group/) looks like the bundle no longer exists. On 04/28/2015 02:00 PM, Achim Nierbeck wrote: Oh and one, more I think there is a redis OSGi client available from the servicemix bundles. Might want to look at that too. Could be that you need to split your application a lot faster then you thought :D Yeah, every fix I do seems to require some form of splitting. Oh well, as long as it works in the end. :) 2015-04-28 13:56 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I have no idea how Redis uses this library, I haven't read the code. My code does this: new JedisPool(new JedisPoolConfig(), redis_driver[0], Integer.parseInt(redis_driver[1]), 1800, password); On 04/28/2015 01:41 PM, Guillaume Nodet wrote: Not sure what the exact usage of command-pool is, but given the stack trace, it could be that a class is loaded from its name (i suspect it comes from the configuration). In such a case, to make it work in OSGi, the correct class loader needs to be used, one can't rely on the thread context class loader, or even the current class' classloader, which may have no visibility to the package. It may require a fix in some code loading the class to behave properly in OSGi. 2015-04-28 13:31 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of
Re: Using a Redis connection pool from Karaf
Getting closer.. after loading that servicemix jedis bundle I got this error while running my code: Error executing command: Error executing command on bundles: Unable to execute command on bundle 113: Unresolved constraint in bundle nl.redsocks.farm.analyzer [113]: Unable to resolve 113.11: missing requirement [113.11] osgi.wiring.package; (osgi.wiring.package=redis.clients.jedis) [caused by: Unable to resolve 146.0: missing requirement [146.0] osgi.wiring.package; (osgi.wiring.package=org.apache.commons.pool2) [caused by: Unable to resolve 144.0: missing requirement [144.0] osgi.wiring.package; (osgi.wiring.package=net.sf.cglib.proxy)]] So jedis wanted commons pool and commons pool wanted cglib which didn't exist. maven central lists three versions of cglib, none of which worked. But lower on the page is another wrapper of the library: Apache ServiceMix :: Bundles :: Cglib after installing that one I suddenly get this: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.56 | Analyzer 131 | Resolved | 80 | 0.8.0.RELEASE | BoneCP :: Core Library 134 | Resolved | 80 | 15.0.0| Guava: Google Core Libraries for Java 144 | Resolved | 80 | 2.1.0 | Apache Commons Pool 146 | Resolved | 80 | 2.6.2.1 | Apache ServiceMix :: Bundles :: jedis 149 | Resolved | 80 | 3.1.0.1 | Apache ServiceMix :: Bundles :: cglib Wow, everything is in 'Resolved' state. Sounds lovely. Running doesn't work though: karaf@root() start 113 Error executing command: Error executing command on bundles: Unable to execute command on bundle 113: Activator start error in bundle nl.redsocks.farm.analyzer [113]. Caused by: org.osgi.framework.BundleException: Activator start error in bundle nl.redsocks.farm.analyzer [113]. at org.apache.felix.framework.Felix.activateBundle(Felix.java:2196) at org.apache.felix.framework.Felix.startBundle(Felix.java:2064) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942) at org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:27) at org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:53) ... 20 more Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig at nl.redsocks.farm.analyzer.core.Analyzer.start(Analyzer.java:258) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645) at org.apache.felix.framework.Felix.activateBundle(Felix.java:2146) ... 25 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.GenericObjectPoolConfig not found by nl.redsocks.farm.analyzer [113] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_25] So now it suddenly can't find GenericObjectPoolConfig. Lovely. On 04/28/2015 02:29 PM, Jurgen Voorneveld wrote: I'd love to know how to do that. This page: https://github.com/sneakybeaky/jedis-osgi lists this information: dependency groupIdredis.clients/groupId artifactIdcom.ninedemons.jedis/artifactId version2.1.0-SNAPSHOT/version /dependency When I go to maven central website and search for redis.clients I get a single hit pointing to jedis. com.ninedemons.jedis is not listed. I also found a different Redis client RJC here: https://github.com/e-mzungu/rjc It claims to be OSGi compliant but it hasn't been updated in four years. And I don't know how many changes to the code I will have to make to get it to work (or if it even has the features I need). And then there is this thing: http://mvnrepository.com/artifact/org.apache.servicemix.bundles/org.apache.servicemix.bundles.jedis Its the same version of the library that I'm using right now but it has zero listed Usages. Gonna see what happens if I install this thing into Karaf. On 04/28/2015 02:15 PM, Achim Nierbeck wrote: Hi, did you check if the bundle you are looking for is now released? Cause usually the snapshots are deleted the minute a release is through. regards, Achim 2015-04-28 14:11 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: On 04/28/2015 01:59 PM, Achim Nierbeck wrote: hi Jurgen, a quick googling for Redis + OSGi gave me this [1].
Re: Using a Redis connection pool from Karaf
Hi, did you check if the bundle you are looking for is now released? Cause usually the snapshots are deleted the minute a release is through. regards, Achim 2015-04-28 14:11 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl : On 04/28/2015 01:59 PM, Achim Nierbeck wrote: hi Jurgen, a quick googling for Redis + OSGi gave me this [1]. Looks like someone is using jedis to connect to his redis server via blueprint. Might want to take a look at this. regards, Achim [1] - https://github.com/sneakybeaky/jedis-osgi/blob/master/example-datasource/src/main/resources/OSGI-INF/blueprint/local-redis-datasource.xml yeah I've run into a couple of people using redis with karaf. One guy was using it together with spring which doesn't help me much. I did find this page: https://github.com/sneakybeaky/karaf-jedis Which gives an example of how to install the redis bundle. I tried it and it gives me two problems. One is that it uses a really old version of the pool library that would conflict with my newer version of Hikari, now that I'm using Bone its less of an issue but worth keeping in mind. Second problem is more serious: karaf@root() install -s mvn:redis.clients/com.ninedemons.jedis/2.1.0-SNAPSHOT Bundle IDs: Error executing command: Error installing bundles: Unable to install bundle mvn:redis.clients/com.ninedemons.jedis/2.1.0-SNAPSHOT Caused by: java.io.IOException: Error resolving artifact redis.clients:com.ninedemons.jedis:jar:2.1.0-SNAPSHOT: Could not find artifact redis.clients:com.ninedemons.jedis:jar:2.1.0-SNAPSHOT in apache (http://repository.apache.org/content/groups/snapshots-group/) looks like the bundle no longer exists. On 04/28/2015 02:00 PM, Achim Nierbeck wrote: Oh and one, more I think there is a redis OSGi client available from the servicemix bundles. Might want to look at that too. Could be that you need to split your application a lot faster then you thought :D Yeah, every fix I do seems to require some form of splitting. Oh well, as long as it works in the end. :) 2015-04-28 13:56 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I have no idea how Redis uses this library, I haven't read the code. My code does this: new JedisPool(new JedisPoolConfig(), redis_driver[0], Integer.parseInt(redis_driver[1]), 1800, password); On 04/28/2015 01:41 PM, Guillaume Nodet wrote: Not sure what the exact usage of command-pool is, but given the stack trace, it could be that a class is loaded from its name (i suspect it comes from the configuration). In such a case, to make it work in OSGi, the correct class loader needs to be used, one can't rely on the thread context class loader, or even the current class' classloader, which may have no visibility to the package. It may require a fix in some code loading the class to behave properly in OSGi. 2015-04-28 13:31 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of HikariCP. Bone doesn't have this dependency. This appears to work. BoneCP does want to load. Unfortunately I also have a Redis database which also has the dependency on Apache Commons Pool. So I'm back to the same error just one line down in my code. It doesn't look like there are any alternative connection pool libraries for Redis. I want to be able to connect to my Redis db using a connection pool, anyone know how to do that? On 04/23/2015 05:14 PM, Jurgen Voorneveld wrote: I got the maven install to work and installed a bunch of bundles: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 102 | Resolved | 80 | 2.3.0 | Apache Commons Pool 107 | Resolved | 80 | 2.3.6 | HikariCP 110 | Resolved | 80 | 3.19.0.GA http://3.19.0.GA http://3.19.0.GA | Javassist 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.46 | Analyzer Unfortunately this doesn't actually solve the problem. I'm still getting the same error: Caused by: java.lang.ClassNotFoundException:
Re: Security in Module
Hmm .. I think this is a bug then. Probably we should always look in both the interface and the class for the annotations. Can you open an issue for this ? Christian On 27.04.2015 20:00, kuvalda wrote: Hi, Christian! I tried your blueprint-authz bundle to to authorize in OSGi services and found out in its code, that SecurityAnotationParser parses beans, so looks for annotations in class. But in runtime AuthorizationInterceptor looks for annotations in called method's declaring class. As an OSGi service is an interface, we can get such a situation, that method of a class would require athorization, but could not get it, if service's interface would not be annotated with @RolesAlowed. It's a code example below: public interface EchoService { //@RolesAllowed(admin) public String echo(String message); } public class SimpleEchoService implements EchoService { @RolesAllowed(admin) @Override public String echo(String message) { String result = message; return result; } } @Command(scope = kb, name = echo) public class EchoCommand extends OsgiCommandSupport { private EchoService echoService; public EchoService getEchoService() { return echoService; } public void setEchoService(EchoService echoService) { this.echoService = echoService; } @Argument(index = 0, name = message, required = true, multiValued = false) private String message; @Override protected Object doExecute() throws Exception { return echoService.echo(message); } } Calling echo command in karaf console in this case we will get an error message with empty roles' list Method call interface biz.lorien.umrp.kb.properties.EchoService.echo denied. Roles allowed are []. And it's OK with uncommented annotation @RolesAllowed(admin) in EchoService interface. I think, it's not the best way to duplicate annotations both in interface and implementing class. Perhaps, it's my incorrect use of blueprint-authz? What do you think about it? Thanks in advance! Pavel cschneider wrote There is one more thing you should look into. Quite often you will need the authentication result in a place different from the place where you do the authentication. Passing the subject around is not very effective. Luckily there is a quite unknown way in JAAS to do this: AccessControlContext acc = AccessController.getContext(); Subject subject = Subject.getSubject(acc); This allows to get the subject at any place in your code. An even more convenient way if you use blueprint is to authorize based on security annotations. See the blueprint-auhtz module: https://fisheye6.atlassian.com/browse/~br=trunk/aries/trunk/blueprint/blueprint-authz - Pavel -- View this message in context: http://karaf.922171.n3.nabble.com/Security-in-Module-tp4039307p4040001.html Sent from the Karaf - User mailing list archive at Nabble.com. -- Christian Schneider http://www.liquid-reality.de Open Source Architect http://www.talend.com
Re: Using a Redis connection pool from Karaf
Hey Achim, right now I have one bundle that contains the Redis client classes themselves but not the Apache Commons Pool classes. (I haven't figured out how to install jedis as a separate bundle from maven yet, errors...) Those classes are loaded using the import statement in the manifest: Import-Package: org.osgi.framework, javax.naming, org.slf4j, javax.sql , javax.management, sun.net, org.apache.commons.pool2.proxy, org.apac he.commons.pool2.impl, org.apache.commons.pool2, com.mysql.jdbc, com.jolbox.bonecp, com.google.common.base, com.mysql.jdbc.jdbc2.optional my list of installed bundles is as follows: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State | Lvl | Version | Name -- 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.55 | Analyzer 131 | Resolved | 80 | 0.8.0.RELEASE | BoneCP :: Core Library 134 | Resolved | 80 | 15.0.0| Guava: Google Core Libraries for Java 142 | Installed | 80 | 2.3.0 | Apache Commons Pool and the export list says this: karaf@root() package:exports | grep commons org.apache.commons.logging.impl| 1.0.4 | 3 | org.ops4j.pax.logging.pax-logging-api org.apache.commons.logging.impl| 1.1.1 | 3 | org.ops4j.pax.logging.pax-logging-api org.apache.commons.logging | 1.0.4 | 3 | org.ops4j.pax.logging.pax-logging-api org.apache.commons.logging | 1.1.1 | 3 | org.ops4j.pax.logging.pax-logging-api org.apache.commons.pool2.impl | 2.3.0 | 142 | org.apache.commons.pool2 org.apache.commons.pool2.proxy | 2.3.0 | 142 | org.apache.commons.pool2 org.apache.commons.pool2 | 2.3.0 | 142 | org.apache.commons.pool2 org.objectweb.asm.commons | 5.0.3 | 8 | org.objectweb.asm.all The exception is this: Caused by: java.lang.IllegalArgumentException: Unable to create EvictionPolicy instance of type org.apache.commons.pool2.impl.DefaultEvictionPolicy at org.apache.commons.pool2.impl.BaseGenericObjectPool.setEvictionPolicyClassName(BaseGenericObjectPool.java:607) at org.apache.commons.pool2.impl.GenericObjectPool.setConfig(GenericObjectPool.java:321) at org.apache.commons.pool2.impl.GenericObjectPool.init(GenericObjectPool.java:117) at redis.clients.util.Pool.initPool(Pool.java:43) at redis.clients.util.Pool.init(Pool.java:31) at redis.clients.jedis.JedisPool.init(JedisPool.java:73) at redis.clients.jedis.JedisPool.init(JedisPool.java:54) at nl.redsocks.farm.common.services.Redis.createRedisPool(Redis.java:56) at nl.redsocks.farm.common.services.Redis.init(Redis.java:50) at nl.redsocks.farm.analyzer.core.Analyzer.start(Analyzer.java:258) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645) at org.apache.felix.framework.Felix.activateBundle(Felix.java:2146) ... 25 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy at java.net.URLClassLoader$1.run(URLClassLoader.java:372)[:1.8.0_25] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)[:1.8.0_25] at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_25] at java.net.URLClassLoader.findClass(URLClassLoader.java:360)[:1.8.0_25] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)[:1.8.0_25] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)[:1.8.0_25] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_25] at java.lang.Class.forName0(Native Method)[:1.8.0_25] at java.lang.Class.forName(Class.java:344)[:1.8.0_25] at org.apache.commons.pool2.impl.BaseGenericObjectPool.setEvictionPolicyClassName(BaseGenericObjectPool.java:598) ... 36 more So my imports list all the packages that are exported by the Apache Commons Pool library. Those packages also include the class that I'm getting the load error for. gr, Jurgen On 04/28/2015 01:35 PM, Achim Nierbeck wrote: Hi Jurgen, do you have the right imports for it configured on your bundles? So which bundle doesn't start? Take a look at the bundle:headers ID of this bundle and check if it actually imports the package you are looking for. If not, make sure the bundle does import it. regards, Achim 2015-04-28 13:31 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of HikariCP. Bone doesn't have this dependency. This appears to work. BoneCP does want to load. Unfortunately I also
Re: Using a Redis connection pool from Karaf
Oh and one, more I think there is a redis OSGi client available from the servicemix bundles. Might want to look at that too. Could be that you need to split your application a lot faster then you thought :D regards, Achim 2015-04-28 13:59 GMT+02:00 Achim Nierbeck bcanh...@googlemail.com: hi Jurgen, a quick googling for Redis + OSGi gave me this [1]. Looks like someone is using jedis to connect to his redis server via blueprint. Might want to take a look at this. regards, Achim [1] - https://github.com/sneakybeaky/jedis-osgi/blob/master/example-datasource/src/main/resources/OSGI-INF/blueprint/local-redis-datasource.xml 2015-04-28 13:56 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl: I have no idea how Redis uses this library, I haven't read the code. My code does this: new JedisPool(new JedisPoolConfig(), redis_driver[0], Integer.parseInt(redis_driver[1]), 1800, password); On 04/28/2015 01:41 PM, Guillaume Nodet wrote: Not sure what the exact usage of command-pool is, but given the stack trace, it could be that a class is loaded from its name (i suspect it comes from the configuration). In such a case, to make it work in OSGi, the correct class loader needs to be used, one can't rely on the thread context class loader, or even the current class' classloader, which may have no visibility to the package. It may require a fix in some code loading the class to behave properly in OSGi. 2015-04-28 13:31 GMT+02:00 Jurgen Voorneveld jurgen.voornev...@redsocks.nl mailto:jurgen.voornev...@redsocks.nl: I couldn't get the Apache Commons Pool libary to load under Karaf so I tried rewriting the app to use BoneCP instead of HikariCP. Bone doesn't have this dependency. This appears to work. BoneCP does want to load. Unfortunately I also have a Redis database which also has the dependency on Apache Commons Pool. So I'm back to the same error just one line down in my code. It doesn't look like there are any alternative connection pool libraries for Redis. I want to be able to connect to my Redis db using a connection pool, anyone know how to do that? On 04/23/2015 05:14 PM, Jurgen Voorneveld wrote: I got the maven install to work and installed a bunch of bundles: karaf@root() list START LEVEL 100 , List Threshold: 50 ID | State| Lvl | Version | Name - 102 | Resolved | 80 | 2.3.0 | Apache Commons Pool 107 | Resolved | 80 | 2.3.6 | HikariCP 110 | Resolved | 80 | 3.19.0.GA http://3.19.0.GA | Javassist 111 | Resolved | 80 | 5.1.35| Oracle Corporation's JDBC Driver for MySQL 113 | Resolved | 80 | 01.00.46 | Analyzer Unfortunately this doesn't actually solve the problem. I'm still getting the same error: Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool2.impl.DefaultEvictionPolicy despite it existing in the exports list: karaf@root() package:exports | grep commons org.apache.commons.pool2.impl | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2.proxy | 2.3.0 | 102 | org.apache.commons.pool2 org.apache.commons.pool2 | 2.3.0 | 102 | org.apache.commons.pool2 and being included in the Import-Package in the manifest. running out of ideas... Jurgen On 04/23/2015 12:51 PM, Morgan Hautman wrote: Sorry for the typo, it changed to package in Karaf 3. You should install one package that export this service too. Try this: install mvn:com.zaxxer/HikariCP/x.x.x (version you want to use) Regards Morgan On 23/04/2015 12:37, Jurgen Voorneveld wrote: Should have paid more attention. karaf@root() package:exports | grep HikariConfig Returns empty. Which I guess makes sense; there is no library in Karaf exporting these classes by default. But I don't see how that could make it fail. The class is available in the bundle itself. For completeness this is the imports in the manifest: Import-Package: org.osgi.framework, javax.naming Jurgen On 04/23/2015 12:30 PM, Jurgen Voorneveld wrote: Helo Morgan, I get this: karaf@root() packages:exports | grep HikariConfig pipe: org.apache.felix.gogo.runtime.CommandNotFoundException: Command not found: packages:exports I have no idea what this means. Jurgen On 04/23/2015 12:18 PM, Morgan
Re: Karaf 3.0.1 does not consider service ranking set by Blueprint
What I wanted to express is that users naively will expect that blueprint will select the service with the highest ranking. Of course when reading the spec they will probably guess that service damping might influence this. Do you know if we are free to change the current behaviour or if the spec mandates to stay with a service that was selected once? Christian On 28.04.2015 16:56, David Jencks wrote: It may not be what you expect, but thinking it is what no one expects seems a bit extreme to me. DS has the concept of greedy and reluctant references so you can specify which behavior you want. david jencks -- Christian Schneider http://www.liquid-reality.de Open Source Architect http://www.talend.com
Re: Karaf 3.0.1 does not consider service ranking set by Blueprint
I can read the following in the osgi spec, section 121.7.11 The backing service for a reference proxy must not be gotten from the OSGi service registry until an actual service object is needed, that is, when an actual method is called on the proxy. If the backing service becomes unregistered, then the proxy must unget the reference to the backing service (if it had gotten it) and get another service object the next time a method on the proxy is called. If a replacement can be found immediately, the reference listener’s bind method must be called without calling the unbind method. Other threads that need the same service object must block until the ser- vice object has become available or times out. I could not find anything more in the spec. Anyway, I just find some meeting notes from the OSGi EEG meeting about this exact situation. The outcome was that there would be no rebinding in case of a higher ranking service coming. I suspect is it is changed, the TCK will fail to pass. 2015-04-28 17:24 GMT+02:00 Christian Schneider ch...@die-schneider.net: What I wanted to express is that users naively will expect that blueprint will select the service with the highest ranking. Of course when reading the spec they will probably guess that service damping might influence this. Do you know if we are free to change the current behaviour or if the spec mandates to stay with a service that was selected once? Christian On 28.04.2015 16:56, David Jencks wrote: It may not be what you expect, but thinking it is what no one expects seems a bit extreme to me. DS has the concept of greedy and reluctant references so you can specify which behavior you want. david jencks -- Christian Schneider http://www.liquid-reality.de Open Source Architect http://www.talend.com
Re: local-broker.xml at startup
Hi, I will take a look this morning with a simple use case. I keep you posted. Regards JB On 04/28/2015 08:59 AM, sekaijin wrote: hello I, as much as possible, simplified my test. I unzipped karaf 2.4.1 and I added in system, the feature I tested with a datasource instead of the broker (less dependency) I have all placed in a zip to allow you to reproduce the error I added log4j.logger.org.apache.karaf.features = TRACE in org.ops4j.pax.logging.cfg file log file: line : 42 line : 466 test.zip http://karaf.922171.n3.nabble.com/file/n4040011/test.zip Cordialement JYT -- View this message in context: http://karaf.922171.n3.nabble.com/local-broker-xml-at-startup-tp4039960p4040011.html Sent from the Karaf - User mailing list archive at Nabble.com. -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com
Re: local-broker.xml at startup
Thank I suspect that you are very busy. A+JYT -- View this message in context: http://karaf.922171.n3.nabble.com/local-broker-xml-at-startup-tp4039960p4040051.html Sent from the Karaf - User mailing list archive at Nabble.com.
Re: local-broker.xml at startup
Can you try, in featuresBoot, to do: featuresBoot=(...)(hermes-resource) I don't remember if we added boot features grouping on Karaf 2.4. By the way, aries-blueprint doesn't exist on 2.4. As I said, I will take a look later today. Regards JB On 04/28/2015 08:59 AM, sekaijin wrote: hello I, as much as possible, simplified my test. I unzipped karaf 2.4.1 and I added in system, the feature I tested with a datasource instead of the broker (less dependency) I have all placed in a zip to allow you to reproduce the error I added log4j.logger.org.apache.karaf.features = TRACE in org.ops4j.pax.logging.cfg file log file: line : 42 line : 466 test.zip http://karaf.922171.n3.nabble.com/file/n4040011/test.zip Cordialement JYT -- View this message in context: http://karaf.922171.n3.nabble.com/local-broker-xml-at-startup-tp4039960p4040011.html Sent from the Karaf - User mailing list archive at Nabble.com. -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com
Re: local-broker.xml at startup
hello I, as much as possible, simplified my test. I unzipped karaf 2.4.1 and I added in system, the feature I tested with a datasource instead of the broker (less dependency) I have all placed in a zip to allow you to reproduce the error I added log4j.logger.org.apache.karaf.features = TRACE in org.ops4j.pax.logging.cfg file log file: line : 42 line : 466 test.zip http://karaf.922171.n3.nabble.com/file/n4040011/test.zip Cordialement JYT -- View this message in context: http://karaf.922171.n3.nabble.com/local-broker-xml-at-startup-tp4039960p4040011.html Sent from the Karaf - User mailing list archive at Nabble.com.
Re: Karaf 3.0.1 does not consider service ranking set by Blueprint
It may not be what you expect, but thinking it is what no one expects seems a bit extreme to me. DS has the concept of greedy and reluctant references so you can specify which behavior you want. david jencks On Apr 28, 2015, at 10:26 AM, Christian Schneider ch...@die-schneider.net wrote: Blueprint will stay with the service it selected until this service goes away. So for example if you would stop A1 and start it again then blueprint would switch. This is obviously not what people expect when the ranking is used. So I would consider this to be either a bug or a good enhancement request. Can you open an issue at aries if there is none already? I can work on it. Christian On 28.04.2015 16:13, jkraushaar wrote: Seems to be an issue of the Aries Blueprint implementation. To me it seems that the reference to the service (A1 or A2) is set when the component (X) is created. It only takes those services into account which exist at that moment. If later on another service with a higher ranking is added, the reference is not updated. As a workaround I've created a class which is a service reference listener. When a service is added, the service, ranking and ID is wrapped in an object and put into a TreeMap. The wrapper object implements compare to ensure the correct ordering of the services. With this workaround it is possible to add and remove new services with different rankings at runtime. Regards Jochen -- View this message in context: http://karaf.922171.n3.nabble.com/Karaf-3-0-1-does-not-consider-service-ranking-set-by-Blueprint-tp4039991p4040038.html Sent from the Karaf - User mailing list archive at Nabble.com. -- Christian Schneider http://www.liquid-reality.de Open Source Architect http://www.talend.com
Re: Karaf 3.0.1 does not consider service ranking set by Blueprint
Hi Christian, I opened an issue, thanks for your help: https://issues.apache.org/jira/browse/ARIES-1314 Regards Jochen -- View this message in context: http://karaf.922171.n3.nabble.com/Karaf-3-0-1-does-not-consider-service-ranking-set-by-Blueprint-tp4039991p4040043.html Sent from the Karaf - User mailing list archive at Nabble.com.