Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Setting up OSGi In Action source code in eclipse

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the book OSGi In Action and I am trying to import the example code (source code from OSGi In Action book) into an eclipse workspace.  The version of eclipse that I am using is 2019-03.  

I was able to figure out how to build the chapter 1 greeting-example lifecycle.  Then I right click on the class that contains the main method and choose "run as java application".  When the application runs, I see this error in my console:



How can I find the "bundle/provider-2.0.jar"?  I don't see it in the source code for the book?

Please do not tell me to use some other framework.  I have a new job and OSGi karaf is what I must understand and use.  If you can help me to discover a learning path where I can become comfortable with this framework I would be much appreciative.  I have purchased every book on the topic but much of what they say seems to be out of date.  

To start out with I would like to understand what this error means and how to fix it.  Here is the amazon.com link to the book:  OSGi In Action book
 
Robin Z. Clark
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand that the way to understand these tools is to make changes to the code and observe the results...try to add functionality.  That is what I am trying to do.  But I have trouble figuring out how to get the simplest possible examples to build and run.  The learning curve is very steep.  Thank you for your help.
 
Saloon Keeper
Posts: 21239
137
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most likely your problem is that those examples haven't been updated in 9 years and the current state of Apache Felix no longer supports those jar versions.

Actually, I'm not even sure if Felix is the ideal OSGi container any more. Last work I did was with Karaf and ServiceMix (which has Karaf in it, I think).
 
Robin Z. Clark
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.  That makes me feel a bit better.  In my new job I must use Karaf/Felix.  I don't have any choice.  Can you recommend a strategy for understanding this technology?  All of the documentation I've found is horribly old and contradictory.  If I could figure out some of the basics on how to build and run applications, I could figure out how to attach the source code from these antiquated frameworks and just read the framework code.  Most of the books are more of a sales pitch on how marvelous OSGi is than on how to actually USE IT.  
 
Tim Holloway
Saloon Keeper
Posts: 21239
137
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rest easy. Karaf is alive and well. In fact, the Pentaho DI (Kettle) product suite actually converted to Karaf not that long ago. Previously it was entirely do-it-yourself code.

I really don't know of anything solid in the document area. I have OSGi and Equinox, but it's an antique book, has its own share of ra-ra stuff, and I don't know that Equinox would be of direct help. Although I believe that Equinox is the core of the Apache (formerly IBM) Eclipse IDE product. Which is one of the oldest and most successful OSGi systems around.

Don't let the relative obscurity of OSGi deter you. Back in the middle 2000's, I worked with another Apache product series: the Avalon Inversion of Control container system. We had a lot of Java code that was basically batch processes and workflows, generally running on triggers or schedules, including quite a bit of ETL work. At the time, it was a decent option, since Pentaho didn't exist yet. But Avalon died and left no good heir. Spring came along a little later (they'd kicked me out the door by them). but Spring is rather low-level. Today I'd probably replace most of what we'd been doing then with either Pentaho or ServiceMix. And note that both of them are OSGi-based.

OSGi brings to service processes many of the same benefits that WAR and EAR modules bring to web processes. You get your own private classpath on a per-component basis so you don't have to worry about other components contaminating shared resources, but you also get cross-component communications. You can, indeed include a webapp servicing component. It's a lot better than splattering many stand-alone Java apps that aren't web-driven all over your servers. Instead, you collect them all up into modules and deploy them to the OSGi container in much the same way that you deploy webapps to a webapp container. You get a central control panel to manage them. And because they're a standardized architecture, it's easier to get people up to speed on creation and maintenance of OSGi apps. There are even Maven archetypes for OSGi.
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!