Announcement Announcement Module
Collapse

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
Could not instantiate bean class: No default constructor found Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Could not instantiate bean class: No default constructor found

    Hi,
    I am having a weird issue and would appreciate if someone can help me. When I start a bundle I am getting the following exception:

    Caused by: org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [accountcreator.AccountCreator]: No default constructor found;
    nested exception is java.lang.NoSuchMethodException: accountcreator.AccountCreator.<init>()
    at org.springframework.beans.factory.support.SimpleIn stantiationStrategy
    .instantiate(SimpleInstantiationStrategy.java:69)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBean
    Factory.instantiateBean(AbstractAutowireCapableBea nFactory.java:938)
    ... 15 more
    Caused by: java.lang.NoSuchMethodException: accountcreator.AccountCreator.<init>
    ()
    at java.lang.Class.getConstructor0(Class.java:2706)
    at java.lang.Class.getDeclaredConstructor(Class.java: 1985)
    at org.springframework.beans.factory.support.SimpleIn stantiationStrategy
    .instantiate(SimpleInstantiationStrategy.java:64)
    ... 16 more



    The AccountCreator infact does have a default constructor and is:

    package accountcreator;

    import dao.IPut;
    import java.util.UUID;

    public class AccountCreator {

    public AccountCreator() {
    System.out.println("Account Creator Initialized...");
    }

    public IPut getPut() {
    return put;
    }

    public void setPut(IPut put) {
    this.put = put;
    }

    public void start() throws Exception {
    System.out.println("Hello World");
    put.putAccount("Account", UUID.randomUUID().toString(), "New");
    }

    public void stop() throws Exception {
    System.out.println("Goodbye");
    }

    IPut put;
    }

    The spring configuration is:

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean name="accountcreator" class="accountcreator.AccountCreator"
    init-method="start" destroy-method="stop">
    <property name="put" ref="accountDAOService"/>
    </bean>
    </beans>


    The weird part is:
    1. I had a jar file that was working before and I redeployed it and it works when it is the exact same code (+spring configurations).
    2. I unjar'd the working jar and decompiled the classes and re-bundle them together and the new jar throws this exception when I start it.

    Help,

  • #2
    No worries, I was deploying a wrong bundle.

    Comment

    Working...
    X