RE: Wire Logging

2009-06-03 Thread Ken Krugler

Bindul,

Thanks, sometimes even if the problem is staring you right in the 
face, you can't see it.


I removed the .level from the logger names.

Still no logging of data over the wire.

I've tried various ways of setting up the logging, passing as JVM options,
setting in the JAVA_HOME/logging.properties file.

If I wasn't seeing the logging for org.apache.commons.httpclient in my log, I
would assume it was something I was doing wrong, but that logging is 
showing up,

so I'm somewhat confused as to why one would show up, but not the others.

Anything else I might try?


IIRC, with HttpClient 3.1 there was a weird thing where 
"httpclient.wire" was the name of the wire logger, not 
org.apache.


-- Ken
--
Ken Krugler
+1 530-210-6378

-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



RE: Wire Logging

2009-06-03 Thread Danny Gallagher
Bindul,

Thanks, sometimes even if the problem is staring you right in the face, you 
can't see it.

I removed the .level from the logger names.

Still no logging of data over the wire.

I've tried various ways of setting up the logging, passing as JVM options,
setting in the JAVA_HOME/logging.properties file.

If I wasn't seeing the logging for org.apache.commons.httpclient in my log, I 
would assume it was something I was doing wrong, but that logging is showing 
up, 
so I'm somewhat confused as to why one would show up, but not the others.

Anything else I might try?

Thanks for the help.


Re: Wire Logging

2009-06-03 Thread Bindul Bhowmik
Danny,

On Wed, Jun 3, 2009 at 13:53, Danny Gallagher
 wrote:
> Using 3.1
>
>
>
> I cannot seem to get wire logging to produce anything in my log.
>
>
>
> Here is the code:
>
>
>
> FileHandler defaultHandler = new FileHandler(path + "BBD%u.log", 5,
> 1, true);
>
> Logger.getLogger("").addHandler(defaultHandler);
>
> Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.ALL);
>
>
>
> Logger.getLogger("org.apache.http.wire.level").setLevel(Level.ALL);
>
> Logger.getLogger("org.apache.http.level").setLevel(Level.ALL);
>

You might want to change the two lines above to:
Logger.getLogger("org.apache.http.wire").setLevel(Level.ALL);
Logger.getLogger("org.apache.http").setLevel(Level.ALL);

Basically remove the '.level' from the logger names.

>
>
>
>
> This produces log entries for the classes under
> org.apache.commons.httpclient, but nothing
>
> for data going over the wire.
>
>
>
> I can't seem to figure out what I am missing / not doing correctly.
>
>
>
> Any help is appreciated.
>
>
>
> Thanks
>

HTH
Bindul

-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



Wire Logging

2009-06-03 Thread Danny Gallagher
Using 3.1

 

I cannot seem to get wire logging to produce anything in my log.

 

Here is the code:

 

FileHandler defaultHandler = new FileHandler(path + "BBD%u.log", 5,
1, true);

Logger.getLogger("").addHandler(defaultHandler);

Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.ALL);

 

Logger.getLogger("org.apache.http.wire.level").setLevel(Level.ALL);

Logger.getLogger("org.apache.http.level").setLevel(Level.ALL);

 

 

This produces log entries for the classes under
org.apache.commons.httpclient, but nothing

for data going over the wire.

 

I can't seem to figure out what I am missing / not doing correctly.

 

Any help is appreciated.

 

Thanks

 

 

 



Re: httpcomponents-client-4.0-beta3-SNAPSHOT + httpcomponents-core-4.1-SNAPSHOT?

2009-06-03 Thread Oleg Kalnichevski

Will McQueen wrote:

Hi Oleg,

I noticed that the currently-downloadable HttpClient 4.0-beta2 relies on the 
non-final beta release of HttpCore 4.0 (httpcore-4.0-beta3). It seems wasteful 
not to take advantage of the *final* core version now that it's available, so I 
looked at the svn repos for HttpClient:

https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk

...and found that the POM file now specifies HttpCore 4.0 final (and mime4j 0.6 instead 
of 0.5). Great :-) Maybe I should d/l the latest HttpClient b3 snapshot 
("httpcomponents-client-4.0-beta3-SNAPSHOT"). But then I go to HttpCore svn 
repos:

https://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk

...and I see a 4.1 snapshot ("httpcomponents-core-4.1-SNAPSHOT")... hmmm, it 
seems wasteful not to take advantage of all those httpcore bug fixes since 4.0 final... 
so I'm thinking about modifying the HttpClient 4.0b3 snapshot's POM file to depend on 
HttpCore 4.1 snapshot instead of HttpCore 4.0 GA, so that I can get the best of both.

So my questions are (if you please...):
1) I know only the basics of POM right now. It seems that all I'd need to do to 
get the current best of both would be to modify this POM:
https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/pom.xml
   ...so that this:
4.0
   ...becomes this:
4.1-SNAPSHOT
   


Hi Will,

There has been only one bug fix in HttpCore blocking I/O module. There 
is pretty much no reason to upgrade HttpClient dependency unless your 
application has been affected by HTTPCORE-198


https://issues.apache.org/jira/browse/HTTPCORE-198

Having said that, there will be HttpCore 4.0.1 before HttpClient 4.0 
final release.



   Is that right? Or is there some other change I'd need to make somewhere else 
either in this file or some other file?

2) I looked at BUILDING.txt:


https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/BUILDING.txt

   ...but I didn't find the answer to the following question:
"In order to build httpclient using maven, do I just need to checkout only 
the POM.xml file and run maven against it (after which it will download everything it 
needs at runtime, including tests, junit jars, etc), or do I need to check-out the entire 
trunk and then run maven?"
   Could you please help me answer this?



Yes, you do. You need a complete snapshot of the trunk in order to be 
able to build HttpClient. You do not need to check out any dependencies, 
though. Maven will take care of that automatically.




3) I plan to run all tests from maven against both the httpcore and the 
httpclient snapshots -- ie, I realize that if I run the tests only against the 
client, then I'd be executing all httpclient tests but I'd be missing-out on 
all the httpcore tests... so I'd need to grab the httpcore pom as well, just 
for the purpose of executing the core-only tests. It's too bad there's not an 
option in the single httpclient pom file to be able to exercise both the 
httpclient tests and the httpcore tests against the httpclient snapshot.
After executing the tests, and assuming that all tests pass, then what would you say are 
the biggest risks to using this user-generated build instead of waiting for the 
non-snapshot "release"/downloadable version of httpclient b3? If I know the 
biggest risks and can accept them, then I'd feel much more comfortable using my 
custom-built jars. At what point do you decide when to tag a build -- do you tag it when 
all tests pass and there have been a substantial amount of bug fixes / new features?



There is really no point upgrading at the moment. There has been just 
one bug in HttpCore affecting HttpClient 4.0. All other bug fixes were 
in the NIO code that are of no relevance for HttpClient.




Lots of question, I know. I'm eager and excited to be almost ready to start 
seriously using httpclient4. At work, we currently use httpclient3.1 to test 
against the REST web services on our staging server. We also test against 
Production immediately after a deploy.



Just a little bit of patience. I am really trying to get HttpClient 4.0 
released as soon as possible without getting myself fired from my day 
job and without getting divorced.


Cheers

Oleg


Thank you.

PS: I've read through the current version of the HttpClient4 tutorial... very 
nice job so far! :-)

Cheers,
Will


  


-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org




-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



Re: H4 - B3

2009-06-03 Thread Oleg Kalnichevski

Joan Balagueró Valls wrote:

Hello Oleg,

 


Do you know any idea about when you plan to release H4-beta3?

 


Many thanks,

 


Joan.




Hi Joan

HttpClient 4.0 trunk has been quite stable so far (7 bug fixed since 
beta4, only one of which I would consider anywhere near major). 
Therefore the next release is likely to be 4.0 (GA).


The next release (be it 4.0b3 or 4.0 ga) is expected in July.

Oleg

-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



Re: NullPointerException in AsyncNHttpClientHandler

2009-06-03 Thread Oleg Kalnichevski

Yongxing Wang wrote:

Hi,

We are using HTTP-NIO 4.0 to communicate with our internal http servers, on a very high volume bases (80Mbits/second on both upload and download). We use AsyncNHttpClientHandler and DefaultClientIOEventDispatch. 



We are seeing some strange behaviors randomly. After putting some debug 
messages and we finally identify the following exception that causes us great 
sorrow:


java.lang.NullPointerException
at 
org.apache.http.nio.protocol.AsyncNHttpClientHandler.outputReady(AsyncNHttpClientHandler.java:266)
at 
org.apache.http.impl.nio.DefaultNHttpClientConnection.produceOutput(DefaultNHttpClientConnection.java:213)
at 
org.apache.http.impl.nio.DefaultClientIOEventDispatch.outputReady(DefaultClientIOEventDispatch.java:152)
at 
org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:177)
at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:317)
at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:294)
at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:256)
at 
org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:96)
at 
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:556)
at 
java.lang.Thread.run(Thread.java:619)


It happens randomly and happens with HTTP GET. Look at the line 266, it is:

int statusCode = response.getStatusLine().getStatusCode();

It seems that the "response" is returned prematurely. 



I think the line that causes NPE is this one

http://hc.apache.org/httpcomponents-core/httpcore-nio/xref/org/apache/http/nio/protocol/AsyncNHttpClientHandler.html#266

What seems obviously wrong is that AsyncNHttpClientHandler#outputReady 
event gets triggered for a GET request. This is not supposed to happen 
at all as GET requests are not supposed to enclose a content body.


However, this _could_ be caused by a race condition if multiple threads 
were to access the same connection object simultaneously. HTTP 
connections objects are NOT thread-safe. It is _strongly_ recommended 
HTTP connections should NEVER be accessed ouside the 
AsyncNHttpClientHandler events.


Thread safety issue would be my primary guess here, especially given the 
fact the problems seems to happen randomly.




This NullPointerException will propagate all the way up to IOReactorExceptionHandler "handle(RuntimeException ex);", where you only have two options, ignore it or shutdown the whole IoReactor (neither of the two is good for us). I guess the root problem is that we should never see that NPE. 



Is there any more information I can provide to help address this problem?



Yes, a test case reproducing the problem or some contextual information 
would be great.


One can add some rudimentary wire / context logging to HttpCore NIO 
using these classes:


http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/

Hope this helps somewhat.

Oleg


thanks,
Yong


  


-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org




-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



httpcomponents-client-4.0-beta3-SNAPSHOT + httpcomponents-core-4.1-SNAPSHOT?

2009-06-03 Thread Will McQueen

Hi Oleg,

I noticed that the currently-downloadable HttpClient 4.0-beta2 relies on the 
non-final beta release of HttpCore 4.0 (httpcore-4.0-beta3). It seems wasteful 
not to take advantage of the *final* core version now that it's available, so I 
looked at the svn repos for HttpClient:

https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk

...and found that the POM file now specifies HttpCore 4.0 final (and mime4j 0.6 
instead of 0.5). Great :-) Maybe I should d/l the latest HttpClient b3 snapshot 
("httpcomponents-client-4.0-beta3-SNAPSHOT"). But then I go to HttpCore svn 
repos:

https://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk

...and I see a 4.1 snapshot ("httpcomponents-core-4.1-SNAPSHOT")... hmmm, it 
seems wasteful not to take advantage of all those httpcore bug fixes since 4.0 
final... so I'm thinking about modifying the HttpClient 4.0b3 snapshot's POM 
file to depend on HttpCore 4.1 snapshot instead of HttpCore 4.0 GA, so that I 
can get the best of both.

So my questions are (if you please...):
1) I know only the basics of POM right now. It seems that all I'd need to do to 
get the current best of both would be to modify this POM:
https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/pom.xml
   ...so that this:
4.0
   ...becomes this:
4.1-SNAPSHOT
   
   Is that right? Or is there some other change I'd need to make somewhere else 
either in this file or some other file?

2) I looked at BUILDING.txt:


https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/BUILDING.txt

   ...but I didn't find the answer to the following question:
"In order to build httpclient using maven, do I just need to checkout 
only the POM.xml file and run maven against it (after which it will download 
everything it needs at runtime, including tests, junit jars, etc), or do I need 
to check-out the entire trunk and then run maven?"
   Could you please help me answer this?

3) I plan to run all tests from maven against both the httpcore and the 
httpclient snapshots -- ie, I realize that if I run the tests only against the 
client, then I'd be executing all httpclient tests but I'd be missing-out on 
all the httpcore tests... so I'd need to grab the httpcore pom as well, just 
for the purpose of executing the core-only tests. It's too bad there's not an 
option in the single httpclient pom file to be able to exercise both the 
httpclient tests and the httpcore tests against the httpclient snapshot.
After executing the tests, and assuming that all tests pass, then what would 
you say are the biggest risks to using this user-generated build instead of 
waiting for the non-snapshot "release"/downloadable version of httpclient b3? 
If I know the biggest risks and can accept them, then I'd feel much more 
comfortable using my custom-built jars. At what point do you decide when to tag 
a build -- do you tag it when all tests pass and there have been a substantial 
amount of bug fixes / new features?

Lots of question, I know. I'm eager and excited to be almost ready to start 
seriously using httpclient4. At work, we currently use httpclient3.1 to test 
against the REST web services on our staging server. We also test against 
Production immediately after a deploy.

Thank you.

PS: I've read through the current version of the HttpClient4 tutorial... very 
nice job so far! :-)

Cheers,
Will


  

-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



H4 - B3

2009-06-03 Thread Joan Balagueró Valls
Hello Oleg,

 

Do you know any idea about when you plan to release H4-beta3?

 

Many thanks,

 

Joan.



NullPointerException in AsyncNHttpClientHandler

2009-06-03 Thread Yongxing Wang

Hi,

We are using HTTP-NIO 4.0 to communicate with our internal http servers, on a 
very high volume bases (80Mbits/second on both upload and download). We use 
AsyncNHttpClientHandler and DefaultClientIOEventDispatch. 


We are seeing some strange behaviors randomly. After putting some debug 
messages and we finally identify the following exception that causes us great 
sorrow:


java.lang.NullPointerException
at 
org.apache.http.nio.protocol.AsyncNHttpClientHandler.outputReady(AsyncNHttpClientHandler.java:266)
at 
org.apache.http.impl.nio.DefaultNHttpClientConnection.produceOutput(DefaultNHttpClientConnection.java:213)
at 
org.apache.http.impl.nio.DefaultClientIOEventDispatch.outputReady(DefaultClientIOEventDispatch.java:152)
at 
org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:177)
at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:317)
at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:294)
at 
org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:256)
at 
org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:96)
at 
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:556)
at 
java.lang.Thread.run(Thread.java:619)

It happens randomly and happens with HTTP GET. Look at the line 266, it is:

int statusCode = response.getStatusLine().getStatusCode();

It seems that the "response" is returned prematurely. 


This NullPointerException will propagate all the way up to 
IOReactorExceptionHandler "handle(RuntimeException ex);", where you only have 
two options, ignore it or shutdown the whole IoReactor (neither of the two is 
good for us). I guess the root problem is that we should never see that NPE. 


Is there any more information I can provide to help address this problem?

thanks,
Yong


  

-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



Re: Retrieving the underlying Socket from HttpClient

2009-06-03 Thread Oleg Kalnichevski
On Wed, Jun 03, 2009 at 03:00:31PM +0200, Guy wrote:
> Hi all,
> 
> I was wondering if there is a way to retrieve the Socket (and therefore the
> SSLSession if using SSL) from a connection.
> 
> I noticed there is a protected getSocket() method in the HttpConnetion
> class, but since this method is protected and not public it is no good for
> me (or can I somehow make HttpClient use a custom HttpConnection object).
> 
> The reason I ask is I want to monitor X509 Certificates used on the server
> side. I know it is much easier to do with a (custom- SSLSocketFactory and
> use SSLSockets from the socketfactory, but I need the proxy functionality
> build in HttpClient and it is not that easy to connect through a proxy that
> uses authentication if you stick with sockets (or at least not easy for me
> :-) )
> 
> any help would be appreciated.
> 
> kind regards
> 
> Guy

You are out of luck with HttpClient 3.x. If you do not mind upgrading to
HttpClient 4.0 you could have a complete control over the process of socket
initialization by using a custom ClientConnectionOperator implementation.

Oleg



-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



Retrieving the underlying Socket from HttpClient

2009-06-03 Thread Guy
Hi all,

I was wondering if there is a way to retrieve the Socket (and therefore the
SSLSession if using SSL) from a connection.

I noticed there is a protected getSocket() method in the HttpConnetion
class, but since this method is protected and not public it is no good for
me (or can I somehow make HttpClient use a custom HttpConnection object).

The reason I ask is I want to monitor X509 Certificates used on the server
side. I know it is much easier to do with a (custom- SSLSocketFactory and
use SSLSockets from the socketfactory, but I need the proxy functionality
build in HttpClient and it is not that easy to connect through a proxy that
uses authentication if you stick with sockets (or at least not easy for me
:-) )

any help would be appreciated.

kind regards

Guy