上次被zipkin-dependencies的启动问题卡了很晚,就结束了那篇文章,今天继续解决问题。我从网上搜到一篇类似的博文 部署生产环境时踩到的一些坑,里面提到直接在tomcat的catalina.sh的JAVA_OPTS注释处,加一行JAVA_OPTS="-server -Xms1024m -Xmx1624m -XX:PermSize=128M -XX:MaxPermSize=256m",即可解决。
JAVA_OPTS="-server -Xms1024m -Xmx1624m -XX:PermSize=128M -XX:MaxPermSize=256m"
tomcat启动成功。
[root@izwz9fwifc2eniq3lbdzmgz bin]
Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-8.5.32
Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-8.5.32
Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-8.5.32/temp
Using JRE_HOME: /usr/lib/jdk1.8.0_181
Using CLASSPATH: /usr/local/tomcat/apache-tomcat-8.5.32/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-8.5.32/bin/tomcat-juli.jar
Tomcat started.
后来又搜到这条链接how to increase heap size?
原来直接在执行java命令时,追加-Xmx就行了,脑袋太死板,想不到这个点。
[root@izwz9fwifc2eniq3lbdzmgz cusD]# java -Xmx1024m -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
提示内存不足,分配失败。
[root@izwz9fwifc2eniq3lbdzmgz cusD]
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000d5550000, 715849728, 0) failed; error='Cannot allocate memory' (errno=12)
解决步骤:
执行刚才的vi catalina.sh,清理掉设置的JAVA_OPTs信息,关掉mysql,重启tomcat等步骤。利用free或top查看内存消耗。
[root@izwz9fwifc2eniq3lbdzmgz cusD]# free -h
total used free shared buff/cache available
Mem: 1.8G 228M 1.2G 388K 396M 1.4G
Swap: 0B 0B 0B
[root@izwz9fwifc2eniq3lbdzmgz cusD]
18/09/17 16:42:21 INFO CassandraDependenciesJob: Running Dependencies job for 2018-09-16: 1537056000000000 ≤ Span.timestamp 1537142399999999
18/09/17 16:42:21 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
18/09/17 16:42:22 WARN Java7Support: Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added
Exception in thread "main" java.io.IOException: Failed to open native connection to Cassandra at {127.0.0.1}:9042
未能加载JDK7 types,不过日志级别为Warn,可以忽略。
启动成功后,dependency依然没有数据, 需要继续查询问题。