0

I'm still struggling quite a lot with packaging a library I need in my project as OSGi bundle. I've asked already about it here. The answer there is good enough for sure, but again, I have another problem I don't understand and can't break it down :(

I have the library finally packaged as OSGi bundle, I have identified all need dependencies and all that is now together in one complete jar archive.

Now if I try some function which uses the library, an exception is raised because this:

Caused by: java.lang.ClassFormatError: javax/ws/rs/core/UriBuilder
    at com.atlassian.jira.rest.client.internal.jersey.JerseyJiraRestClient.<init>(JerseyJiraRestClient.java:61)
    at com.atlassian.jira.rest.client.internal.jersey.JerseyJiraRestClientFactory.create(JerseyJiraRestClientFactory.java:34)
    at com.atlassian.jira.rest.client.internal.jersey.JerseyJiraRestClientFactory.createWithBasicHttpAuthentication(JerseyJiraRestClientFactory.java:39)
    at com.tieto.etb.esb.libs.jiraclient.JiraClient.getClient(JiraClient.java:28)[145:jiraclient.bundle:0.1.0.SNAPSHOT]
    at com.tieto.etb.esb.jira.JiraBean.projectInfo(JiraBean.java:38)[142:jira.bundle:0.1.0.SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_35]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_35]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_35]
    at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_35]
    at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:341)[70:org.apache.camel.camel-core:2.10.1]
    at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:238)[70:org.apache.camel.camel-core:2.10.1]
    at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166)[70:org.apache.camel.camel-core:2.10.1]
    ... 52 more

I'd like to ask you for a hint, what could be the problem there. I guess it is something wrong during building the bundle.

For example, I have another pom for this bundle, there I have as all from compile scope. This bundle is working...

I'll compare the MANIFEST files for both cases, there is maybe still some missing dependencies.

Community
  • 1
  • 1
stibi
  • 1,013
  • 13
  • 24
  • I would consider the uber jar approach as a last resort. I think that is a mistake right from the start. – Robin Oct 30 '12 at 16:29
  • So the better approach is to create truly OSGi package from the library? What means, also OSGify also all its dependencies, which are not not OSGi ready, right? – stibi Nov 01 '12 at 07:01

1 Answers1

0

Ok, solved somehow. I should google the problem more deeply before going for help here :) So, in the pom file, I've changed the scope of dependency to javaee-api to "provided". (hint)

Then there were a few complains about "unresolved dependences", but those got marked with ";resolution:="optional" :P

So far it works. But I guess this is quite far from "clean and nice" solution.

stibi
  • 1,013
  • 13
  • 24