Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Need help with embedded Jetty Proxy Server


Hi All,

On enabling log, I see following exception.

2013-07-23 13:58:37.104:INFO:oejs.AbstractConnector:Started SslSelectChannelConnector@127.0.0.1:443
2013-07-23 13:58:41.015:DBUG:oeji.nio:created SCEP@18a178a{l(/127.0.0.1:57008)<->r(/127.0.0.1:443),s=0,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=0}-{SslConnection@10f93f9 SSL NOT_HANDSHAKING i/o/u=-1/-1/-1 ishut=false oshut=false {AsyncHttpConnection@13503e5,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0}}
2013-07-23 13:58:41.016:DBUG:oeji.nio:created SCEP@12c85f1{l(/127.0.0.1:57009)<->r(/127.0.0.1:443),s=0,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=0}-{SslConnection@11c3288 SSL NOT_HANDSHAKING i/o/u=-1/-1/-1 ishut=false oshut=false {AsyncHttpConnection@317dc9,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0}}
2013-07-23 13:58:41.016:DBUG:oejin.ssl:[Session-1, SSL_NULL_WITH_NULL_NULL] SslConnection@10f93f9 SSL NOT_HANDSHAKING i/o/u=212/0/0 ishut=false oshut=false {AsyncHttpConnection@13503e5,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0} NOT_HANDSHAKING filled=212/212 flushed=0/0
2013-07-23 13:58:41.021:DBUG:oejin.ssl:[Session-1, SSL_NULL_WITH_NULL_NULL] SslConnection@11c3288 SSL NOT_HANDSHAKING i/o/u=0/0/0 ishut=false oshut=false {AsyncHttpConnection@317dc9,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0} NOT_HANDSHAKING filled=0/0 flushed=0/0
2013-07-23 13:58:41.026:DBUG:oejin.ssl:[Session-1, SSL_NULL_WITH_NULL_NULL] SslConnection@11c3288 SSL NOT_HANDSHAKING i/o/u=0/0/0 ishut=false oshut=false {AsyncHttpConnection@317dc9,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0} NOT_HANDSHAKING filled=0/0 flushed=0/0
2013-07-23 13:58:41.026:DBUG:oejin.ssl:[Session-1, SSL_NULL_WITH_NULL_NULL] handle SslConnection@11c3288 SSL NOT_HANDSHAKING i/o/u=0/0/0 ishut=false oshut=false {AsyncHttpConnection@317dc9,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0} progress=false
2013-07-23 13:58:41.031:DBUG:oejin.ssl:SCEP@18a178a{l(/127.0.0.1:57008)<->r(/127.0.0.1:443),s=1,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=0}-{SslConnection@10f93f9 SSL NEED_WRAP i/o/u=212/0/0 ishut=false oshut=false {AsyncHttpConnection@13503e5,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0}}
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
    at sun.security.ssl.EngineInputRecord.bytesInCompletePacket(Unknown Source)
    at sun.security.ssl.SSLEngineImpl.readNetRecord(Unknown Source)
    at sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source)
    at javax.net.ssl.SSLEngine.unwrap(Unknown Source)
    at org.eclipse.jetty.io.nio.SslConnection.unwrap(SslConnection.java:536)
    at org.eclipse.jetty.io.nio.SslConnection.process(SslConnection.java:359)
    at org.eclipse.jetty.io.nio.SslConnection.access$900(SslConnection.java:48)
    at org.eclipse.jetty.io.nio.SslConnection$SslEndPoint.fill(SslConnection.java:678)
    at org.eclipse.jetty.http.HttpParser.fill(HttpParser.java:1044)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:280)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:196)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Unknown Source)
2013-07-23 13:58:41.031:DBUG:oejin.ChannelEndPoint:close SCEP@18a178a{l(/127.0.0.1:57008)<->r(/127.0.0.1:443),s=1,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=0!}-{SslConnection@10f93f9 SSL NEED_WRAP i/o/u=212/0/0 ishut=false oshut=false {AsyncHttpConnection@13503e5,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0}}
2013-07-23 13:58:41.031:DBUG:oeji.nio:destroyEndPoint SCEP@18a178a{l(null)<->r(0.0.0.0/0.0.0.0:443),s=1,open=false,ishut=true,oshut=true,rb=false,wb=false,w=true,i=0!}-{SslConnection@10f93f9 SSL NEED_WRAP i/o/u=212/0/0 ishut=false oshut=false {AsyncHttpConnection@13503e5,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0}}


Can someone suggest the reason behind this exception?

Thanks for all the inputs,
Shiv



On Tue, Jul 23, 2013 at 10:06 AM, Shiv Kumbhar <shivshankar.k@xxxxxxxxx> wrote:
Thanks Simone for the response.

I tried the example you that pointed, but the result is same.
When I use Ssl ( I added SslSelectChannelConnector for it and provided CA signed certificate), it does not bring the secured pages.

This pages work :-  http://www.google.com
This page doesn't work : https://www.google.com

I also tried whitelisted other ssl pages, but no luck.

Please see code below and let me know if I am missing something ?

Also, I extended SslSelectChannelConnector just to add some logging. I see that it accept() and open() the connection, but then immediately close() the connection.

Where can I get the logs for connector operations ?

Here is the code that I tried.


        Server server = new Server();
        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(8080);
        server.addConnector(connector);


        SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
        ssl_connector.setPort(8443);
        SslContextFactory cf = ssl_connector.getSslContextFactory();
        cf.setKeyStorePath(".\\cert\\Jetty.jks");
        cf.setKeyStoreType(KeyStore.getDefaultType());
        //cf.setCertAlias("Jetty");
        cf.setKeyStorePassword("password");
        cf.setKeyManagerPassword("password");
        server.addConnector(ssl_connector);

        HandlerCollection handlers = new HandlerCollection();
        server.setHandler(handlers);

        // Setup proxy servlet
        ServletContextHandler context = new ServletContextHandler(handlers, "/", ServletContextHandler.SESSIONS);
        ServletHolder proxyServlet = new ServletHolder(ProxyServlet.class);
        proxyServlet.setInitParameter("whiteList","google.com, www.eclipse.org, localhost");
        proxyServlet.setInitParameter("blackList","google.com/calendar/*, www.eclipse.org/committers/");
        context.addServlet(proxyServlet, "/*");

        // Setup proxy handler to handle CONNECT methods
        ConnectHandler proxy = new ConnectHandler();
        proxy.setWhite(new String[] { "mail.google.com" });
        proxy.addWhite("www.google.com");
        handlers.addHandler(proxy);

        server.start();


Thanks,
Shiv



On Tue, Jul 23, 2013 at 1:07 AM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
Hi,

On Mon, Jul 22, 2013 at 7:56 PM, Shiv Kumbhar <shivshankar.k@xxxxxxxxx> wrote:
> Hi All,
>
> I need to create a Proxy Server using Jetty that should for HTTP and HTTPS
> urls. I followed the example in
> http://download.eclipse.org/jetty/stable-7/xref/org/eclipse/jetty/embedded/ManyConnectors.html.
> I could get the Proxy working for HTTP but not for HTTPS.

Please use http://download.eclipse.org/jetty/stable-7/xref/org/eclipse/jetty/embedded/ProxyServer.html.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top