Sonatype products are heavily dependent on the Hypertext Transport Protocol (HTTP) and Transport Layer Security (TLS). These protocols need to successfully navigate through complex organizational network infrastructures and occasionally experience problems which are better debugged in isolation from a Sonatype product experiencing a related problem.
Sonatype products are also Java based and use common HTTP client shared libraries. Sometimes particular issues need to be replicated with specific Java or HTTP client versions.
To aid this advanced debugging, Sonatype Support has written a tool offering a Java based pseudo client which can help isolate the root cause of a networking related problem.
When should I use urlpoke?
The tool is typically used on the advice of Sonatype Support staff.
While trivial to use, it should be considered one of the last resorts needed after the more common debugging techniques of examining product logs have not provided enough info.
What does urlpoke do?
The urlpoke.jar is a simple Java based program can make a socket connection and/or HTTP/TLS connection to a remote host that you specify. Features include:
- plain TCP and secure TLS socket connections
- plain http and secure https HEAD, GET connections
- http proxy server support
- basic http proxy and target URL authentication
Why use urlpoke instead of ...?
This tool was created by Sonatype support staff to help diagnose common networking problems our server products encounter. Sometimes debugging problems in a production server product can be simplified by using a standalone client making similar requests the server products make. Experience has also shown that some networking issues are only reproducible using specific Java client libraries and versions that closely match those used by Sonatype products.
Requirements
The urlpoke.jar requires Java 8 or greater. Typically you want to ensure that the exact same Java runtime used to run a Sonatype product experiencing a problem is also used to execute urlpoke.
Ideally run this tool on the same host and user where the Sonatype product experiencing the problem is located. This reduces the variables which could be contributing to a product problem.
How to use it
Use the java command to launch the jar file with program arguments. Typically all output from stderr/stdout is redirected to a file (Unix / Windows), then the contents of the resulting file should be examined in a text editor to diagnose problems.
Unix Terminal Example
java -jar urlpoke.jar https://www.sonatype.com &> urlpoke.log
Windows Command Prompt Example
java -jar urlpoke.jar https://www.sonatype.com 1> urlpoke.log 2>&1
Program Help
The jar is a self contained executable. To get help, simply launch it without arguments, or specify the -? argument:
java -jar urlpoke.jar ==[12:06:40:809] [INFO] org.sonatype.support.urlpoke.URLPoke - 2020-06-12 15:06:40,808+0000 ==[12:06:40:813] [INFO] org.sonatype.support.urlpoke.URLPoke - 61a5f55492a28bdb1c7685ff2aa2747aa0db1487 (202006121206) ==[12:06:40:938] [INFO] org.sonatype.support.urlpoke.URLPoke - Java Cryptography Extension (JCE) detected? - true (2147483647) ==[12:06:40:938] [ERROR] org.sonatype.support.urlpoke.URLPoke - Main parameters are required ("<target URI>") ==[12:06:40:940] [ERROR] org.sonatype.support.urlpoke.URLPoke - Usage: java -jar urlpoke.jar [options] <target URI> Options: -p, --proxy HTTP Proxy, format <host:port>. Host and port is required. -U, --proxy-user Credentials for HTTP proxy, format <username:password> --logfile Log all output to the specified file. --http-methods HTTP methods for poke. Supported: [HEAD, GET]. Default: [HEAD, GET] --http-auth-schemes HTTP client preferred auth schemes. Supported: [NTLM,Negotiate,Digest,Basic,Kerberos,CredSSP]. Default: [NTLM, Negotiate, Digest, Basic] --no-debug-props Do not log effective system properties. Default: false --no-debug-http Do not log HTTP headers. Default: false --debug-ssl Sets system prop javax.net.debug=ssl Default: false --debug-all Sets system prop javax.net.debug=all Default: false -h, -?, --help Show this help screen