Announcement Announcement Module
Collapse
No announcement yet.
Can someone explain this bean instantiation error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can someone explain this bean instantiation error

    I added a bean to my Spring daoContext.xml and I'm getting the following error message when the container tries to instantiate the bean.

    org.springframework.beans.FatalBeanException: Could not instantiate class[myapp.dao.inventoryDao];
    has class definition changed?
    Is there a public no-arg constructor?;
    nested exception is java.lang.IllegalAccessException:
    Class org.springframework.beans.BeanUtils can not access a member of class myapp.dao.inventoryDao with modifiers "public"

    I am not trying to set any properties. The definition is:
    <bean id="inventoryDao" class="myapp.dao.inventoryDao" >
    </bean>

    There is a public no-arg constructor and the class file is current.

    What is the error message referring to?

  • #2
    Hi,

    are you sure your actual class is InventorDao - or is it possible that this is only an interface?

    Only a thought ...

    Simon

    Comment


    • #3
      Some more thoughts:

      - It could be a typo. You wrote "inventoryDao" with a lowercase "i"
      - The class is possibly not public

      Regards,
      Andreas

      Comment


      • #4
        Thanks Andreas

        Andreas, your second thought was correct. The class was not declared public. The error message had me focused on attributes and I did not see the forest for the trees.

        Thanks again!

        Comment

        Working...
        X