orabbix 启动报错 WARNING: Error while registering Oracle JDBC Diagnosability MBean.

一. 报错信息如下:

[root@adminm conf]# /etc/init.d/orabbix start
Starting Orabbix service:
[root@adminm conf]# Jan 22, 2018 2:37:06 p.m. oracle.jdbc.driver.OracleDriver registerMBeans
WARNING: Error while registering Oracle JDBC Diagnosability MBean.
java.lang.NoSuchMethodError: method javax.management.StandardMBean. with signature (Ljava.lang.Class;Z)V was not found.
   at oracle.jdbc.driver.OracleDiagnosabilityMBean.(OracleDiagnosabilityMBean.java:34)
   at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:360)
   at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:199)
   at java.security.AccessController.doPrivileged(libgcj.so.10)
   at oracle.jdbc.driver.OracleDriver.(OracleDriver.java:195)
   at java.lang.Class.initializeClass(libgcj.so.10)
   at java.lang.Class.initializeClass(libgcj.so.10)
   at java.lang.Class.forName(libgcj.so.10)
   at org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.setDriver(DriverAdapterCPDS.java:500)
   at com.smartmarmot.orabbix.Configurator.getConnection(Configurator.java:454)
   at com.smartmarmot.orabbix.Configurator.getConnections(Configurator.java:581)
   at com.smartmarmot.orabbix.Orabbixmon.run(Orabbixmon.java:91)
   at com.smartmarmot.orabbix.bootstrap.main(bootstrap.java:50)
Exception in thread "main" java.lang.NoClassDefFoundError: oracle.jdbc.driver.PhysicalConnection
   at java.lang.Class.initializeClass(libgcj.so.10)
   at java.lang.Class.initializeClass(libgcj.so.10)
   at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
   at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
   at java.sql.DriverManager.getConnection(libgcj.so.10)
   at java.sql.DriverManager.getConnection(libgcj.so.10)
   at org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(DriverAdapterCPDS.java:205)
   at org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(DriverAdapterCPDS.java:150)
   at org.apache.commons.dbcp.datasources.InstanceKeyDataSource.testCPDS(InstanceKeyDataSource.java:836)
   at org.apache.commons.dbcp.datasources.SharedPoolDataSource.registerPool(SharedPoolDataSource.java:210)
   at org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:169)
   at org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:701)
   at org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:676)
   at com.smartmarmot.orabbix.Configurator.getConnection(Configurator.java:534)
   at com.smartmarmot.orabbix.Configurator.getConnections(Configurator.java:581)
   at com.smartmarmot.orabbix.Orabbixmon.run(Orabbixmon.java:91)
   at com.smartmarmot.orabbix.bootstrap.main(bootstrap.java:50)
Caused by: java.lang.ClassNotFoundException: java.sql.NClob not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:lib/commons-codec-1.4.jar,file:lib/commons-dbcp-1.4.jar,file:lib/commons-lang-2.5.jar,file:lib/commons-logging-1.1.1.jar,file:lib/commons-pool-1.5.4.jar,file:lib/hsqldb.jar,file:lib/log4j-1.2.15.jar,file:lib/ojdbc6.jar,file:./,file:./orabbix-1.2.3.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass(libgcj.so.10)
   at java.lang.ClassLoader.loadClass(libgcj.so.10)
   at java.lang.ClassLoader.loadClass(libgcj.so.10)
   at java.lang.VMClassLoader.defineClass(libgcj.so.10)
   at java.lang.ClassLoader.defineClass(libgcj.so.10)
   at java.security.SecureClassLoader.defineClass(libgcj.so.10)
   at java.net.URLClassLoader.findClass(libgcj.so.10)
   at java.lang.ClassLoader.loadClass(libgcj.so.10)
   at java.lang.ClassLoader.loadClass(libgcj.so.10)
   at java.lang.Class.forName(libgcj.so.10)
   at java.lang.Class.initializeClass(libgcj.so.10)
   ...16 more
^C
[root@adminm conf]# 

二. 问题分析:

这个错看起来是JDK的问题,升级到1.8还是没作用

但orabbix日志开起来也挺正常的:

2018-01-22 15:42:11,176 [main] INFO  Orabbix - Starting Orabbix Version 1.2.3 
 2018-01-22 15:42:11,211 [main] INFO  Orabbix - Orabbix started with pid:GNU libgcj 4.4.7 20120313 (Red Hat 4.4.7-17) [147558
 2018-01-22 15:42:11,211 [main] INFO  Orabbix - PidFile -> ./logs/orabbix.pid
 2018-01-22 15:42:11,277 [main] INFO  Orabbix - DB Pool created: org.apache.commons.dbcp.datasources.SharedPoolDataSource@1418487e
 2018-01-22 15:42:11,277 [main] INFO  Orabbix - URL=jdbc:oracle:thin:@10.195.xxx.x:1521:odcl
 2018-01-22 15:42:11,277 [main] INFO  Orabbix - maxPoolSize=10
 2018-01-22 15:42:11,277 [main] INFO  Orabbix - maxIdleSize=1
 2018-01-22 15:42:11,277 [main] INFO  Orabbix - maxIdleTime=1800000ms
 2018-01-22 15:42:11,277 [main] INFO  Orabbix - poolTimeout=100
 2018-01-22 15:42:11,277 [main] INFO  Orabbix - timeBetweenEvictionRunsMillis=-1
 2018-01-22 15:42:11,277 [main] INFO  Orabbix - numTestsPerEvictionRun=3
 
三.问题解决:

直接执行run.sh文件orabbix是可以起来的

sh /opt/orabbix/run.sh 

所以分析 /etc/init.d/orabbix的问题

发现 /etc/init.d/orabbix中有二处初始化:

# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network

当执行了. /etc/rc.d/init.d/functions就会报错

查看发现应该是functions里的

# Set up a default search path.
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
export PATH

影响了JDK的环境变量,这行注释就可以了







你可能感兴趣的:(优化,Zabbix)