Memory error when trying to change Apache Tomcat p

2019-02-25 23:32发布

I'm trying to get my installation of Tomcat on a VPS to run on port 80 instead of 8080, but when I edit the settings for the server.xml file in my Tomcat directory, and try to restart Tomcat, I'm getting this error:

Jan 23, 2012 9:55:46 AM org.apache.coyote.http11.Http11Protocol init SEVERE: Error initializing endpoint java.net.SocketException: Cannot allocate memory at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:353) at java.net.ServerSocket.bind(ServerSocket.java:336) at java.net.ServerSocket.(ServerSocket.java:202) at java.net.ServerSocket.(ServerSocket.java:158) at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50) at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538) at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176) at org.apache.catalina.connector.Connector.initialize(Connector.java:1014) at org.apache.catalina.core.StandardService.initialize(StandardService.java:680) at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795) at org.apache.catalina.startup.Catalina.load(Catalina.java:524) at org.apache.catalina.startup.Catalina.load(Catalina.java:548) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Jan 23, 2012 9:55:46 AM org.apache.catalina.startup.Catalina load SEVERE: Catalina.start LifecycleException: Protocol handler initialization failed: java.net.SocketException: Cannot allocate memory at org.apache.catalina.connector.Connector.initialize(Connector.java:1016) at org.apache.catalina.core.StandardService.initialize(StandardService.java:680) at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795) at org.apache.catalina.startup.Catalina.load(Catalina.java:524) at org.apache.catalina.startup.Catalina.load(Catalina.java:548) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

Not really sure what that means... Does it mean I don't have enough memory? Are there alternative ways to get Tomcat to run on port 80?

Edit: Here is the output when I type in free -m:

total       used       free     shared    buffers     cached
Mem:   1024        748        275          0          0          0
-/+ buffers/cache:   748        275
Swap:   0          0          0

1条回答
Anthone
2楼-- · 2019-02-26 00:17

I got the same issue with Tomcat on OpenVZ using authbind to run on port 80. I solved it by switching from OpenJDK to Sun Java.

查看更多
登录 后发表回答