• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

method injection problem

 
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
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • 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

 
author & internet detective
Posts: 40286
819
Eclipse IDE VI Editor Java
  • 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?
 
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 ..
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic