0

I have a bundle up and running in Servicemix. I went to my company's repository and downloaded the corresponding JAR to my local machine. I extracted that JAR and found out that this JAR had only one folder META-INF. Inside this folder, there is a Manifest.mf file and my resources such as Spring configuration file and Camel Context file. there I got my first question: where are the source files of this JAR i.e. JAVA classes and all. Only thing I saw there was manifest file, pom.xml, another pom properties file and couple of other configuration files for spring and camel.

this led to my next step. I had a local copy of this project in my workspace as well. I build this project locally and found the JAR in target directory of the project.

Now following steps might seem silly but anyway I did little experiment. I extracted this JAR which I found in target and extracted it to see the content. I believed it was a bundle because I used maven-bundle-plugin and there is no way you could tell by looking at a JAR that its just a JAR or an OSGI bundle. ok so I extracted the JAR and guess what this time it did have the compiled java classes.

this is not the end, I did something silly again. I removed the compiled classes from this JAR and made it exactly same as which I copied from my Company's central repository. Now I used a JDK's JAR creation utility to create a JAR.

Now I have two JARS: one which I downloaded from company's central repo. another one which I created myself. it has exactly same content as the other one. I even used the same manifest.mf while creating this JAR. (Since I knew Manifest is the backbone of an oSGI Bundle).

I secure copied this bundle in my server's home directory. and finally, I installed this Bundle/JAR in Servicemix using : install file:path_to_JAR/JAR_FILE_NAME.

it got installed successfully. but when I tried to start this bundle. it could not start. by using display-exception, I saw the exception : it wasnt able to load the beans and could not initialize the Application Context followed by a more specific exception "ClassNotFound" exception. I understand that it wasnt able to find the classes defined in my application context. BUT WHYYYYYYYYYY?

I did exactly same steps and I checked it multiple times. if mine could not start, why the earlier one is up and running.

It might sound silly for others who have worked in OSGI environment, But now I am starting to re consider especially ServiceMix.

Thanks for any suggestion.

рüффп
  • 5,172
  • 34
  • 67
  • 113
Ashish
  • 1,121
  • 2
  • 15
  • 25

1 Answers1

0

This is nothing about OSGi, it's more something about your application. As I don't know your project I just can do some assumptions. First the jar you got from the Company Repository is most likely an "older" version and not the same as your local sources. With Servicemix it's quite possible to just have blueprint or spring xmls in your bundle cause those are valid resources a Camel-Blueprint/Spring extender are able to pick up. Those XMLs are interpreted and if those only make use of standard Camel Components there is no reason to have a single Class inside your bundle. Now back to your newly created Bundle, obviously you have some new "Code" in your camel-xml which requires not only standard Camel classes but also some Processes you created on your own, now those classes need to stay in the Bundle! Best just deploy the newly created Bundle with all it's classes. You should rather check what has changed in the camel xml files.

Achim Nierbeck
  • 5,265
  • 2
  • 14
  • 22
  • I checked the camel xml file, even the classes. there has not been a single change except I change the version to be a SNAPSHOT thats it. I went to servicemix and uninstalled the existing one (which was up and running) and then installed this new one. there is no change in pom.xml which signifies that I dont need to install any additional features or constraint in servicemix. – Ashish Jun 25 '13 at 12:09
  • are you sure that the old version is the "same". – Achim Nierbeck Jun 25 '13 at 19:21