users@jersey.java.net

[Jersey] Error while running the test

From: Rahul Babbar <rahul.babbar1_at_gmail.com>
Date: Mon, 31 Oct 2011 16:26:18 -0700

Hi,

I was trying to run the REST tests through the Jersey test framework and
starting getting the following error.

"Caused by: java.lang.NoSuchMethodError:
org.apache.commons.beanutils.converters.StringConverter.<init>(Ljava/lang/Object;)V
 at
org.apache.commons.beanutils.ConvertUtilsBean.registerStandard(ConvertUtilsBean.java:681)
at
org.apache.commons.beanutils.ConvertUtilsBean.deregister(ConvertUtilsBean.java:579)
 at
org.apache.commons.beanutils.ConvertUtilsBean.<init>(ConvertUtilsBean.java:164)
at
org.csmc.wscommon.util.jersey.JerseyParameterMapper.<init>(JerseyParameterMapper.java:40)
 at org.csmc.cdr.client.impl.CdrClientImpl.<init>(CdrClientImpl.java:72)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
 ... 55 more
"

Here is the jersey test framework dependency in pom.xml

<dependency>
    <groupId>com.sun.jersey.jersey-test-framework</groupId>
    <artifactId>jersey-test-framework-grizzly</artifactId>
 <version>1.9.1</version>
    <scope>test</scope>
</dependency>


A bit of google serach showed that the problem is coming because of
multiple versions of commons-beanutils jar, and apparently the previous
version of BeanUtils is being used, which does not have this method.
I have the following in pom.

<dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <version>1.8.3</version>
  </dependency>

Not sure what is the problem or whether the issue is related to jersey, but
i thought may be Jersey Test framework uses the old version of BeanUtils.
The problem only comes with the Jersey Tests and otherwise the application
runs fine.

Can someone please see what the problem could be.

Thank you

Rahul



Rahul