• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

method injection problem

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that CGLib is in your CLASSPATH.
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I change the xml file as below


now it gives another error

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34214
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

Is the cglib jar still in your classpath?
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Samanthi ,

Infact all your code works pretty good



I added "com.springsource.net.sf.cglib-2.1.3.jar" to classpath ...
 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also have added that jar file.But still givews this rerror

 
Ganesh Gowtham
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic