Results 1 to 4 of 4

Thread: How to "lookup Method injection" ?

  1. #1

    Default How to "lookup Method injection" ?

    Hi everyone !

    I'm starting with Spring , and i'm trying every features of the spring core.

    Right now i'm stuck with Lookup method injection (3.3.4.1), i let you consult the short paragraph about
    just here :http://static.springframework.org/sp...s.html#d0e1058


    Code:
    <bean id="DataSource" class="com.AO.DAO.DAOImpl" autowire="byType" init-method="connect">
    	<lookup-method name="createResource" bean="File" />
    </bean>
    	
    <!-- This bean is abstract, it can't be instantiated as such -->
    <bean id="Resources" abstract="true" class="com.AO.resources.Resources" singleton="false">
    	<property name="read"><value>true</value></property>
    	<property name="write"><value>true</value></property>
    </bean>
    	
    <bean id="File" parent="Resources">
    	<property name="read"><value>true</value></property>	
    	<property name="id"><value>666</value></property>		
    </bean>
    In com.AO.DAO.DAOImpl, i have the following code :
    Code:
    protected IResources createResource&#40;&#41; &#123;	return null;	&#125;
    When i launch my app i got this error :
    2005-06-23 11:39:12,296 INFO [org.springframework.beans.factory.xml.XmlBeanFacto ry] - <Creating shared instance of singleton bean 'DataSource'>
    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'DataSource' defined in resource loaded through InputStream: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
    java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
    at org.springframework.beans.factory.support.CglibSub classingInstantiationStrategy.instantiateWithMetho dInjection(CglibSubclassingInstantiationStrategy.j ava:69)
    at org.springframework.beans.factory.support.SimpleIn stantiationStrategy.instantiate(SimpleInstantiatio nStrategy.java:53)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:322)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:223)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
    at com.AO.demo.App.main(App.java:35)

    Well, what i am doing wrong ? Everything is here, but it failed in a very strange way...
    Something appears to be missing but i have included Spring-beans.jar and spring-core.jar, and this features should belong to those "jars"...


    Belaran,

    :?:

  2. #2
    Join Date
    Oct 2004
    Location
    Not Redmond
    Posts
    26

    Default

    Hiya

    You need to reference the cglib.jar file too, as this feature relies on classes from that library.

    Ciao
    .NET Guy

  3. #3
    Join Date
    Oct 2004
    Location
    Not Redmond
    Posts
    26

    Default

    Hiya

    'Reference'? Shucks, I have been doing way too much .NET lately :?

    What I meant to write was that you have to ensure that the cglib.jar is available on your CLASSPATH. From the looks of the stacktrace, it isn't.

    java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
    Ciao
    .NET Guy

  4. #4

    Default

    Of course !

    Work perfectly now

    thanks++

Similar Threads

  1. PerformanceMonitorInceptor
    By chenrici in forum AOP
    Replies: 15
    Last Post: May 18th, 2006, 04:28 PM
  2. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  3. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  4. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  5. PerformanceMonitorInterceptor
    By tnist in forum AOP
    Replies: 3
    Last Post: Aug 24th, 2005, 01:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •