java.lang.NoSuchMethodError: org/apache/http/conn/scheme/Scheme.<init>(Ljava/lang/String&

1,320 views
Skip to first unread message

iorch

unread,
Dec 3, 2012, 3:51:28 PM12/3/12
to sardi...@googlegroups.com
Hi All,

I am using sardine with spring 3 and json to create a REST Web service under eclipse IDE: this is the sample I am using to do a simple listing:

      public static List<DavResource> getListFromServer()throws IOException {
Sardine sardine = SardineFactory.begin("username","password");
List<DavResource> resources = sardine.list("http://localhost/");
for (DavResource res : resources){
System.out.println(res);
}
return filesinServer;
}

If i run this method from a main method it works, but if I use it as a library inside another eclipse project where all the WebServices are this stacktrace is thrown:

Caused by: java.lang.NoSuchMethodError: org/apache/http/conn/scheme/Scheme.<init>(Ljava/lang/String;ILorg/apache/http/conn/scheme/SchemeSocketFactory;)V
at com.googlecode.sardine.impl.SardineImpl.createDefaultSchemeRegistry(SardineImpl.java:770)
at com.googlecode.sardine.impl.SardineImpl.createDefaultClient(SardineImpl.java:728)
at com.googlecode.sardine.impl.SardineImpl.<init>(SardineImpl.java:163)
at com.googlecode.sardine.SardineFactory.begin(SardineFactory.java:43)
at com.googlecode.sardine.SardineFactory.begin(SardineFactory.java:33)
at com.test.filemanager.TestSardine.getListFromServer(TestSardine.java:24)
at com.test.service.impl.PdfServiceImpl.filesinServerlistFiles(PdfServiceImpl.java:79)
at com.test.controller.DLController.getFileList(DLController.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
... 29 more

I had check and re check libraries to see if another version of the class org.apache.http.conn.scheme.Scheme is hidden but is not this is what i have for libs:

commons-logging-1.1.1.jar
log4j-1.2.15.jar
jackson-mapper-asl-1.8.1.jar
jackson-core-asl-1.8.1.jar
jackson-jaxrs-1.9.2.jar
spring-expression-3.0.6.RELEASE.jar
spring-asm-3.0.6.RELEASE.jar
spring-beans-3.0.6.RELEASE.jar
spring-context-3.0.6.RELEASE.jar
spring-core-3.0.6.RELEASE.jar
spring-oxm-3.0.3.RELEASE.jar
spring-jms-3.0.3.RELEASE.jar
spring-web-3.0.6.RELEASE.jar
spring-webmvc-3.0.6.RELEASE.jar
ant.jar
ant-googlecode-0.0.2.jar
commons-codec-1.4.jar
commons-logging-1.1.1.jar
httpclient-4.1.2.jar
httpcore-4.1.3.jar
junit-4.8.2.jar
slf4j-api-1.6.2.jar
svnkit.jar
svntask.jar
sweetened.jar
sardine.jar

Please help.
Regards!


iorch

unread,
Dec 4, 2012, 10:50:41 AM12/4/12
to sardi...@googlegroups.com
I got the problem, there is a runtime conflict between Websphere 8 libs and sardine libs for the httpclient jar. I was using (as requried by the API) the httpclient-4.1.2.jar which has a new version of the Scheme class.
The problem was that the eclipse adds a Websphere Application Server  v8.0 lib which has an older class version of the Scheme class inside one of the server jar. 

Since its not an easy task to change the serve libs, i will have to look for another approach.

Regards!!

Jon Stevens

unread,
Dec 4, 2012, 12:44:47 PM12/4/12
to sardi...@googlegroups.com
you can just modify the sardine source code in your own branch of sardine to compile against the websphere version of the http libs. it shouldn't be too difficult to do this.

jon
Message has been deleted

Sushil Sapkota

unread,
Mar 22, 2018, 9:16:25 PM3/22/18
to sardine
I'm getting the same exception. My question is for Jon Stevens; how to modify the sardine source code and compile against the websphere version of the http libs?
Reply all
Reply to author
Forward
0 new messages