Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8671969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:05:12+00:00 2026-06-12T19:05:12+00:00

Right now I try to implement the services of my OSGi-application as ds. Unfortunately

  • 0

Right now I try to implement the services of my OSGi-application as ds.

Unfortunately I can’t figure out how to access consume the service.

My Service looks like this:

public interface IService {
    public void foo(<T> bar);
}
public class ServiceImpl implemets IService {
    public void foo( bar){
        ...
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="iservice">
   <implementation class="ServiceImpl"/>
   <service>
      <provide interface="IService"/>
   </service>
</scr:component>

That’s as far as I am right now.

But how can I access the service?

  1. I tried the following solution: http://it-republik.de/jaxenter/artikel/OSGi-in-kleinen-Dosen-Services-auf-deklarative-Weise-2340.html

    But eclipse won’t find the import for

    ComponentContext h**p://www.osgi.org/javadoc/r4v42/org/osgi/service/component/ComponentContext.html

  2. I also found this solution: h**p://www.eclipsezone.com/eclipse/forums/t97690.rhtml

    But I’m a bit disappointed I’d have to wrap every single method and I’d have to use Eclipse specific apis

    There are the same problems with this solution: https://stackoverflow.com/a/11034485/1737519 although the example uses the apache felix api and not the Eclipse api.

All I want to do is access/reference the service like this:

Iservice s = ???;
s.foo(<T> bar);

Thx for your help in advance!

P.S. sry for masking the links, but I can’t include more than 2!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:05:13+00:00Added an answer on June 12, 2026 at 7:05 pm

    Here’s a way to consume your service. I have invented a fictional Billing component that needs to call your IService. Instead of using the XML I am using bnd annotations, which are much more convenient:

    @Component
    public class Billing {
    
        private IService service;
    
        @Reference
        public void setService(IService service) {
            this.service = service;
        }
    
        public void billCustomer() {
             // Do some stuff related to billing, whatever.
    
             // Blah blah blah
    
             // Now call the service, even though it wasn't real Java because
             // the <T> type parameter was unbound, but who cares...
             service.foo(bar);
    
             // Yay.
        }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learned php as functional and procedure language. Right now try to start learn
I am coming from Java and try to learn Javascript right now. Doing that
I'm quite new to ZF, and right now, i try to write a tiny
Is this the right way to implement localisation in VSTO Word Addin? Right now
i am trying to implement dependency injection for our custom ModelBinders. Right now i
by design, in the environment I'm working right now I can't use a debugger
Right now, I am having application which works with WiFi, but while I am
I'm using the tutorial here to develop a Service that is (right now) just
I try to implement Versions in application that already written for Snow Leopard. It
Right now I have an upload field while uploads files to the server. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.