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 5957605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:25:29+00:00 2026-05-22T18:25:29+00:00

I’m learning Spring DM and I have a problem with Service registry. I’m using

  • 0

I’m learning Spring DM and I have a problem with Service registry. I’m using ServiceMix 4.3.0 with embedded Felix instance. I have 2 bundles in my project.

The first one contains interface, and mock implementation. I want to publish them to OSGi service registry:

public interface PersonAPI {
    public void listAll();
    public List<PersonEntity> getAll();
    public void addPerson(PersonEntity pe);
    public PersonEntity getPerson(int id);
}

PersonEntity is a simple class with data, nothing special.

Mock implementation is contains just a list of PeopleEntity objects, so there is nothing interesting either.

Here is part of Spring configuration XML:

<bean id="personImpl" class="com.osgi.Person.impl.mock.PersonImpl" />
<osgi:service id="personLogic" ref="personImpl" interface="com.osgi.Person.PersonAPI" />

And part taken from pom.xml file:

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
    <instructions>
        <Bundle-Category>sample</Bundle-Category>
        <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
        <Export-package>com.osgi.*</Export-package>
    </instructions>
</configuration>
</plugin>

This installs fine on ServiceMix. Now I defined another bundle, here are most important parts:

public class PersonTester {
    PersonAPI api;

public void init() {
    System.out.println("PostConstruct:");
    System.out.println("Have API " + api + " class " + api.getClass().getCanonicalName());

    api.listAll(); //This line (or any API call, blows everything)
}

public PersonAPI getApi() {
    return api;
}

public void setApi(PersonAPI api) {
    this.api = api;
}
}

Spring configuration:

<osgi:reference id="personLogic" interface="com.osgi.Person.PersonAPI" />   
<bean id="personTester" init-method="init" class="com.osgi.Person.PersonTester">
    <property name="api" ref="personLogic" />       
</bean>

Most important parts from pom.xml:

<dependencies>
    <dependency>
        <groupId>com.osgi</groupId>
        <artifactId>Pserson-API</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
....

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
    <instructions>
        <Bundle-Category>sample</Bundle-Category>
        <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
        <Import-package>com.Person.entity,com.osgi.Person</Import-package>
    </instructions>
</configuration>
</plugin>

The good news is, that “behind” injected Spring proxy is my implementation class. I can see that when using api.toString(). However when I call any method defined in my proxy, I get an exception:

Exception in thread “SpringOsgiExtenderThread-88” org.springframework.beans.factory.BeanCreationException: Error creating bean
with name ‘personTester’: Invocation of init method failed; nested exception is org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method [public abstract void com.osgi.Person.PersonAPI.listAll()] on target [PersonImpl [set=[]]]; nested exception is java.lang.IllegalArgumentException:
object is not an instance of declaring class

It looks like It looks like AOP is missing the target, but why? And how to fix this?

  • 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-05-22T18:25:30+00:00Added an answer on May 22, 2026 at 6:25 pm

    The problem is fixed. It was something in the environment.

    I started building new project (with different artifact Id) on top of this tutorial and everything looks OK. Perhaps something cached somewhere (strange, because I flushed ServiceMix bundle cache and local maven repo). I try to reproduce it on different machine, and maybe I’ll come up with some better explanation.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,

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.