首页 > 代码库 > 微信公众号开发将war包导入新浪sae出现错误

微信公众号开发将war包导入新浪sae出现错误

JAVA_Error: Error for /wechat.do
java.lang.NoSuchFieldError: INSTANCE
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:52)
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:56)
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<clinit>(DefaultHttpRequestWriterFactory.java:46)
at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConnectionFactory.java:72)
at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConnectionFactory.java:84)
at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<clinit>(ManagedHttpClientConnectionFactory.java:59)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory.<init>(PoolingHttpClientConnectionManager.java:493)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:149)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:138)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:114)
at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:726)
at org.apache.http.impl.client.HttpClients.createDefault(HttpClients.java:58)
at demo.process.TulingApiProcess.getTulingResult(TulingApiProcess.java:39)
at demo.process.WechatProcess.processWechatMag(WechatProcess.java:23)
at demo.servlet.WechatServlet.doPost(WechatServlet.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478) yq32.javaruntime 

百度没有百度到 FQ去google说是可能是httpclient包冲突的问题 可是war包中仅仅有一个,没有办法去了新浪云计算平台开发论坛。

最后知道真相的我眼泪掉下来原来新浪sae临时仅仅支持httpclient4.1.x。

然后换成http4.1.x结果成功了。另附新浪sae的说明文档提供的

地址下载完整的jar包依赖包链接:http://sae4java.sinaapp.com/lib/sae-1.1.0-depend.zip


总结:以后使用一些第三方平台一定要事先阅读其说明文档。避免像无头苍蝇一样胡乱百度。

微信公众号开发将war包导入新浪sae出现错误