Announcement Announcement Module

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
Error when passing a <reference> to a class Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error when passing a <reference> to a class

    I am getting the following error when deploying a springDM file into Karaf:

    org.springframework.beans.NotWritablePropertyException: Invalid property 'controller' of bean class [java.lang.string]: Bean property 'controller' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    First, here is where I create my bean:

    <bean id="myAppDataSourceController" class="myApp.controller.DataSourceController" 
      p:Dao-ref="myAppDao" />
    and in another xml file I attach it to the service registry:

    <service ref="myAppDataSourceController" 
         interface="myApp.controller.DataSourceControllerIfc" />
    Here is the pojo in another bundle that uses the service:

    public class DAOTest { 
     private static DataSourceController controller; 
     public static void setController(DataSourceController controller){ 
      DAOTest.controller = controller; 
     public static DataSourceController getController() { 
      return controller; 
     public static String dataPopulator() { 
      // excercise the DAO and return "pass" if it passes 
    Here is where I get the reference:

    <reference id="myAppDataSourceController"
    And here is the where I attempt to inject the service reference into the above class:

    <bean id="DAOTest" class="myApp.testharness.DAOTest" 
    In Karaf when I perform an 'ls' on the myApp.controller bundle I get the following:
    Bundle <id> provides:
    Bundle-SymboicName = myApp.controller
    Bundle-Version = 0.0.1
    objectClass = myApp.controller.DataSourceControllerIfc = myAppDataSourceController = <number>

    Does anyone have an idea what the issue is?

    I also noticed that when I inject a service reference to my pojo, it wont' let me pass in Strings or Ints. Kind of unnerving.


    Mike Van

  • #2

    Ok, after speaking with the Karaf group, it looks like the problem was with how I was starting my initialization method "doPopulate()".

    To fix this, I removed all of the final and static words from my property and method signatures. Then, I had my class implement the InitializerBean interface, and changed "public String doPopulate()" to "public void afterPropertiesSet()".

    Hope this makes sense.