Hi, I could solve the problem by modifying the OSGi wrapper project for Jena. When the javax.management package is added as a dependency, then everything works well. Thanks for your help.
Nico -----Ursprüngliche Nachricht----- Von: Andy Seaborne [mailto:[email protected]] Im Auftrag von Andy Seaborne Gesendet: Samstag, 18. Februar 2012 12:58 An: [email protected] Betreff: Re: AW: Using Jena in OSGi - NoClassDefFoundException on javax/management/MalformedObjectNameException On 18/02/12 10:23, Nico Schertler wrote: > Hi Rob, > > thanks for your reply. I used all JARs from here: > http://www.apache.org/dist/incubator/jena/apache-jena-2.7.0-incubating.zip. > This includes the ARQ 2.9 library. > I use JavaSE-1.6 as the execution runtime. You're right. When I create a > standard java project with this JRE, I can use the Exception. So it is really > a problem of the Felix Class Loader. Has anyone done this before or knows how > I can force the class loader to load the exception class? > > Nico ARQ.java:437 => is a call to ARQMgt which kicks the JMX setup. I do know that ARQ has run inside Felix+BndTools as OSGi. MalformedObjectNameException is mentioned in ARQMgt as caught class - the whole init code is inside try/catch (Throwable ex) so if that is an exception being thrown, and not a stacktrace printed by the logger, then your environment then the class wasn't available. I'm not an OSGi expert but it looks like, in the new environment, the right classes aren't available. Is that the end of the stacktrace? Is there a log message? Andy > > -----Ursprüngliche Nachricht----- > Von: Rob Vesse [mailto:[email protected]] > Gesendet: Freitag, 17. Februar 2012 18:35 > An: [email protected] > Betreff: Re: Using Jena in OSGi - NoClassDefFoundException on > javax/management/MalformedObjectNameException > > Hi Nico > > You say you upgraded Jena but don't say whether you upgraded ARQ, if > you upgraded to Jena 2.7.0 you would also need to upgrade to ARQ 2.9.0 > as ARQ depends on Jena > > If it is the case that you did upgrade both and you're still seeing this > error then it looks more like a Java classpath/runtime problem. The missing > class is part of JMX and JMX should typically be in your JRE but that may > depend on the exact version of Java you are running? > > Rob > > On 2/17/12 9:24 AM, Nico Schertler wrote: >> Hi, >> >> am about to convert an existing OSGi project that uses Jena 2.6.4 to >> another framework (from Eclipse Equinox to Apache Felix in >> combination with BndTools). The old project on Equinox worked very >> well, however, I have some trouble with the new framework. In order >> to include the Jena libraries into my project, I created a new >> "Plugin from existing JAR Archives". I exported that to a deployable >> Plugin and put that into my local repository. From there I could add >> it to my project's build path. It seemed to work well. It could be >> compiled, but when I started the project, on the first access to Jena >> (createResource) a NoClassDefFoundException on >> org.xml.sax.SAXException. To solve this problem, I decided to upgrade >> the Jena libraries to 2.7 (from a here). So I did the exact same >> steps as above. The project, again, could compile and ran a little >> further. Now, the createResource-call did not crash and worked very >> well. However, the project crashed while performing a SPARQL-Query. H ere's an excerpt of the stack trace: >> java.lang.NoClassDefFoundError: javax/management/MalformedObjectNameException >> at com.hp.hpl.jena.query.ARQ.init(ARQ.java:437) >> at com.hp.hpl.jena.query.ARQ.<clinit>(ARQ.java:456) >> at com.hp.hpl.jena.query.Query.<clinit>(Query.java:62) >> at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:80) >> at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:52) >> at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:40) >> at >> com.hp.hpl.jena.query.QueryExecutionFactory.makeQuery(QueryExecutionFactory.java:517) >> at >> com.hp.hpl.jena.query.QueryExecutionFactory.create(QueryExecutionFact >> o >> ry.java:193) >> >> And, indeed, I was not able to find the definition of this exception in the >> Jena libraries. Have I missed anything? Or any other ideas, how to solve >> this? >> >> Nico >> > > > >
