问题
hi i have installed glassfish on windows 8 . i am trying to start glassfish server but it just doesnt start.
Starting domain
_______________
Executing command :C:\glassfish4\glassfish\bin\asadmin.bat start-domain domain1
C:\glassfish4\glassfish\bin\asadmin.bat start-domain domain1
Attempting to start domain1.... Please look at the server log for more details.....
when i see the logs it prints
Shutting down server due to startup exception
java.net.SocketException: Permission denied: listen
at sun.nio.ch.Net.listen(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:200)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bindToChannelAndAddress(TCPNIOBindingHandler.java:131)
at org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler.bind(TCPNIOBindingHandler.java:87)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:450)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:439)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.bind(TCPNIOTransport.java:95)
at org.glassfish.grizzly.config.GenericGrizzlyListener.start(GenericGrizzlyListener.java:168)
at com.sun.enterprise.v3.services.impl.GlassfishNetworkListener.start(GlassfishNetworkListener.java:94)
at com.sun.enterprise.v3.services.impl.GrizzlyProxy.start(GrizzlyProxy.java:230)
at com.sun.enterprise.v3.services.impl.GrizzlyService.createNetworkProxy(GrizzlyService.java:470)
at com.sun.enterprise.v3.services.impl.GrizzlyService.postConstruct(GrizzlyService.java:393)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:281)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:328)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:163)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:93)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:673)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:660)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpOneJob.run(CurrentTaskFuture.java:490)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpAllTheWay.go(CurrentTaskFuture.java:362)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$UpAllTheWay.access$100(CurrentTaskFuture.java:279)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture.go(CurrentTaskFuture.java:113)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.proceedTo(AsyncRunLevelContext.java:296)
at org.glassfish.hk2.runlevel.internal.RunLevelControllerImpl.proceedTo(RunLevelControllerImpl.java:66)
at com.sun.enterprise.v3.server.AppServerStartup.proceedTo(AppServerStartup.java:532)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:329)
at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:226)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:217)
at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
at com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl.start(EmbeddedOSGiGlassFishImpl.java:75)
at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:71)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)
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:601)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
]]
i Tried many solutions but still no luck. i tried to Edit the Host file and enter the following to it
127.0.0.1 localhost myhostnamw
but still the problem persists. Do anyone know whats the problem
回答1:
I had the same error but on Ubuntu.
After som googeling I think I figured it out. I tried to run glassfish with a non-root user. Running it with Root works, but not with my newly created glassfish-user. This is because only root can run ports lower than 1024... and I had set my glassfish to run on port 80.
So the conjunction of using non-root user + having glassfish on port < 1024. Perhaps this helps someone at least.
There was a suggestion on google to add an apache server with some reverse-proxy-whatever in front of glassfish if you absolutely want to run it on port 80. Alternative change some ip-tables as to route traffic from port 80 to 8080.
回答2:
This problem looks like it is related to this bug.
As described in the jira comments you should check if nslookup
is working on your hostname by entering the following commands in the cmd:
c:\hostname
yourHostname
c:\nslookup yourHostname
...
If the nslookup
fails this is also the reason why Glassfish can't start.
As you described you have edited the hosts file. Make sure, you really edited the file Windows\system32\drivers\etc\hosts
and added an entry like this:
127.0.0.1 yourHostname
with the hostname output from the hostname
command. Check that you saved the file in the right way without any filename extension.
If this really doesn't help make sure you don't have any firewall/anti-virus software blocking the ports.
Related question: Glassfish can't start up on Windows 8
回答3:
Had the same error log as yours. Solved by adding -Djava.net.preferIPv4Stack=true to the last line in the asadmin script
回答4:
problem solved by
- check if you have another server running or anything that uses the glassfish port then close it
- end all java tasks
- restart glassfish server
回答5:
This is normaly caused because of a HTTP listenner configured with a number below 1024. Linux only allow root processes run binded to these ports.
Go to the file domain.xml
that it's inside you/glasfish/path/glassfish4/glassfish/domains/your.domain.com/config
Inside domain.xml
look for the <network-listeners>
tag and change the property port
.
来源:https://stackoverflow.com/questions/20776798/glassfish-server-doesnt-start-java-net-socketexception-permission-denied-lis