See my comments inline:

2015-04-23 14:08 GMT+02:00 Jurgen Voorneveld <jurgen.voornev...@redsocks.nl>
:

> Hey Achim,
>
> inline.
>
> On 04/23/2015 01:35 PM, Achim Nierbeck wrote:
> > anyway Jurgen, did you check your JAR if all of the required Classes are
> > actually embedded?
>
> Every time I look into the jar the class that can't be loaded is
> actually there. Also, this uber jar runs perfectly fine from the command
> line:
>
> java -jar analyzer.jar
>
> this starts it up without errors and runs the code.
>


commandline doesn't mean it's running inside an OSGi container.


>
> > regarding ANT, If I where you I'd switch to Maven real fast, and let the
> > maven-bundle-plugin do the Manifest generation
> > together with embedding all "compile"-scoped dependencies. :D
>
> That seems like a lot of time to completely reconfigure how things are
> built and deployed and packaged in the hope that it might make the
> problem go away magically. I'd rather just figure out what is wrong.
>

hmm, not if you have the right setup. Actually a nice maven pom or gradle
build is clean
and reproducable.


>
> > If you got that working, then I'd start with extracting the libraries
> > ... starting with using libs that are already OSGi aware, like the one
> > of Scott.
>
> This will make it harder to get things running. The more libraries there
> are in karaf and not in the bundle the more management I will have to do
> in karaf. I prefer an uber bundle that can run in a clean version of
> karaf. This way I will also not have to worry that there are dependency
> mismatches between development and production.
>
>
erf. if you don't want to do a modularized application, why use karaf or
OSGi at all?
If you just want to have an executable Jar that contains everything with
it. You don't need this
Boilerplate code.

But if you want to work with a modular application, then you'll get the
benefits of karaf and OSGi
instantly. Only update one of your bundles if needed, the rest will stay
the same.

For easier deployment you'll have feature descriptors (an xml) so the
"easier to deploy" doesn't count.





> > regards, Achim
> >
> > 2015-04-23 13:30 GMT+02:00 Scott Carr <kscar...@gmail.com
> > <mailto:kscar...@gmail.com>>:
> >
> >     I have a HikariCP implementation at:
> >
> >     https://github.com/kscarr73/OsgiDb
> >
> >     This is done in several fragment and individiual bundles.  The
> >     OsgiDatabase bundle reads a datasources.cfg file, and creates an
> >     individual service for each Hikari Datasource.
> >
> >
> >     On 04/23/2015 06:23 AM, Jurgen Voorneveld wrote:
> >
> >         Hey Achim,
> >
> >         yeah I got the idea that there might be more wrong. My
> >         uber-bundle has
> >         this manifest file:
> >
> >         Manifest-Version: 1.0
> >         Ant-Version: Apache Ant 1.9.2
> >         Created-By: 1.8.0_40-b25 (Oracle Corporation)
> >         Main-Class: nl.redsocks.farm.analyzer.core.Analyzer
> >         Bundle-ManifestVersion: 2
> >         Bundle-Name: Analyzer
> >         Bundle-SymbolicName: nl.redsocks.farm.analyzer
> >         Bundle-Activator: nl.redsocks.farm.analyzer.core.Analyzer
> >         Bundle-Version: 01.00.32
> >         Import-Package: org.osgi.framework, javax.naming, org.slf4j,
> >         javax.sql
> >           , javax.management
> >
> >         The bundle is created using ant by unpacking all jar
> >         dependencies and
> >         packaging all the classes together. Pretty simple.
> >
> >         regards,
> >         Jurgen
> >
> >         On 04/23/2015 01:16 PM, Achim Nierbeck wrote:
> >
> >             Hi Jurgen,
> >
> >             to me it looks a lot like you're having a couple of
> >             different issues.
> >             So first let's try to break those down to one issue only ;)
> >
> >             At first since you seem to have the lib in question already
> >             inside your
> >             uber-bundle let's stick to that.
> >             Later we'll see what's broken with your local maven repo.
> >
> >             Could you give us an overview of the manifest of your
> >             Analyzer bundle?
> >
> >             so we can start from there on.
> >
> >             regards, Achim
> >
> >
> >
> >             2015-04-23 13:01 GMT+02:00 Jurgen Voorneveld
> >             <jurgen.voornev...@redsocks.nl
> >             <mailto:jurgen.voornev...@redsocks.nl>
> >             <mailto:jurgen.voornev...@redsocks.nl
> >             <mailto:jurgen.voornev...@redsocks.nl>>>:
> >
> >                  output:
> >
> >                  karaf@root()> install mvn:com.zaxxer/HikariCP/2.3.6
> >                  Bundle IDs:
> >                  Error executing command: Error installing bundles:
> >                          Unable to install bundle
> >             mvn:com.zaxxer/HikariCP/2.3.6
> >
> >                  karaf@root()> log:display
> >                  <snip>
> >                  Caused by: java.io.IOException: Error resolving artifact
> >                  com.zaxxer:HikariCP:jar:2.3.6: Could not transfer
> artifact
> >                  com.zaxxer:HikariCP:jar:2.3.6 from/to central
> >                  (http://repo1.maven.org/maven2/):
> >
> >
> /home/karaf/.m2/repository/com/zaxxer/HikariCP/2.3.6/HikariCP-2.3.6.jar.part.lock
> >                  (No such file or directory)
> >
> >                  Version 2.3.6 exists in maven:
> >                  http://mvnrepository.com/artifact/com.zaxxer/HikariCP
> >
> >                  weird..
> >                  for older version:
> >
> >                  karaf@root()> install mvn:com.zaxxer/HikariCP/2.3.5
> >                  Bundle IDs:
> >                  Error executing command: Error installing bundles:
> >                          Unable to install bundle
> >             mvn:com.zaxxer/HikariCP/2.3.5
> >                  karaf@root()> log:display
> >                  <snip>
> >                  Caused by: java.lang.Exception: Unable to install bundle
> >                  mvn:com.zaxxer/HikariCP/2.3.5
> >                          at
> >
> >
> org.apache.karaf.bundle.command.Install.doExecute(Install.java:45)
> >                          ... 18 more
> >                  Caused by: org.osgi.framework.BundleException: Unable
> >             to cache bundle:
> >                  mvn:com.zaxxer/HikariCP/2.3.5
> >                          at
> >
> >
> org.apache.felix.framework.Felix.installBundle(Felix.java:2870)
> >                          at
> >
> >
> org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
> >                          at
> >
> >
> org.apache.karaf.bundle.command.Install.doExecute(Install.java:43)
> >                          ... 18 more
> >                  Caused by: java.io.IOException: Error resolving artifact
> >                  com.zaxxer:HikariCP:jar:2.3.5: Could not transfer
> artifact
> >                  com.zaxxer:HikariCP:jar:2.3.5 from/to central
> >                  (http://repo1.maven.org/maven2/):
> >
> >
> /home/karaf/.m2/repository/com/zaxxer/HikariCP/2.3.5/HikariCP-2.3.5.jar.part.lock
> >                  (No such file or directory)
> >                          at
> >
> >
> org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:487)
> >                          at
> >
> >
> org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:433)
> >                          at
> >
> >
> org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:411)
> >                          at
> >
> >
> org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:386)
> >                          at
> >
> >
> org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:124)
> >                          at
> >
> >
> org.apache.felix.framework.util.SecureAction.getURLConnectionInputStream(SecureAction.java:524)
> >                          at
> >
> >
> org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:165)
> >                          at
> >
> >
> org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:77)
> >                          at
> >
> >
> org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:878)
> >                          at
> >
> >
> org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
> >                          at
> >
> >
> org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
> >                          at
> >
> >
> org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
> >                          at
> >
> >
> org.apache.felix.framework.Felix.installBundle(Felix.java:2866)
> >                          ... 20 more
> >
> >
> >
> >                  On 04/23/2015 12:51 PM, Morgan Hautman wrote:
> >                  > install mvn:com.zaxxer/HikariCP/x.x.x
> >
> >
> >
> >
> >             --
> >
> >             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
> >
> >
> >
> >
> >
> > --
> >
> > 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
> >
>



-- 

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