Another way to create an Uber Jar, is to use maven, and the shade
plugin. This pulls in everything from the repositories it needs, and
packages everything as an uber jar.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
</configuration>
</execution>
</executions>
</plugin>
Not sure if you use have used maven, though. I see that you are using
Ant currently.
On 04/23/2015 07:10 AM, Achim Nierbeck wrote:
Looks like this class is actually not available in your jar ....
regards, Achim
2015-04-23 13:42 GMT+02:00 Jurgen Voorneveld
<jurgen.voornev...@redsocks.nl <mailto:jurgen.voornev...@redsocks.nl>>:
Hey Scott,
Thanks but I'd like to stick with my uber-bundle if at all possible.
I'll consider this if I can't get it to work.
Also note that right now the latest bug is no longer in HikariCP
but in
apache commons pool:
com.zaxxer.hikari.pool.PoolInitializationException: Exception during
pool initialization
<snip>
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.pool2.impl.DefaultEvictionPolicy
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at
org.apache.commons.pool2.impl.BaseGenericObjectPool.setEvictionPolicyClassName(BaseGenericObjectPool.java:598)
Jurgen
On 04/23/2015 01:30 PM, Scott Carr wrote:
> 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