|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
An Issue while sending http requestHi,
I am using the httpclient 3.1. I sent a http request, in response it should return with a status code and with some response. But I did not get any response. And no any exception is thrown. boolean flag=false; try{ statusCode = httpClient.executeMethod(secureHostConfig, method); System.out.println("Status code: " +statusCode); if(statusCode==200){ flag=true; } }catch(Exception e){ System.out.println("Error while sending http request"); }finally{ if(!flag){ System.out.println("Operation Failed"); } } I am always getting "Operation Failed" but I don't see "Error while sending http request". What could be the cause for this problem and how I can resolve it ? Thanks |
|
|
Re: An Issue while send a requestOn 03/11/2009, Jawahar Nayak <jlal@...> wrote:
> > Hi, > > I am using the httpclient 3.1. I sent a http request, in response it > should return with a status code and with some response. But I did not get > any response. And no any exception is thrown. > > > boolean flag=false; > try{ > statusCode = httpClient.executeMethod(secureHostConfig, method); > System.out.println("Status code: " +statusCode); > if(statusCode==200){ flag=true; > } > > }catch(Exception e){ > System.out.println("Error while sending http request"); > }finally{ > if(!flag){ > System.out.println("Operation Failed"); > } > } > > I am always getting "Operation Failed" but I don't see "Error while sending > http request". > What could be the cause for this problem and how I can resolve it ? I think you have misunderstood how HTTP requests work. Exceptions are normally only thrown if there is a low-level communication error, otherwise the Status Code is set, e.g. to "404" if the page does not exist. What is the value of the status code? > Thanks > > > -- > View this message in context: http://old.nabble.com/An-Issue-while-send-a-request-tp26160038p26160038.html > Sent from the HttpClient-User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@... > For additional commands, e-mail: httpclient-users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@... For additional commands, e-mail: httpclient-users-help@... |
|
|
Re: An Issue while send a requestI am not getting any statuscode. I am getting the following error...
Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.simontuffs.onejar.Boot.run(Boot.java:306) at com.simontuffs.onejar.Boot.main(Boot.java:159) Caused by: java.lang.UnsatisfiedLinkError: no sunmscapi in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at sun.security.mscapi.SunMSCAPI$1.run(SunMSCAPI.java:34) at java.security.AccessController.doPrivileged(Native Method) at sun.security.mscapi.SunMSCAPI.<clinit>(SunMSCAPI.java:32) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou rce) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at sun.security.jca.ProviderConfig$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.security.jca.ProviderConfig.doLoadProvider(Unknown Source) at sun.security.jca.ProviderConfig.getProvider(Unknown Source) at sun.security.jca.ProviderList.getProvider(Unknown Source) at sun.security.jca.ProviderList$ServiceList.tryGet(Unknown Source) at sun.security.jca.ProviderList$ServiceList.access$200(Unknown Source) at sun.security.jca.ProviderList$ServiceList$1.hasNext(Unknown Source) at java.security.Signature.getInstance(Unknown Source) at com.sun.net.ssl.internal.ssl.JsseJce.getSignature(Unknown Source) at com.sun.net.ssl.internal.ssl.JsseJce.isEcAvailable(Unknown Source) at com.sun.net.ssl.internal.ssl.CipherSuite$KeyExchange.isAvailable(Unkn own Source) at com.sun.net.ssl.internal.ssl.CipherSuite.isAvailable(Unknown Source) at com.sun.net.ssl.internal.ssl.CipherSuiteList.buildAvailableCache(Unkn own Source) at com.sun.net.ssl.internal.ssl.CipherSuiteList.getDefault(Unknown Sourc e) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.init(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknow n Source) at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.creat eSocket(SSLProtocolSocketFactory.java:82) at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.creat eSocket(SSLProtocolSocketFactory.java:127) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java :707) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Htt pMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMe thodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav a:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav a:346)
|
|
|
Re: An Issue while send a requestOn 04/11/2009, Jawahar Nayak <jlal@...> wrote:
> > I am not getting any statuscode. I am getting the following error... You wrote: "But I did not get any response. And no any exception is thrown." which is why I responded as I did. > Exception in thread "main" java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at com.simontuffs.onejar.Boot.run(Boot.java:306) > at com.simontuffs.onejar.Boot.main(Boot.java:159) > Caused by: java.lang.UnsatisfiedLinkError: no sunmscapi in java.library.path This is nothing to do with HttpClient. It is either a problem in the Java installation, or a problem in the "com.simontuffs.onejar" software. > at java.lang.ClassLoader.loadLibrary(Unknown Source) > at java.lang.Runtime.loadLibrary0(Unknown Source) > at java.lang.System.loadLibrary(Unknown Source) > at sun.security.mscapi.SunMSCAPI$1.run(SunMSCAPI.java:34) > at java.security.AccessController.doPrivileged(Native Method) > at sun.security.mscapi.SunMSCAPI.<clinit>(SunMSCAPI.java:32) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > > at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown > Source) > > at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown > Sou > rce) > at java.lang.reflect.Constructor.newInstance(Unknown Source) > at java.lang.Class.newInstance0(Unknown Source) > at java.lang.Class.newInstance(Unknown Source) > at sun.security.jca.ProviderConfig$3.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at sun.security.jca.ProviderConfig.doLoadProvider(Unknown Source) > at sun.security.jca.ProviderConfig.getProvider(Unknown Source) > at sun.security.jca.ProviderList.getProvider(Unknown Source) > at sun.security.jca.ProviderList$ServiceList.tryGet(Unknown Source) > at sun.security.jca.ProviderList$ServiceList.access$200(Unknown > Source) > at sun.security.jca.ProviderList$ServiceList$1.hasNext(Unknown > Source) > at java.security.Signature.getInstance(Unknown Source) > at com.sun.net.ssl.internal.ssl.JsseJce.getSignature(Unknown Source) > at com.sun.net.ssl.internal.ssl.JsseJce.isEcAvailable(Unknown > Source) > at > com.sun.net.ssl.internal.ssl.CipherSuite$KeyExchange.isAvailable(Unkn > own Source) > at com.sun.net.ssl.internal.ssl.CipherSuite.isAvailable(Unknown > Source) > at > com.sun.net.ssl.internal.ssl.CipherSuiteList.buildAvailableCache(Unkn > own Source) > at com.sun.net.ssl.internal.ssl.CipherSuiteList.getDefault(Unknown > Sourc > e) > at com.sun.net.ssl.internal.ssl.SSLSocketImpl.init(Unknown Source) > at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source) > at > com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknow > n Source) > at > org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.creat > eSocket(SSLProtocolSocketFactory.java:82) > at > org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.creat > eSocket(SSLProtocolSocketFactory.java:127) > at > org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java > :707) > at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Htt > pMethodDirector.java:387) > at > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMe > thodDirector.java:171) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav > a:397) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav > a:346) > > > > sebb-2-2 wrote: > > > > On 03/11/2009, Jawahar Nayak <jlal@...> wrote: > >> > >> Hi, > >> > >> I am using the httpclient 3.1. I sent a http request, in response it > >> should return with a status code and with some response. But I did not > >> get > >> any response. And no any exception is thrown. > >> > >> > >> boolean flag=false; > >> try{ > >> statusCode = httpClient.executeMethod(secureHostConfig, > >> method); > >> System.out.println("Status code: " +statusCode); > >> if(statusCode==200){ flag=true; > >> } > >> > >> }catch(Exception e){ > >> System.out.println("Error while sending http request"); > >> }finally{ > >> if(!flag){ > >> System.out.println("Operation Failed"); > >> } > >> } > >> > >> I am always getting "Operation Failed" but I don't see "Error while > >> sending > >> http request". > >> What could be the cause for this problem and how I can resolve it ? > > > > I think you have misunderstood how HTTP requests work. Exceptions are > > normally only thrown if there is a low-level communication error, > > otherwise the Status Code is set, e.g. to "404" if the page does not > > exist. > > > > What is the value of the status code? > > > >> Thanks > >> > >> > >> -- > >> View this message in context: > >> http://old.nabble.com/An-Issue-while-send-a-request-tp26160038p26160038.html > >> Sent from the HttpClient-User mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: httpclient-users-unsubscribe@... > >> For additional commands, e-mail: httpclient-users-help@... > >> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: httpclient-users-unsubscribe@... > > For additional commands, e-mail: httpclient-users-help@... > > > > > > > > > -- > View this message in context: http://old.nabble.com/An-Issue-while-sending-http-request-tp26160038p26190841.html > > Sent from the HttpClient-User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@... > For additional commands, e-mail: httpclient-users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@... For additional commands, e-mail: httpclient-users-help@... |
|
|
Re: An Issue while send a requestIssue has been resolved now, my jre folder have missing sunmscapi.dll,
so I have re download jre from sun site.. On Wed, Nov 4, 2009 at 4:13 PM, sebb <sebbaz@...> wrote: > On 04/11/2009, Jawahar Nayak <jlal@...> wrote: >> >> I am not getting any statuscode. I am getting the following error... > > You wrote: > > "But I did not get any response. And no any exception is thrown." > > which is why I responded as I did. > >> Exception in thread "main" java.lang.reflect.InvocationTargetException >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) >> at java.lang.reflect.Method.invoke(Unknown Source) >> at com.simontuffs.onejar.Boot.run(Boot.java:306) >> at com.simontuffs.onejar.Boot.main(Boot.java:159) >> Caused by: java.lang.UnsatisfiedLinkError: no sunmscapi in java.library.path > > This is nothing to do with HttpClient. > > It is either a problem in the Java installation, or a problem in the > "com.simontuffs.onejar" software. > >> at java.lang.ClassLoader.loadLibrary(Unknown Source) >> at java.lang.Runtime.loadLibrary0(Unknown Source) >> at java.lang.System.loadLibrary(Unknown Source) >> at sun.security.mscapi.SunMSCAPI$1.run(SunMSCAPI.java:34) >> at java.security.AccessController.doPrivileged(Native Method) >> at sun.security.mscapi.SunMSCAPI.<clinit>(SunMSCAPI.java:32) >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native >> Method) >> >> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown >> Source) >> >> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown >> Sou >> rce) >> at java.lang.reflect.Constructor.newInstance(Unknown Source) >> at java.lang.Class.newInstance0(Unknown Source) >> at java.lang.Class.newInstance(Unknown Source) >> at sun.security.jca.ProviderConfig$3.run(Unknown Source) >> at java.security.AccessController.doPrivileged(Native Method) >> at sun.security.jca.ProviderConfig.doLoadProvider(Unknown Source) >> at sun.security.jca.ProviderConfig.getProvider(Unknown Source) >> at sun.security.jca.ProviderList.getProvider(Unknown Source) >> at sun.security.jca.ProviderList$ServiceList.tryGet(Unknown Source) >> at sun.security.jca.ProviderList$ServiceList.access$200(Unknown >> Source) >> at sun.security.jca.ProviderList$ServiceList$1.hasNext(Unknown >> Source) >> at java.security.Signature.getInstance(Unknown Source) >> at com.sun.net.ssl.internal.ssl.JsseJce.getSignature(Unknown Source) >> at com.sun.net.ssl.internal.ssl.JsseJce.isEcAvailable(Unknown >> Source) >> at >> com.sun.net.ssl.internal.ssl.CipherSuite$KeyExchange.isAvailable(Unkn >> own Source) >> at com.sun.net.ssl.internal.ssl.CipherSuite.isAvailable(Unknown >> Source) >> at >> com.sun.net.ssl.internal.ssl.CipherSuiteList.buildAvailableCache(Unkn >> own Source) >> at com.sun.net.ssl.internal.ssl.CipherSuiteList.getDefault(Unknown >> Sourc >> e) >> at com.sun.net.ssl.internal.ssl.SSLSocketImpl.init(Unknown Source) >> at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source) >> at >> com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknow >> n Source) >> at >> org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.creat >> eSocket(SSLProtocolSocketFactory.java:82) >> at >> org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.creat >> eSocket(SSLProtocolSocketFactory.java:127) >> at >> org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java >> :707) >> at >> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Htt >> pMethodDirector.java:387) >> at >> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMe >> thodDirector.java:171) >> at >> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav >> a:397) >> at >> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav >> a:346) >> >> >> >> sebb-2-2 wrote: >> > >> > On 03/11/2009, Jawahar Nayak <jlal@...> wrote: >> >> >> >> Hi, >> >> >> >> I am using the httpclient 3.1. I sent a http request, in response it >> >> should return with a status code and with some response. But I did not >> >> get >> >> any response. And no any exception is thrown. >> >> >> >> >> >> boolean flag=false; >> >> try{ >> >> statusCode = httpClient.executeMethod(secureHostConfig, >> >> method); >> >> System.out.println("Status code: " +statusCode); >> >> if(statusCode==200){ flag=true; >> >> } >> >> >> >> }catch(Exception e){ >> >> System.out.println("Error while sending http request"); >> >> }finally{ >> >> if(!flag){ >> >> System.out.println("Operation Failed"); >> >> } >> >> } >> >> >> >> I am always getting "Operation Failed" but I don't see "Error while >> >> sending >> >> http request". >> >> What could be the cause for this problem and how I can resolve it ? >> > >> > I think you have misunderstood how HTTP requests work. Exceptions are >> > normally only thrown if there is a low-level communication error, >> > otherwise the Status Code is set, e.g. to "404" if the page does not >> > exist. >> > >> > What is the value of the status code? >> > >> >> Thanks >> >> >> >> >> >> -- >> >> View this message in context: >> >> http://old.nabble.com/An-Issue-while-send-a-request-tp26160038p26160038.html >> >> Sent from the HttpClient-User mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@... >> >> For additional commands, e-mail: httpclient-users-help@... >> >> >> >> >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: httpclient-users-unsubscribe@... >> > For additional commands, e-mail: httpclient-users-help@... >> > >> > >> > >> >> >> -- >> View this message in context: http://old.nabble.com/An-Issue-while-sending-http-request-tp26160038p26190841.html >> >> Sent from the HttpClient-User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: httpclient-users-unsubscribe@... >> For additional commands, e-mail: httpclient-users-help@... >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@... > For additional commands, e-mail: httpclient-users-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@... For additional commands, e-mail: httpclient-users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |