lealone / Lealone

比 MySQL 和 MongoDB 快10倍的 OLTP 关系数据库和文档数据库
Other
2.47k stars 518 forks source link

java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster #68

Closed afushengli closed 9 years ago

afushengli commented 10 years ago

2014-03-31 00:08:31,228 INFO [Thread-0] zookeeper.Environment(98): Server environment:zookeeper.version=3.4.3-1240972, built on 02/06/2012 10:48 GMT 2014-03-31 00:08:31,269 INFO [Thread-0] zookeeper.Environment(98): Server environment:host.name=master 2014-03-31 00:08:31,269 INFO [Thread-0] zookeeper.Environment(98): Server environment:java.version=1.7.0_45 2014-03-31 00:08:31,288 INFO [Thread-0] zookeeper.Environment(98): Server environment:java.vendor=Oracle Corporation 2014-03-31 00:08:31,289 INFO [Thread-0] zookeeper.Environment(98): Server environment:java.home=/usr/java/jdk1.7.0_45/jre 2014-03-31 00:08:31,289 INFO [Thread-0] zookeeper.Environment(98): Server environment:java.class.path=/home/hadoop/Desktop/Lealone-master/lealone-test/target/test-classes:/home/hadoop/Desktop/Lealone-master/lealone-test/target/classes:/home/hadoop/Desktop/Lealone-master/lealone-hbase/target/classes:/home/hadoop/Desktop/Lealone-master/lealone-sql/target/classes:/home/hadoop/Desktop/Lealone-master/lealone-client/target/classes:/home/hadoop/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/home/hadoop/.m2/repository/org/apache/hbase/hbase/0.94.2/hbase-0.94.2.jar:/home/hadoop/.m2/repository/com/yammer/metrics/metrics-core/2.1.2/metrics-core-2.1.2.jar:/home/hadoop/.m2/repository/com/google/guava/guava/11.0.2/guava-11.0.2.jar:/home/hadoop/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/home/hadoop/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar:/home/hadoop/.m2/repository/commons-configuration/commons-configuration/1.6/commons-configuration-1.6.jar:/home/hadoop/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/home/hadoop/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar:/home/hadoop/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:/home/hadoop/.m2/repository/commons-beanutils/commons-beanutils-core/1.8.0/commons-beanutils-core-1.8.0.jar:/home/hadoop/.m2/repository/com/github/stephenc/high-scale-lib/high-scale-lib/1.1.1/high-scale-lib-1.1.1.jar:/home/hadoop/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/home/hadoop/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar:/home/hadoop/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/hadoop/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar:/home/hadoop/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar:/home/hadoop/.m2/repository/org/apache/avro/avro/1.5.3/avro-1.5.3.jar:/home/hadoop/.m2/repository/org/xerial/snappy/snappy-java/1.0.3.2/snappy-java-1.0.3.2.jar:/home/hadoop/.m2/repository/org/apache/avro/avro-ipc/1.5.3/avro-ipc-1.5.3.jar:/home/hadoop/.m2/repository/org/jboss/netty/netty/3.2.4.Final/netty-3.2.4.Final.jar:/home/hadoop/.m2/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar:/home/hadoop/.m2/repository/org/apache/zookeeper/zookeeper/3.4.3/zookeeper-3.4.3.jar:/home/hadoop/.m2/repository/org/apache/thrift/libthrift/0.8.0/libthrift-0.8.0.jar:/home/hadoop/.m2/repository/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar:/home/hadoop/.m2/repository/org/apache/httpcomponents/httpcore/4.1.3/httpcore-4.1.3.jar:/home/hadoop/.m2/repository/org/jruby/jruby-complete/1.6.5/jruby-complete-1.6.5.jar:/home/hadoop/.m2/repository/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26.jar:/home/hadoop/.m2/repository/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26.jar:/home/hadoop/.m2/repository/org/mortbay/jetty/jsp-2.1/6.1.14/jsp-2.1-6.1.14.jar:/home/hadoop/.m2/repository/org/mortbay/jetty/jsp-api-2.1/6.1.14/jsp-api-2.1-6.1.14.jar:/home/hadoop/.m2/repository/org/mortbay/jetty/servlet-api-2.5/6.1.14/servlet-api-2.5-6.1.14.jar:/home/hadoop/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.8.8/jackson-core-asl-1.8.8.jar:/home/hadoop/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.8.8/jackson-mapper-asl-1.8.8.jar:/home/hadoop/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.8.8/jackson-jaxrs-1.8.8.jar:/home/hadoop/.m2/repository/org/codehaus/jackson/jackson-xc/1.8.8/jackson-xc-1.8.8.jar:/home/hadoop/.m2/repository/org/slf4j/slf4j-api/1.4.3/slf4j-api-1.4.3.jar:/home/hadoop/.m2/repository/org/slf4j/slf4j-log4j12/1.4.3/slf4j-log4j12-1.4.3.jar:/home/hadoop/.m2/repository/tomcat/jasper-compiler/5.5.23/jasper-compiler-5.5.23.jar:/home/hadoop/.m2/repository/tomcat/jasper-runtime/5.5.23/jasper-runtime-5.5.23.jar:/home/hadoop/.m2/repository/org/jamon/jamon-runtime/2.3.1/jamon-runtime-2.3.1.jar:/home/hadoop/.m2/repository/com/google/protobuf/protobuf-java/2.4.0a/protobuf-java-2.4.0a.jar:/home/hadoop/.m2/repository/com/sun/jersey/jersey-core/1.8/jersey-core-1.8.jar:/home/hadoop/.m2/repository/com/sun/jersey/jersey-json/1.8/jersey-json-1.8.jar:/home/hadoop/.m2/repository/org/codehaus/jettison/jettison/1.1/jettison-1.1.jar:/home/hadoop/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb-impl-2.2.3-1.jar:/home/hadoop/.m2/repository/com/sun/jersey/jersey-server/1.8/jersey-server-1.8.jar:/home/hadoop/.m2/repository/asm/asm/3.1/asm-3.1.jar:/home/hadoop/.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar:/home/hadoop/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/home/hadoop/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/home/hadoop/.m2/repository/org/apache/hadoop/hadoop-core/1.0.4/hadoop-core-1.0.4.jar:/home/hadoop/.m2/repository/xmlenc/xmlenc/0.52/xmlenc-0.52.jar:/home/hadoop/.m2/repository/org/apache/commons/commons-math/2.1/commons-math-2.1.jar:/home/hadoop/.m2/repository/commons-net/commons-net/1.4.1/commons-net-1.4.1.jar:/home/hadoop/.m2/repository/commons-el/commons-el/1.0/commons-el-1.0.jar:/home/hadoop/.m2/repository/net/java/dev/jets3t/jets3t/0.7.1/jets3t-0.7.1.jar:/home/hadoop/.m2/repository/net/sf/kosmosfs/kfs/0.3/kfs-0.3.jar:/home/hadoop/.m2/repository/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.jar:/home/hadoop/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar:/home/hadoop/.m2/repository/org/eclipse/jdt/core/3.1.1/core-3.1.1.jar:/home/hadoop/.m2/repository/junit/junit/4.8/junit-4.8.jar 2014-03-31 00:08:31,289 INFO [Thread-0] zookeeper.Environment(98): Server environment:java.library.path=:/usr/local/protobuf/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib 2014-03-31 00:08:31,289 INFO [Thread-0] zookeeper.Environment(98): Server environment:java.io.tmpdir=/tmp 2014-03-31 00:08:31,289 INFO [Thread-0] zookeeper.Environment(98): Server environment:java.compiler= 2014-03-31 00:08:31,289 INFO [Thread-0] zookeeper.Environment(98): Server environment:os.name=Linux 2014-03-31 00:08:31,289 INFO [Thread-0] zookeeper.Environment(98): Server environment:os.arch=amd64 2014-03-31 00:08:31,290 INFO [Thread-0] zookeeper.Environment(98): Server environment:os.version=2.6.32-431.el6.x86_64 2014-03-31 00:08:31,290 INFO [Thread-0] zookeeper.Environment(98): Server environment:user.name=hadoop 2014-03-31 00:08:31,290 INFO [Thread-0] zookeeper.Environment(98): Server environment:user.home=/home/hadoop 2014-03-31 00:08:31,290 INFO [Thread-0] zookeeper.Environment(98): Server environment:user.dir=/home/hadoop/Desktop/Lealone-master/lealone-test 2014-03-31 00:08:31,424 INFO [Thread-0] server.ZooKeeperServer(171): Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 datadir /home/hadoop/Desktop/Lealone-master/lealone-test/lealone-test-data/zookeeper/zookeeper_0/version-2 snapdir /home/hadoop/Desktop/Lealone-master/lealone-test/lealone-test-data/zookeeper/zookeeper_0/version-2 2014-03-31 00:08:31,736 INFO [Thread-0] server.NIOServerCnxnFactory(110): binding to port 0.0.0.0/0.0.0.0:2181 2014-03-31 00:08:31,782 INFO [Thread-0] server.NIOServerCnxnFactory(110): binding to port 0.0.0.0/0.0.0.0:2182 2014-03-31 00:08:31,813 INFO [Thread-0] persistence.FileTxnSnapLog(238): Snapshotting: 0x0 to /home/hadoop/Desktop/Lealone-master/lealone-test/lealone-test-data/zookeeper/zookeeper_0/version-2/snapshot.0 2014-03-31 00:08:32,396 INFO [main] util.VersionInfo(108): HBase 0.94.2 2014-03-31 00:08:32,397 INFO [main] util.VersionInfo(108): Subversion https://svn.apache.org/repos/asf/hbase/tags/0.94.2mvn -r 1409373 2014-03-31 00:08:32,397 INFO [main] util.VersionInfo(108): Compiled by stack on Wed Nov 14 12:21:07 PST 2012 2014-03-31 00:08:32,978 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2182] server.NIOServerCnxnFactory(213): Accepted socket connection from /127.0.0.1:33641 2014-03-31 00:08:33,016 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2182] server.NIOServerCnxn(820): Processing stat command from /127.0.0.1:33641 2014-03-31 00:08:33,025 INFO [Thread-3] server.NIOServerCnxn$StatCommand(655): Stat command output 2014-03-31 00:08:33,030 INFO [Thread-3] server.NIOServerCnxn(1000): Closed socket connection for client /127.0.0.1:33641 (no session established for client) 2014-03-31 00:08:33,038 INFO [Thread-0] zookeeper.MiniZooKeeperCluster(193): Started MiniZK Cluster and connect 1 ZK server on client port: 2182 2014-03-31 00:08:33,705 ERROR [main] master.HMasterCommandLine(157): Failed to start master java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1792) at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:146) at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:103) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:76) at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:1806) at com.codefollower.lealone.test.start.HMasterStarter.main(HMasterStarter.java:41) Caused by: java.net.BindException: Address already in use at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:444) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.hadoop.hbase.ipc.HBaseServer.bind(HBaseServer.java:247) at org.apache.hadoop.hbase.ipc.HBaseServer$Listener.(HBaseServer.java:473) at org.apache.hadoop.hbase.ipc.HBaseServer.(HBaseServer.java:1533) at org.apache.hadoop.hbase.ipc.WritableRpcEngine$Server.(WritableRpcEngine.java:296) at org.apache.hadoop.hbase.ipc.WritableRpcEngine.getServer(WritableRpcEngine.java:245) at org.apache.hadoop.hbase.ipc.WritableRpcEngine.getServer(WritableRpcEngine.java:55) at org.apache.hadoop.hbase.ipc.HBaseRPC.getServer(HBaseRPC.java:433) at org.apache.hadoop.hbase.ipc.HBaseRPC.getServer(HBaseRPC.java:422) at org.apache.hadoop.hbase.master.HMaster.(HMaster.java:252) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1787) ... 6 more

codefollower commented 10 years ago

Caused by: java.net.BindException: Address already in use

shufangxieyang commented 9 years ago

2014-12-28 21:02:24,300 ERROR [main] master.HMasterCommandLine: Master exiting java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1867) at org.apache.hadoop.hbase.master.HMasterCommandLine.startMaster(HMasterCommandLine.java:198) at org.apache.hadoop.hbase.master.HMasterCommandLine.run(HMasterCommandLine.java:139) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.hbase.util.ServerCommandLine.doMain(ServerCommandLine.java:126) at org.apache.hadoop.hbase.master.HMaster.main(HMaster.java:1881) Caused by: java.net.BindException: Address already in use at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:444) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.apache.hadoop.hbase.ipc.RpcServer.bind(RpcServer.java:2366) at org.apache.hadoop.hbase.ipc.RpcServer$Listener.(RpcServer.java:524) at org.apache.hadoop.hbase.ipc.RpcServer.(RpcServer.java:1896) at org.apache.hadoop.hbase.regionserver.RSRpcServices.(RSRpcServices.java:788) at org.apache.hadoop.hbase.master.MasterRpcServices.(MasterRpcServices.java:197) at org.apache.hadoop.hbase.master.HMaster.createRpcServices(HMaster.java:401) at org.apache.hadoop.hbase.regionserver.HRegionServer.(HRegionServer.java:487) at org.apache.hadoop.hbase.master.HMaster.(HMaster.java:271) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.apache.hadoop.hbase.master.HMaster.constructMaster(HMaster.java:1862) ... 5 more

which address or port already in use???

codefollower commented 9 years ago

HBase的代码里没有捕获java.net.BindException, 所以把JDK里原始的Address already in use信息直接抛出来了,这个异常信息是最无用的信息, 通常情况下都会先捕获它,然后把address和port组成一个字符串后才重新抛异常。

这个问题的原因是HBase要启动它内部的RpcServer, 它使用ServerSocketChannel方式来得到ServerSocket, 然后bind到一个InetSocketAddress(hostname, 60000)

而Lealone内部有一个TcpServer, 它是直接new ServerSocket()不用ServerSocketChannel的方式, 并且也bind到一个InetSocketAddress(hostname, 5210),

两种方式都用同一个hostname,只是port不同, 有时会出现Address already in use,有时又出现Already bound。

Windows中可以使用netstat -anb命令来查看port被哪个程序占用了

shufangxieyang commented 9 years ago

谢谢!我试试看!

shufangxieyang@163.com

From: Lealone Date: 2014-12-29 16:41 To: codefollower/Lealone CC: shufangxieyang Subject: Re: [Lealone] java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMaster (#68) HBase的代码里没有捕获java.net.BindException, 所以把JDK里原始的Address already in use信息直接抛出来了,这个异常信息是最无用的信息, 通常情况下都会先捕获它,然后把address和port组成一个字符串后才重新抛异常。 这个问题的原因是HBase要启动它内部的RpcServer, 它使用ServerSocketChannel方式来得到ServerSocket, 然后bind到一个InetSocketAddress(hostname, port1) 而Lealone内部有一个TcpServer, 它是直接new ServerSocket()不用ServerSocketChannel的方式, 并且也bind到一个InetSocketAddress(hostname, port2), 两种方式都用同一个hostname,只是port不同, 有时会出现Address already in use,有时又出现Already bound。 Windows中可以使用netstat -anb命令来查看port被哪个程序占用了 — Reply to this email directly or view it on GitHub.