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 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
> Proxy5f648166_9983_4f8f_acb1_23f0c1d1ea3b.execute(Unknown
> >     >>>>>> Source)[:]
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[25:org.apache.karaf.shell.console:3.0.3]
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)[25:org.apache.karaf.shell.console:3.0.3]
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)[25:org.apache.karaf.shell.console:3.0.3]
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[25:org.apache.karaf.shell.console:3.0.3]
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[25:org.apache.karaf.shell.console:3.0.3]
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[25:org.apache.karaf.shell.console:3.0.3]
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:92)
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.karaf.shell.console.impl.jline.ConsoleImpl.run(ConsoleImpl.java:208)
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$1.runConsole(ShellFactoryImpl.java:158)[52:org.apache.karaf.shell.ssh:3.0.3]
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$1$1.run(ShellFactoryImpl.java:133)
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at java.security.AccessController.doPrivileged(Native
> >     >>>>>> Method)[:1.8.0_25]
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.karaf.jaas.modules.JaasHelper.doAs(JaasHelper.java:57)[26:org.apache.karaf.jaas.modules:3.0.3]
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$1.run(ShellFactoryImpl.java:129)[52:org.apache.karaf.shell.ssh:3.0.3]
> >     >>>>>>
> >     >>>>>>
> >     >>>>>> Caused by: java.lang.Exception: Unable to execute command on
> >     bundle
> >     >>>>>> 87:
> >     >>>>>> Activator start error in bundle nl.redsocks.farm.analyzer
> [87].
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.karaf.bundle.command.BundlesCommandWithConfirmation.doExecute(BundlesCommandWithConfirmation.java:55)
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      ... 20 more
> >     >>>>>> Caused by: org.osgi.framework.BundleException: Activator start
> >     >>>>>> error in
> >     >>>>>> bundle nl.redsocks.farm.analyzer [87].
> >     >>>>>>      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: Could not
> >     initialize class
> >     >>>>>> com.zaxxer.hikari.HikariConfig
> >     >>>>>>      at
> >     nl.redsocks.farm.common.services.MySQL.init(MySQL.java:29)
> >     >>>>>>      at
> >     >>>>>>
> nl.redsocks.farm.analyzer.core.Analyzer.start(Analyzer.java:250)
> >     >>>>>>      at
> >     >>>>>>
> >
>  
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
> >     >>>>>>
> >     >>>>>>
> >     >>>>>>      at
> >     >>>>>>
> org.apache.felix.framework.Felix.activateBundle(Felix.java:2146)
> >     >>>>>>      ... 25 more
> >     >>>>>>
> >     >>>>>> karaf@root()>
> >     >>>>>>
> >     >>>>>> sorry for the wrapping. It looks like the problem is with
> >     HikariCP;
> >     >>>>>> "Caused by: java.lang.NoClassDefFoundError: Could not
> >     initialize class
> >     >>>>>> com.zaxxer.hikari.HikariConfig"
> >     >>>>>>
> >     >>>>>> I checked the jar and this class is in there. And the code
> also
> >     >>>>>> functions without problems when run standalone.
> >     >>>>>>
> >     >>>>>> Right now I'm creating bundles by creating one massive jar
> >     with all
> >     >>>>>> dependencies packaged together. Perhaps I should try
> installing
> >     >>>>>> HikariCP
> >     >>>>>> as a library inside its own bundle?
> >     >>>>>>
> >     >>>>>> How can I solve the problem?
> >     >>>>>>
> >     >>>>>> thanks
> >     >>>>>> Jurgen
> >     >>>>>>
> >     >>>>>> versions:
> >     >>>>>>
> >     >>>>>> $ java -version
> >     >>>>>> java version "1.8.0_25"
> >     >>>>>> Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
> >     >>>>>> Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed
> mode)
> >     >>>>>>
> >     >>>>>> $ uname -a
> >     >>>>>> Linux farm 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12
> >     11:16:15 UTC
> >     >>>>>> 2015
> >     >>>>>> x86_64 x86_64 x86_64 GNU/Linux
> >     >>>>>>
> >     >>>>>> $ awk 'NR>=17&&NR<=20{print}NR>=21{exit}' RELEASE-NOTES
> >     >>>>>>
> >     >>>>>>                       Apache Karaf 3.0.3
> >     >>>>>>                       ==================
> >     >>>>>>
> >     >>>>>>
> >
> >
>



-- 

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

Reply via email to