您的位置:首页 > 产品设计 > UI/UE

关于错误:java.net.BindException: Cannot assign requested address

2012-06-05 14:30 375 查看
最近在centOS上面做j2ee开发,当启动tomcat7.0的时候总是报如下错误:

严重: StandardServer.await: create[localhost:8005]:

java.net.BindException: Cannot assign requested address

at java.net.PlainSocketImpl.socketBind(Native Method)

at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)

at java.net.ServerSocket.bind(ServerSocket.java:328)

at java.net.ServerSocket.<init>(ServerSocket.java:194)

at org.apache.catalina.core.StandardServer.await(StandardServer.java:427)

at org.apache.catalina.startup.Catalina.await(Catalina.java:757)

at org.apache.catalina.startup.Catalina.start(Catalina.java:703)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)

2012-6-5 21:07:21 org.apache.coyote.AbstractProtocol pause

信息: Pausing ProtocolHandler ["http-bio-8080"]

Hibernate: select name from server_info

Hibernate: select clusterinf0_.id as id1_, clusterinf0_.name as name1_ from cluster_info clusterinf0_

2012-6-5 21:07:23 org.apache.coyote.AbstractProtocol pause

信息: Pausing ProtocolHandler ["http-bio-8443"]

2012-6-5 21:07:25 org.apache.coyote.AbstractProtocol pause

信息: Pausing ProtocolHandler ["ajp-bio-8009"]

2012-6-5 21:07:27 org.apache.catalina.core.StandardService stopInternal

信息: Stopping service Catalina

2012-6-5 21:07:27 org.apache.catalina.core.ApplicationContext log

信息: Closing Spring root WebApplicationContext

2012-6-5 21:07:27 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc

严重: The web application [/glustermg] registered the JDBC driver [org.apache.derby.jdbc.AutoloadedDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

2012-6-5 21:07:27 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

严重: The web application [/glustermg] created a ThreadLocal with key of type [org.apache.derby.iapi.sql.dictionary.TableDescriptor$1] (value [org.apache.derby.iapi.sql.dictionary.TableDescriptor$1@73abdb5e]) and a value of type [java.util.WeakHashMap] (value [{}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

2012-6-5 21:07:27 org.apache.coyote.AbstractProtocol stop

信息: Stopping ProtocolHandler ["http-bio-8080"]

2012-6-5 21:07:29 org.apache.coyote.AbstractProtocol stop

信息: Stopping ProtocolHandler ["http-bio-8443"]

2012-6-5 21:07:31 org.apache.coyote.AbstractProtocol stop

信息: Stopping ProtocolHandler ["ajp-bio-8009"]

2012-6-5 21:07:33 org.apache.coyote.AbstractProtocol destroy

信息: Destroying ProtocolHandler ["http-bio-8080"]

2012-6-5 21:07:33 org.apache.coyote.AbstractProtocol destroy

信息: Destroying ProtocolHandler ["http-bio-8443"]

2012-6-5 21:07:33 org.apache.coyote.AbstractProtocol destroy

信息: Destroying ProtocolHandler ["ajp-bio-8009"]

在网上找了很多解决方法,都没有解决,然后我以后是项目工程改动的错误,但将项目从tomcat中去除后重启,还是不行,上网也有说是tomcat7的新问题,我换成6.0的版本后,还是不行,最后才记得可能是网络设置错误,我的解决方法出下:编辑/etc/hosts文件:

vim /etc/hosts

10.11.2.180 istore01 localhost

10.11.2.201 Dev01

10.11.2.202 Dev02

~
检查这里的IP地址是否和当前实际的地址相同,如果不相同,则改为当前的IP,我的情况就是本来我的IP是10.11.2.180的,但这个文件中记录的是192.168.0.180。这下找到这个问题了,记录在这里,让遇到相同问题的朋友也能快速解决问题。对了,以后我得养成写文章的习惯 了,帮助别人的同时也能对自己加深印象,虽然多花了点时间,我觉得还是值得的!!希望对有帮助的朋友回复下啊:)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐