1

我的应用程序(用 Java Servlets 和 jquery 编写)在我的本地机器上运行良好,但是当我在 Openshift 上部署它时,它会java.net.BindException: Permission denied在 youtube API 的身份验证步骤中抛出。

下面,我发布了与异常相关的代码(取自 google api 网站)。我尝试更改端口号,但似乎没有任何效果。

// Build the local server and bind it to port 8080
LocalServerReceiver localReceiver = new LocalServerReceiver.Builder().setPort(45205).build();

// Authorize.
return new AuthorizationCodeInstalledApp(flow, localReceiver).authorize("user");

有没有办法解决这个问题?我一直在尝试解决这一天,但没有运气。任何帮助解决这个问题都非常感谢!

完整的异常细节:

2016-07-07 03:35:30.388:WARN::failed SocketConnector@localhost:45205: java.net.BindException: Permission denied
2016-07-07 03:35:30.390:WARN::failed Server@4486db: java.net.BindException: Permission denied
2016-07-07 03:35:30.391:INFO::Stopped SocketConnector@localhost:45205
java.io.IOException: java.net.BindException: Permission denied
        at com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver.getRedirectUri(LocalServerReceiver.java:107)
        at com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp.authorize(AuthorizationCodeInstalledApp.java:76)
        at sam.ut.Auth.authorize(Auth.java:76)
        at sam.ut.CommentThreads.<clinit>(CommentThreads.java:42)
        at youtubeapp.servletes.HomePageServlet.doGet(HomePageServlet.java:70)
        at youtubeapp.servletes.HomePageServlet.doPost(HomePageServlet.java:152)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1042)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.BindException: Permission denied
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
        at java.net.ServerSocket.bind(ServerSocket.java:376)
        at java.net.ServerSocket.<init>(ServerSocket.java:237)
        at org.mortbay.jetty.bio.SocketConnector.newServerSocket(SocketConnector.java:80)
        at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
        at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:283)
        at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:147)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at org.mortbay.jetty.Server.doStart(Server.java:235)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver.getRedirectUri(LocalServerReceiver.java:104)
        ... 27 mor
4

0 回答 0