title: Opening port 80 with Java application on Ubuntu
body: <p>What I need to do is running a Java application which is a RESTful service server side writtern by Restlet. And this service will be called by another app running on Google App Engine.</p>
  
  <p>Because of the restriction of GAE, every http call is limited to port 80 and 443 (http and https) with HttpUrlConnection class. As a result, I have to deploy my server side application on port 80 or 443.</p>
  
  <p>However, because the app is running on Ubuntu, and those ports under 1024 cannot be accessed by non-root user, then a Access Denied exception will be thrown when I run my app.</p>
  
  <p>The solutions that have come into my mind includes:</p>
  
  <ol>
  <li><p>Changing the security policy of JRE, which is the files resides in /lib/security/java.policy, to grantjava.net.SocketPermission "*.80" "listen, connect, accept, resolve" permission。However, neither using command line to include this file or overrides the content in JRE's java.policy file, the same exception keeps coming out.</p></li>
  <li><p>try to login as a root user, however because my unfamiliarity with Unix, I don't know how to do it.</p></li>
  <li><p>another solution I haven't try is to map all calls to 80 to a higher port like 1234, then I can deploy my app on 1234 without problem, and GAE call send request to port 80. But how to connect the missing gap is still a problem.</p></li>
  </ol>
  
  <p>Currently I am using a "hacking" method, which is to package the application into a jar file, and sudo running the jar file with root privilege. It works now, but definitely not appropriate in the real deployment environment. </p>
  
  <p>So if anyone have any idea about the solution, thanks very much!</p>