我已经创建了一个基于spring引导的应用程序,它的application.yml文件如下所示:
server:
port: 8108
tomcat:
remote_ip_header: x-forwarded-for
protocol_header: x-forwarded-proto它还运行在https端口上。我在云铸造厂中部署了这个应用程序,它成功地部署并运行在https url上,并且运行良好。
现在,我用下面的配置为这个应用程序创建了dockerfile:
FROM frolvlad/alpine-oraclejdk8
VOLUME /tmp
ADD <name-of-jar>.jar aap.jar
EXPOSE 8108
ENTRYPOINT ["java","-jar","/aap.jar"]并使用以下命令将其推送到云铸造厂,并启用了docker:
cf推送-m 2g --对接者-图像/:-停靠者-用户名
它成功地部署并启动,但是当我试图通过它的URL访问它时:
https://
我不例外:
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT 12:33:52.488 [DEBUG] [ ] [-exec-7] [ org.apache.tomcat.util.net.NioEndpoint]: Error during SSL handshake
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at sun.security.ssl.EngineInputRecord.bytesInCompletePacket(EngineInputRecord.java:156)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1411)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT 12:33:52.488 [DEBUG] [ ] [-exec-7] [ org.apache.tomcat.util.net.NioEndpoint]: Failed to close socket
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:270)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SecureNioChannel.close(SecureNioChannel.java:518)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.NioEndpoint$Poller.cancelledKey(NioEndpoint.java:729)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:461)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SecureNioChannel.close(SecureNioChannel.java:508)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SecureNioChannel.flush(SecureNioChannel.java:143)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.NioEndpoint.access$500(NioEndpoint.java:69)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.NioEndpoint.close(NioEndpoint.java:507)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at java.lang.Thread.run(Thread.java:748)
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT 12:33:52.488 [DEBUG] [ ] [-exec-7] [ org.apache.tomcat.util.threads.LimitLatch]: Counting down[https-jsse-nio-8108-exec-7] latch=1
2017-10-26T18:03:52.48+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT 12:33:52.494 [DEBUG] [ ] [-exec-8] [ org.apache.tomcat.util.net.SecureNioChannel]: The SNI host name extracted for this connection was [null]
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT 12:33:52.494 [DEBUG] [ ] [eptor-0] [ org.apache.tomcat.util.threads.LimitLatch]: Counting up[https-jsse-nio-8108-Acceptor-0] latch=1
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT 12:33:52.495 [DEBUG] [ ] [-exec-8] [ org.apache.tomcat.util.net.NioEndpoint]: Error during SSL handshake
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at sun.security.ssl.EngineInputRecord.bytesInCompletePacket(EngineInputRecord.java:156)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SecureNioChannel.handshake(SecureNioChannel.java:232)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SecureNioChannel.handshakeUnwrap(SecureNioChannel.java:459)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1411)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at java.lang.Thread.run(Thread.java:748)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT java.nio.channels.ClosedChannelException: null
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:270)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SecureNioChannel.flush(SecureNioChannel.java:143)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:461)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SecureNioChannel.close(SecureNioChannel.java:508)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SecureNioChannel.close(SecureNioChannel.java:518)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.NioEndpoint$Poller.cancelledKey(NioEndpoint.java:729)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.NioEndpoint.close(NioEndpoint.java:507)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
2017-10-26T18:03:52.49+0530 [APP/PROC/WEB/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)为了解决我的dockerfile公开部分中的这个问题,除了已经运行的端口之外,我还提到了443端口,但是docker部署失败,并报告了443端口的错误。
发布于 2017-10-29 00:50:31
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?和Error during SSL handshake看起来像是在监听HTTPS请求,但是传入的请求不是HTTPS (见下文)。看看你的应用程序的配置,看看为什么。我看不出您发布的配置片段可以说明为什么启用了HTTPS,但这是通常为Spring应用程序启用HTTPS的配置。
对于Cloud,应用程序应该侦听HTTP请求。目前,外部负载均衡器或GoRouter将终止HTTPS请求,并通过HTTP与所有应用程序对话。
https://docs.cloudfoundry.org/concepts/http-routing.html#tls
如果您想让TLS/HTTPS直接到您的应用程序,那么您目前需要使用TCP路由。
https://docs.cloudfoundry.org/adminguide/enabling-tcp-routing.html#ports
希望这能帮上忙!
https://stackoverflow.com/questions/46957243
复制相似问题