• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

BeanUtils.copyProperties(destination,original) issue

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to copy the properties from one object to another using BeanUtils.copyProperties(destination,original) of commons-beanutils.jar.
After upgrading from java 7 to java 8 i am getting the error.
returning "Exception:
org.apache.commons.beanutils.ConvertUtils.primitiveToWrapper(Ljava/lang/Class;)Ljava/lang/class;": java.lang.NoSuchMethodError:
org.apache.commons.beanutils.ConvertUtils.primitiveToWrapper(Ljava/lang/Class;)Ljava/lang/class;

Please find the attached screenshot where it's using two different version jars for AbstractConverter.java:137  using commons-beanutils-1.9.2.jar:1.9.2 and for BeanUtilsBean.java using commons-beanutils-1.7.0.jar:1.6.

But in my pom.xml below configuration is there so maven will download only 1.9.2 version.



If I remove the folder 1.7.0 of commons-beanutils in offline repository and do a maven build I am getting the following error.

Execution default of goal org.codehaus.mojo:aspect-maven-plugin:1.4:compile failed: plugin org.codehaus.mojo:aspectj-maven-plugin:1.4 or one of its dependencies could not be resolved: Cannot access repository (repositoryurl) in offline mode and the artifact commons-beanutils:jar:1.7.0 has not been downloaded from it before.

Tried with google but did not help , Please help to advise how can i resolve the issue.
JAR_CONFLICT.JPG
[Thumbnail for JAR_CONFLICT.JPG]
 
Saloon Keeper
Posts: 27819
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BeanUtils relies on introspection and after Java 8, introspection changed rapidly, so you can't expect any random version of BeanUtils to work for an eequally random version of Java.

Incidentally, if you're looking to copy bean properties, a project called Dozer can make that chore a lot easier. It's available via Maven.
 
mohana krishna
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim Holloway thanks for your reply.

Same code working fine in SIT Linux environment with java 8 , but giving problem in the local windows environment with java 8.
Will check with the Dozer jar.

 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic