-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.NoClassDefFoundError: Could not initialize class com.mashape.unirest.http.options.Options #35
Comments
Just to be sure, are you currently using Unirest version <dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency> |
Yes i am 100% sure with those version (locally):
Down below is the jars that SAE provide:
OR which version of Unirest does depend on the above versions ? |
I'm seeing the same error when trying out Unirest from a Grails console and a different (dependency) looking error in a standalone Groovy app. Works in Java just fine, I wonder if it's something in Groovy's included runtime libs. I'll see if I can glean a bit more info and raise a separate issue. |
I had a conflicting version of httpclient. Looks like you might have the same problem with the version that SAE is providing. |
So the problem source is the version of the httpclient ? between 4.3.3 and 4.1.2 ? |
Yes that was the problem for me. If SAE are providing those older jars at runtime and therefore out of your (pom.xml) control then I doubt you'll be able to use Unirest without some custom classloading magic. |
OH THANKS ,but i am blank to classloading STAFF, maybe i should take step into that magic world of ClassLoading . Haha Thanks again , I'll take a try and see what happens . ^_^ |
Hello !
$ Here i do have a problem that i can not work out .. for long time
$ I do have all dependencies that unirest-java needs,but i got traces like blow printing form (http://2.minime.sinaapp.com/):
java.lang.NoClassDefFoundError: Could not initialize class com.mashape.unirest.http.options.Options
at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:151)
at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:128)
at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)
at org.strongme.minime.global.GlobalUtil.getAccessToken(GlobalUtil.java:224)
at org.strongme.minime.global.WeiXinService.getAccessToken(WeiXinService.java:19)
at org.strongme.minime.HomeController.home(HomeController.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:624)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
What is going on ?
The text was updated successfully, but these errors were encountered: