Unable to start JVM: No such file or directory出現(xiàn)找不到或開(kāi)啟不了JVM報(bào)錯(cuò)時(shí),其實(shí)就是程序在$PATH相對(duì)路徑下找不到j(luò)ava的啟動(dòng)路徑
#報(bào)錯(cuò)開(kāi)啟不了JVM[root@localhost bin]# tail -fn 20 /usr/local/mycat/logs/wrapper.log
STATUS | wrapper |2022/12/09 11:39:10 | --> Wrapper Started as Daemon
STATUS | wrapper |2022/12/09 11:39:10 | Launching a JVM...
ERROR | wrapper |2022/12/09 11:39:10 | Unable to start JVM: No such file or directory (2)
ERROR | wrapper |2022/12/09 11:39:10 | JVM exited while loading the application.
STATUS | wrapper |2022/12/09 11:39:15 | Launching a JVM...
ERROR | wrapper |2022/12/09 11:39:15 | Unable to start JVM: No such file or directory (2)
ERROR | wrapper |2022/12/09 11:39:15 | JVM exited while loading the application.
STATUS | wrapper |2022/12/09 11:39:19 | Launching a JVM...
ERROR | wrapper |2022/12/09 11:39:19 | Unable to start JVM: No such file or directory (2)
ERROR | wrapper |2022/12/09 11:39:19 | JVM exited while loading the application.
STATUS | wrapper |2022/12/09 11:39:23 | Launching a JVM...
ERROR | wrapper |2022/12/09 11:39:23 | Unable to start JVM: No such file or directory (2)
ERROR | wrapper |2022/12/09 11:39:23 | JVM exited while loading the application.
STATUS | wrapper |2022/12/09 11:39:27 | Launching a JVM...
ERROR | wrapper |2022/12/09 11:39:27 | Unable to start JVM: No such file or directory (2)
ERROR | wrapper |2022/12/09 11:39:27 | JVM exited while loading the application.
FATAL | wrapper |2022/12/09 11:39:27 | There were 5 failed launches in a row, each lasting less than 300 seconds. Giving up.
FATAL | wrapper |2022/12/09 11:39:27 | There may be a configuration problem: please check the logs.
STATUS | wrapper |2022/12/09 11:39:27 |<-- Wrapper Stopped#在$PATH下沒(méi)有java相對(duì)路徑[root@localhost bin]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@localhost bin]#[root@localhost bin]# /usr/java/jdk1.8.0_131/bin/java -versionjava version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM)64-Bit Server VM (build 25.131-b11, mixed mode)[root@localhost bin]# #把路徑添加到PATH[root@localhost bin]# export PATH=$PATH:/usr/java/jdk1.8.0_131/bin[root@localhost bin]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/java/jdk1.8.0_131/bin
[root@localhost bin]#
[root@localhost bin]# tail -fn 20 /usr/local/mycat/logs/wrapper.log
INFO | jvm 1|2022/12/09 12:11:09 | at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
INFO | jvm 1|2022/12/09 12:11:09 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
INFO | jvm 1|2022/12/09 12:11:09 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
INFO | jvm 1|2022/12/09 12:11:09 | at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
INFO | jvm 1|2022/12/09 12:11:09 | at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
INFO | jvm 1|2022/12/09 12:11:09 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
INFO | jvm 1|2022/12/09 12:11:09 | at com.mysql.cj.NativeSession.connect(NativeSession.java:144)
INFO | jvm 1|2022/12/09 12:11:09 | at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:847)
INFO | jvm 1|2022/12/09 12:11:09 |... 7 common frames omitted
INFO | jvm 1|2022/12/09 12:11:09 | Caused by: java.net.ConnectException: 拒絕連接 (Connection refused)
INFO | jvm 1|2022/12/09 12:11:09 | at java.net.PlainSocketImpl.socketConnect(Native Method)
INFO | jvm 1|2022/12/09 12:11:09 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
INFO | jvm 1|2022/12/09 12:11:09 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
INFO | jvm 1|2022/12/09 12:11:09 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
INFO | jvm 1|2022/12/09 12:11:09 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
INFO | jvm 1|2022/12/09 12:11:09 | at java.net.Socket.connect(Socket.java:589)
INFO | jvm 1|2022/12/09 12:11:09 | at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
INFO | jvm 1|2022/12/09 12:11:09 | at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
INFO | jvm 1|2022/12/09 12:11:09 |... 9 common frames omitted
STATUS | wrapper |2022/12/09 12:11:10 |<-- Wrapper Stopped
[root@localhost logs]# more wrapper.log
STATUS | wrapper |2022/12/09 17:09:23 | --> Wrapper Started as Daemon
STATUS | wrapper |2022/12/09 17:09:23 | Launching a JVM...
INFO | jvm 1|2022/12/09 17:09:23 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.
org
INFO | jvm 1|2022/12/09 17:09:23 | Copyright 1999-2006 Tanuki Software, Inc. All Right
s Reserved.
INFO | jvm 1|2022/12/09 17:09:23 |
INFO | jvm 1|2022/12/09 17:09:24 | path:/usr/local/mycat/./conf
INFO | jvm 1|2022/12/09 17:09:24 |2022-12-09 17:09:24,409[INFO]com.alibaba.druid.pool.Dr
uidDataSource.init:990{dataSource-1} inited
INFO | jvm 1|2022/12/09 17:09:27 |2022-12-09 17:09:27,418[WARN]com.alibaba.druid.pool.Dr
uidDataSource.getConnectionDirect:1424get connection timeout retry :1
INFO | jvm 1|2022/12/09 17:09:28 |2022-12-09 17:09:28,612[ERROR]com.alibaba.druid.pool.D
ruidDataSource.run:2803create connection SQLException, url: jdbc:mysql://192.168.100.112/mycat?s
erverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, errorCod
e 0, state 08001
INFO | jvm 1|2022/12/09 17:09:28 | java.sql.SQLNonTransientConnectionException: Could notcreate connection to database server. Attempted reconnect 3 times. Giving up.
INFO | jvm 1|2022/12/09 17:09:28 | at com.mysql.cj.jdbc.exceptions.SQLError.createS
QLException(SQLError.java:110)
mysql> update mysql.user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql> mysql> select user,host from mysql.user where user='root'\G
*************************** 1. row ***************************
user: root
host: %
1 row in set (0.12 sec)mysql>
案例四
cn.mycat.vertx.xa.impl.Xa LogImpl.?:?java.sql.SQLException: XAER_RMERR: Fatal error occurred in the transaction branch - check your data for consistency
[root@localhost logs]# more wrapper.log
STATUS | wrapper |2022/12/09 17:27:41 | --> Wrapper Started as Daemon
STATUS | wrapper |2022/12/09 17:27:42 | Launching a JVM...
INFO | jvm 1|2022/12/09 17:27:42 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.
org
INFO | jvm 1|2022/12/09 17:27:42 | Copyright 1999-2006 Tanuki Software, Inc. All Right
s Reserved.
INFO | jvm 1|2022/12/09 17:27:42 |
INFO | jvm 1|2022/12/09 17:27:42 | path:/usr/local/mycat/./conf
INFO | jvm 1|2022/12/09 17:27:43 |2022-12-09 17:27:43,093[INFO]com.alibaba.druid.pool.Dr
uidDataSource.init:990{dataSource-1} inited
INFO | jvm 1|2022/12/09 17:27:43 |2022-12-09 17:27:43,350[INFO]com.alibaba.druid.pool.Dr
uidDataSource.init:990{dataSource-2} inited
INFO | jvm 1|2022/12/09 17:27:44 |2022-12-09 17:27:44,116[INFO]io.mycat.config.MycatRout
erConfigOps.recoveryXA:735readXARecoveryLog start
INFO | jvm 1|2022/12/09 17:27:44 |2022-12-09 17:27:44,223[WARN]cn.mycat.vertx.xa.impl.Xa
LogImpl.?:?java.sql.SQLException: XAER_RMERR: Fatal error occurred in the transaction branch - c
heck your data for consistency
INFO | jvm 1|2022/12/09 17:27:44 |2022-12-09 17:27:44,225[WARN]cn.mycat.vertx.xa.impl.Xa
LogImpl.?:?java.sql.SQLException: XAER_RMERR: Fatal error occurred in the transaction branch - c
heck your data for consistency
INFO | jvm 1|2022/12/09 17:27:44 |2022-12-09 17:27:44,250[INFO]io.mycat.vertx.VertxMycat
Server.lambda$start$1:166Mycat Vertx server 2b4f2ad8-9919-4acf-b2ec-95accaf340e9 started up.
INFO | jvm 1|2022/12/09 17:27:44 |2022-12-09 17:27:44,250[INFO]io.mycat.vertx.VertxMycat
Server.lambda$start$1:166Mycat Vertx server 11588fd2-fd63-4719-8c3f-392c99aea303 started up.
mysql> select * from t1;
ERROR:
org.apache.calcite.runtime.CalciteContextException: At line 0, column 0: Object 't1' not found within 'discuz'
mysql> mysql> use discuz;
Database changed
mysql> desc t1;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | int | YES | | NULL | |
| name | varchar(20) | YES | | NULL | |
| job | char(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.03 sec)mysql>[root@localhost logs]# /usr/local/mycat/bin/mycat restart
Stopping mycat2...
Stopped mycat2.
Starting mycat2...
[root@localhost logs]#
[root@sunlit5 ~]# mysql -h 192.168.100.111 -uroot -pAdmin@123 -P 8066
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 0
Server version: 5.7.33-mycat-2.0 MySQL Community Server - GPLCopyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| `Database` |
+--------------------+
| discuz |
| information_schema |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.05 sec)mysql> use discuz;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> select * from t1;
+------+----------+------+
| id | name | job |
+------+----------+------+
| 1 | xiaoming | IT |
| 2 | xiaowang | IT |
+------+----------+------+
2 rows in set (0.02 sec)mysql>
案例六
[ERROR]com.alibaba.druid.pool.DruidDataSource.run:2803create connection SQLException, url: jdbc:mysql://192.168.100.112:3306/myca t?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, errorCode 0, state 08001