What I need to do is run a Java application, which is a link to the Restlet's RESTful server server. And this service will be called by another application running on Google App Engine.
Due to the GAE limitation, every HTTP call is limited to ports 80 and 443 (http and https) with the HttpUrlConnection class. As a result, I have to deploy the server-side application on port 80 or 443.
However, since the application is running on Ubuntu, and those ports under 1024 cannot be accessed by a non-root user, then when launching my application, an Access Denied exception will be thrown.
The solutions that came to my mind include:
Changing the JRE security policy, which is a file, is located in /lib/security/java.policy, for grantjava.net.SocketPermission "* .80" "listen, connect, accept, allow" permission. However, without using the command line to include this file or overriding the contents in the JRE java.policy file, the same exception continues to be thrown.
try logging in as the root user, however, due to my unfamiliarity with Unix, I don't know how to do this.
another solution that I have not tried is to match all calls from 80 to a higher port, such as 1234, then I can deploy my application to 1234 without problems, and the request to send a GAE request to port 80. But how to connect the missing space is still a problem.
I am currently using the “hack” method, which is to pack the application into a jar file and sudo run the jar file with root privileges. It works now, but it is definitely not suitable in a real deployment environment.
So, if anyone knows about a solution, thank you very much!
java ubuntu port
Yudong li
source share