commons-httpclient包下的httpClient.executeMethod(postMethod)方法报错
httpClient.executeMethod(postMethod)方法用到的部分代码:ByteArrayOutputStream bs = new ByteArrayOutputStream();
PrintWriter out = new PrintWriter(bs, true);
Marshaller m = new Marshaller(out);
m.setSuppressXSIType(true);
m.setEncoding("utf-8");
m.marshal(outObject);
out.flush();
String byteStr = new String(bs.toByteArray());
byteStr = "param=" + byteStr;
byte[] bytes = byteStr.getBytes("utf-8");
InputStream info = new ByteArrayInputStream(bytes);
postMethod.setRequestBody(info);
postMethod.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");
int statusCode = httpClient.executeMethod(postMethod);
下面是报错信息:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
at org.apache.commons.httpclient.params.DefaultHttpParams.getLongParameter(DefaultHttpParams.java:171)
at org.apache.commons.httpclient.params.HttpClientParams.getConnectionManagerTimeout(HttpClientParams.java:137)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:152)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at com.cslc.ump.jcsynch.Transport.Post(Transport.java:118)
at com.cslc.ump.jcsynch.JCSynchImpl.synchBranchInfo(JCSynchImpl.java:139)
at com.cslc.ump.jcsynch.JCInte易做图ce.synchBranchInfo(JCInte易做图ce.java:54)
at com.cslc.ump.channel.dao.impl.CSynchTableInfoDaoImpl.synchJCData(CSynchTableInfoDaoImpl.java:183)
at com.cslc.ump.channel.service.impl.SynchTableInfoServiceImpl.synchJCData(SynchTableInfoServiceImpl.java:67)
at com.cslc.ump.channel.service.impl.SynchTableInfoServiceImpl$$FastClassByCGLIB$$cee8110c.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
at com.cslc.ump.channel.service.impl.SynchTableInfoServiceImpl$$EnhancerByCGLIB$$dc20679b.synchJCData(<generated>)
at com.cslc.ump.channel.manager.impl.SynchTableInfoManagerImpl.synchJCData(SynchTableInfoManagerImpl.java:77)
at com.cslc.ump.channel.action.SynchTableInfoAction.synchJCData(SynchTableInfoAction.java:80)
--------------------编程问答-------------------- 哪位大侠帮我看看为什么会出现这种异常啊
补充:Java , Web 开发