File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes method injection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "method injection problem" Watch "method injection problem" New topic
Author

method injection problem

Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
this is my main class


this is my xml file


it gives this error


but if i remove this part from xml it is working without errors
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Make sure that CGLib is in your CLASSPATH.


[My Blog]
All roads lead to JavaRanch
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
I added cglib.jar to classpath .still same error.

anyway i post all classes here

Animal interface


Dog class


Chicken class


ArtificialChicken class


main class


xml file


Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
the error says
Invalid method override: no method with name 'getMeat' on class

It is no need to overide a get Meat in Chicken class.
why it gives that error?
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
I change the xml file as below


now it gives another error

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

Is the cglib jar still in your classpath?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
I added cglib-2.2.jar using eclips.

I click project and click Build ->Configure Build Path
then add cglib-2.2.jar jar file.
is it ok?
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225

HI Samanthi ,

Infact all your code works pretty good



I added "com.springsource.net.sf.cglib-2.1.3.jar" to classpath ...


Thanks, Ganesh Gowtham
http://ganesh.gowtham.googlepages.com
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
I also have added that jar file.But still givews this rerror

Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225


after adding the required jar for eclipse , right click and refresh ...

CTRL+SHIFT+T --> Opens Class Browser in eclipse , where you type "Enhancer" , it should display
the jar which you had attached ...

if you didnt see jar attached , then jar is not properly set .. alternately you can check .classpath file of the project also ..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: method injection problem
 
Similar Threads
Error while executing simple application with jdk1.5
integration with hibernate
Error getting Spring security 2 to set up in Spring 2.5
java.lang.InstantiationException
Exception in thread "main" org.springframework.beans.factory.BeanCreationException