The import of the c3p0 package is problematic because c3p0 is not an OSGi 
bundle. However there is a bundle wrapping availabe: 
http://jpm4j.org/#!/p/sha/376EA3C3654A3E0593D1C135A7109ECE77D0BE70//0.0.0

Incidentally, c3p0 apparently hasn’t been updated or maintained for over 8 
years, so it’s a bit dubious to be using something like that in a production 
application.

Neil



> On 12 Oct 2015, at 22:07, Paulo Renato de Athaydes 
> <renatoathay...@hotmail.com> wrote:
> 
> 
> 
> 
> 
> The quartz bundle has the following imports:
> Import-Package: com.mchange.v2.c3p0,commonj.work;resolution:=optional, 
> javax.ejb;resolution:=optional,javax.jms;resolution:=optional,javax.m 
> ail;resolution:=optional,javax.mail.internet;resolution:=optional,jav 
> ax.management,javax.management.openmbean,javax.naming,javax.servlet;r 
> esolution:=optional,javax.servlet.http;resolution:=optional,javax.sql 
> ;resolution:=optional,javax.transaction;resolution:=optional,javax.xm 
> l.bind,javax.xml.namespace,javax.xml.parsers,javax.xml.xpath,oracle.s 
> ql;resolution:=optional,org.jboss.logging;resolution:=optional,org.jb 
> oss.naming;resolution:=optional,org.jboss.system;resolution:=optional 
> ,org.quartz,org.quartz.core,org.quartz.impl.matchers,org.quartz.impl. 
> triggers,org.quartz.jobs;resolution:=optional,org.quartz.spi,org.slf4 
> j;version="[1.6,2)",org.terracotta.toolkit;resolution:=optional,org.t 
> erracotta.toolkit.atomic;resolution:=optional,org.terracotta.toolkit. 
> builder;resolution:=optional,org.terracotta.toolkit.cluster;resolutio 
> n:=optional,org.terracotta.toolkit.collections;resolution:=optional,o 
> rg.terracotta.toolkit.concurrent.locks;resolution:=optional,org.terra 
> cotta.toolkit.config;resolution:=optional,org.terracotta.toolkit.inte 
> rnal;resolution:=optional,org.terracotta.toolkit.internal.concurrent. 
> locks;resolution:=optional,org.terracotta.toolkit.rejoin;resolution:= 
> optional,org.terracotta.toolkit.search;resolution:=optional,org.terra 
> cotta.toolkit.search.attribute;resolution:=optional,org.terracotta.to 
> olkit.store;resolution:=optional,org.w3c.dom,org.xml.sax,weblogic.jdb 
> c.jts;resolution:=optional,weblogic.jdbc.vendor.oracle;resolution:=op tional
> 
> The required dependencies (not optional) are the following:
> com.mchange.v2.c3p0
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> javax.managementjavax.management.openmbean
> javax.naming
> javax.xml.bind
> javax.xml.namespace
> javax.xml.parsers
> javax.xml.xpath
> org.quartz
> org.quartz.core
> org.quartz.impl.matchers
> org.quartz.impl. triggers
> org.quartz.spi
> org.slf4 j;version="[1.6,2)"
> org.w3c.dom
> org.xml.sax
> 
> 
> The first one, c3p0, comes from this artifact:
> "c3p0:c3p0:0.9.1.1"
> 
> Which is not a OSGi bundle. (the others, except quartz which comes from the 
> jar itself, don't seem to be a problem as the framework seems happy to 
> provide those).
> 
> 
> I wrapped it in a bundle anyway using osgi-run and then, after installing 
> them in Felix, I found out we need some logging libraries, org.sfl4j.api, 
> org.apache.log4j, osg.slf4j.impl (ouch!)
> 
> 
> A little bit painful to get this working.
> 
> 
> After a little guesswork, I found these 2 bundles meet the logging demands:
> 
> 
> osgiRuntime 'org.slf4j:slf4j-simple:1.7.5'
> osgiRuntime "org.slf4j:log4j-over-slf4j:1.7.5"
> 
> 
> But Felix threw horrible errors when I did this:
> 
> 
> ERROR: Bundle slf4j.api [8] Error starting 
> file:/Users/renato/programming/projects/osgi-run/osgi-run-test/quartz-sample/build/osgi/bundle/slf4j-api-1.6.6.jar
>  (java.lang.ArrayIndexOutOfBoundsException: -1)
> java.lang.ArrayIndexOutOfBoundsException: -1
>        at java.util.ArrayList.elementData(ArrayList.java:418)
>        at java.util.ArrayList.remove(ArrayList.java:495)
>        at 
> org.apache.felix.framework.resolver.Candidates.prepare(Candidates.java:763)
>        at 
> org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:122)
>        at 
> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:405)
>        at 
> org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3973)
>        at org.apache.felix.framework.Felix.startBundle(Felix.java:2043)
>        at 
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1297)
>        at 
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
>        at java.lang.Thread.run(Thread.java:745)
> ERROR: Bundle slf4j.api [9] Error starting 
> file:/Users/renato/programming/projects/osgi-run/osgi-run-test/quartz-sample/build/osgi/bundle/slf4j-api-1.7.5.jar
>  (java.lang.ArrayIndexOutOfBoundsException: -1)
> java.lang.ArrayIndexOutOfBoundsException: -1
>        at java.util.ArrayList.elementData(ArrayList.java:418)
>        at java.util.ArrayList.remove(ArrayList.java:495)
>        at 
> org.apache.felix.framework.resolver.Candidates.prepare(Candidates.java:763)
>        at 
> org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:122)
>        at 
> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:405)
>        at 
> org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3973)
>        at org.apache.felix.framework.Felix.startBundle(Felix.java:2043)
>        at 
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1297)
>        at 
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
>        at java.lang.Thread.run(Thread.java:745)
> ____________________________
> Welcome to Apache Felix Gogo
> 
> 
> 
> Looks like a bug to me (probably fixed now, this is an older Felix version)...
> 
> But I seem to have put two versions of slf4j in the classpath inadvertently.. 
> anyway, why wouldn't it work? I don't know...
> So, after some more research, I found that in the docs of c3p0, they say this:
> 
> 
> Just put the files lib/c3p0-0.9.5.1.jar and 
> lib/mchange-commons-java-0.2.10.jar in your application's effective CLASSPATH
> 
> So I put this mchange-commons-java jar wrapped into an OSGi bundle in the 
> framework.... still, didn't work.
> 
> 
> With Equinox I get this now:
> 
> 
> Framework is launched.
> 
> 
> id      State       Bundle
> 0       ACTIVE      org.eclipse.osgi_3.7.1.R37x_v20110808-1106
> 1       ACTIVE      c3p0_0.9.1.1
> 2       ACTIVE      log4j.over.slf4j_1.7.5
> 3       INSTALLED   mchange-commons-java_0.2.10
> 4       ACTIVE      slf4j.api_1.7.5
>                    Fragments=5
> 5       RESOLVED    slf4j.simple_1.7.5
>                    Master=4
> 
> 
> 
> But still didn't work. Didn't even tell me what's wrong.
> 
> 
> In Felix, at least I got this error:
> 
> 
> org.osgi.framework.BundleException: Unresolved constraint in bundle 
> mchange-commons-java [3]: Unable to resolve 3.0: missing requirement [3.0] 
> osgi.wiring.package; (osgi.wiring.package=com.typesafe.config)
> 
> So, apparently, we also need some TypeSafe stuff in the classpath :(
> 
> 
> With this, I just give up.
> 
> 
> I recommend you have a look at Atmandu Scheduler instead... It's made for 
> OSGi and apparently uses Quartz:
> 
> 
> http://www.amdatu.org/components/scheduling.html
> 
> 
> Good luck!
> 
> 
> And.... I can totally understand how you might feel frustrated about this... 
> I thought I would manage to get this working in a few minutes... took me 
> hours trying, and nothing :(
> 
> 
> What can we do?!
> 
> 
> Regards,
> 
> 
> Renato
> 
> 
> 
> 
> 
>> Subject: Re: Help in using your Quartz OSGi bundle
>> To: users@felix.apache.org
>> From: j...@nanthrax.net
>> Date: Mon, 12 Oct 2015 14:32:04 +0200
>> 
>> Hi Pedro,
>> 
>> such dependencies should be optional. Let me check the SMX quartz bundle 
>> around this.
>> 
>> Regards
>> JB
>> 
>> On 10/11/2015 01:20 PM, Pedro Domingues wrote:
>>> Greetings,
>>> 
>>> Sorry for bothering you, but I would like to ask for your help with your
>>> Quartz bundle.
>>> 
>>> I am trying to install your Quartz OSGi bundle into my project:
>>> 
>>> http://i.imgur.com/PKHnWIj.png
>>> 
>>> However when I insert the bundle in my *Apache Felix* I keep getting the
>>> unresolved dependencies error message like you can see here:
>>> 
>>>> java -jar bin/felix.jar
>>> ERROR: Bundle hydra.launcher [1] Error starting
>>> file:/C:/code/hydra/felix/bundle/hydra.launcher-1.0.0-SNAPSHOT.jar
>>> (org.osgi.fram
>>> ework.BundleException: Unable to resolve
>>> org.apache.servicemix.bundles.quartz [8](R 8.0): missing requirement
>>> [org.apache.servicemix.bundles.quartz [8
>>> ](R 8.0)] osgi.wiring.package; (osgi.wiring.package=org.jboss.logging)
>>> Unresolved requirements: [[org.apache.servicemix.bundles.quartz [8](R
>>> 8.0)] osg
>>> i.wiring.package; (osgi.wiring.package=org.jboss.logging)])
>>> org.osgi.framework.BundleException:*Unable to resolve
>>> org.apache.servicemix.bundles.quartz [8](R 8.0): missing requirement*
>>> [org.apache.servicemix.bund
>>> les.quartz [8](R 8.0)] osgi.wiring.package;
>>> (osgi.wiring.package=org.jboss.logging) Unresolved requirements:
>>> [[*org.apache.servicemix.bundles.quartz* [8
>>> ](R 8.0)] osgi.wiring.package; (*osgi.wiring.package=org.jboss.logging*)]
>>>         at
>>> org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4090)
>>>         at org.apache.felix.framework.Felix.startBundle(Felix.java:2111)
>>>         at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:977)
>>>         at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:964)
>>>         at hydra.launcher.Launcher.installStart(Launcher.java:78)
>>> 
>>> If I try to discard this dependency manually in your bundle's manifest I
>>> keep getting other dependencies such as oracle.sql and so on... It is a
>>> true dependency hell.
>>> 
>>> However I do not need to use SQL nor JBOSS, I just want to use Quartz.
>>> Is there any way I can solve this? Do I really need to include the
>>> thousand transitive dependencies manually, which I will probably never
>>> use but since these manifests are automatically generated they include
>>> them anyways?
>>> 
>>> This is the one thing that makes OSGi hard to use...
>>> 
>>> Thanks!
>> 
>> -- 
>> Jean-Baptiste Onofré
>> jbono...@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
>> For additional commands, e-mail: users-h...@felix.apache.org
>> 
>                                         


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to