-1

Eclipse 中的 OpenGTS 集成

*将整个 opengts 代码导入 eclipse 工作区。

*创建了GTS_HOME、CATALINA_HOME、ANT_HOME、JAVA_HOME等四个环境变量作为系统变量。

*在下一步中,我将尝试为文档中提到的 opengts 配置数据库。

*请参阅下面的链接“ http://opengts.sourceforge.net/OpenGTS_Config.pdf ”。

  • 参考上述链接 我正在尝试运行 pdf 文件中给出的命令

*我们需要运行的第一个命令是 windows 命令提示符中的 initdb.bat 命令。

*当我运行上述命令时,系统会动态创建与该数据库相关的 gts 数据库和表。

*此时我被错误击中

 "C:\OpenGTS_2.6.4\bin>initdb.bat
     "C:\Program Files\Java\jdk1.8.0_45\bin\java" "-Dfile.encoding=UTF-8" -classpath "C:\OpenGTS_2.6.4\build\lib"\gtsdb.jar;"C:\OpenGTS_2.6.4\build\lib"\gtsutils.jar;"C:\OpenGTS_2.6.4\build\lib"\optdb.jar;"C:\OpenGTS_2.6.4\build\lib"\ruledb.jar;"C:\OpenGTS_2.6.4\build\lib"\bcrossdb.jar;"C:\OpenGTS_2.6.4\build\lib"\custom.jar;"C:\OpenGTS_2.6.4\build\lib"\dmtpserv.jar;"C:\OpenGTS_2.6.4\build\lib"\gtsdmtp.jar; org.opengts.db.DBConfig -conf:"C:\OpenGTS_2.6.4\default.conf" -log.file.enable:false -initTables
Version: 2.6.4
[ERROR|DBAdmin.execCommands:1006] SQLException message: Access denied for user 'root'@'localhost' (using password: NO)
[ERROR|DBAdmin.execCommands:1007] ==> SQLException: DB create error [jdbc:mysql://localhost:3306/]
[ERROR|DBAdmin.execCommands:1007] Message:   Access denied for user 'root'@'localhost' (using password: NO)
[ERROR|DBAdmin.execCommands:1007] SQLState:  28000
[ERROR|DBAdmin.execCommands:1007] ErrorCode: 1045
[DBAdmin.execCommands:1007] java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:870)
        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1206)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2239)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2270)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at org.opengts.dbtools.DBConnection.getConnection(DBConnection.java:809)
        at org.opengts.dbtools.DBConnection.createStatement(DBConnection.java:945)
        at org.opengts.dbtools.DBConnection.createStatement(DBConnection.java:933)
        at org.opengts.dbtools.DBConnection._executeUpdate(DBConnection.java:1188)
        at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:1143)
        at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:1124)
        at org.opengts.dbtools.DBProvider.createDatabase(DBProvider.java:1699)
        at org.opengts.dbtools.DBAdmin.execCommands(DBAdmin.java:995)
        at org.opengts.db.DBConfig._main(DBConfig.java:2036)
        at org.opengts.db.DBConfig.main(DBConfig.java:2180)"

*使用 opengts 代码中给出的两种方法在 DBAdmin.Java 类中出现错误。方法是……………………(1)………… .....................

 public static DBFactory<? extends DBRecord<?>>[] getClassTableFactories(Class<?> tableClass)
        {
            java.util.List<DBFactory<? extends DBRecord<?>>> list = new Vector<DBFactory<? extends DBRecord<?>>>();
            if (tableClass != null) {
                for (DBFactory<? extends DBRecord<?>> tableFact : DBAdmin.getTableFactoryMap().values()) {
                    if (DBFactory.isTableClass(tableFact,tableClass)) {
                        list.add(tableFact);
                    }
                }
            }
            @SuppressWarnings("unchecked")
            DBFactory<? extends DBRecord<?>> dbf[] = list.toArray(new DBFactory<?>[list.size()]);
            return dbf;
        }

…………………………(二)………………………………………………………………………………………… …………

if (RTConfig.hasProperty(ARG_LAST)) {
            execCmd++;
            //String last = RTConfig.getString(ARG_LAST, null);
            Print.logInfo("Table last update time:");
            OrderedMap<String,DBFactory<? extends DBRecord<?>>> factMap = DBAdmin.getTableFactoryMap();
            for (Iterator<String> i = factMap.keyIterator(); i.hasNext();) {
                String tn = i.next();
                DBFactory<? extends DBRecord<?>> f = (DBFactory<? extends DBRecord<?>>)factMap.get(tn);
                try {
                    long lut = DBRecord.getLastUpdateTime(f);
                    if (lut < 0L) {
                        Print.logInfo("  Last Table Update: " +tn + " - Not Available");
                    } else
                    if (lut == 0L) {
                        Print.logInfo("  Last Table Update: " + tn + " - No Data");
                    } else {
                        Print.logInfo("  Last Table Update: " + tn + " - " + (new DateTime(lut)));
                        //Print.logInfo("   => " + DBRecord.getRecordsSince(f, lut)[0]);
                    }
                } catch (DBException dbe) {
                    Print.logError("  Last Table Update: " +tn + " - DB Error [" + dbe + "]");
                }
            }
        }
4

3 回答 3

1

在 System.conf 文件中,您必须将 Mysql 数据库密码设置为与 localhost DB 相同。然后尝试构建项目。它将工作。您必须运行 initdb 命令,如下所示。

C:\OpenGTS_2.5.9\bin>initdb.bat "-rootUser:db root username" "-rootPass:db rootpassword"

结果应该是这样的:

正在验证表列...

表 'Account' 1 验证列...

继续..

于 2018-05-17T12:15:19.150 回答
0

我已经检查了用户名和密码..即使它在尝试在命令提示符下运行 initdb.bat 时给出相同的错误,如下所示

C:\OpenGTS_2.6.4\bin>initdb.bat
"C:\Program Files\Java\jdk1.8.0_45\bin\java" "-Dfile.encoding=UTF-8" -classpath

"C:\OpenGTS_2.6.4\build\lib"\gtsdb.jar;"C:\OpenGTS_2.6.4\build\lib"\gtsutils.jar;"C:\OpenGTS_2.6.4\build\lib"\optdb.jar;"C:\OpenGTS_2.6.4\build\lib"\ruledb.jar;"C:\OpenGTS_2.6.4\build\lib"\bcrossdb.jar;"C:\OpenGTS_2.6.4\build\lib"\custom.jar;"C:\OpenGTS_2.6.4\build\lib"\dmtpserv.jar;"C:\OpenGTS_2.6.4\build\lib"\gtsdmtp.jar; org.opengts.db.DBConfig -conf:"C:\OpenGTS_2.6.4\default.conf"
-log.file.enable:false -initTables

    Version: 2.6.4
    [ERROR|DBAdmin.execCommands:1006] SQLException message: Access denied for user 'root'@'localhost' (using password: NO)
    [ERROR|DBAdmin.execCommands:1007] ==> SQLException: DB create error [jdbc:mysql://localhost:3306/]
    [ERROR|DBAdmin.execCommands:1007] Message:   Access denied for user 'root'@'localhost' (using password: NO)
    [ERROR|DBAdmin.execCommands:1007] SQLState:  28000
    [ERROR|DBAdmin.execCommands:1007] ErrorCode: 1045
    [DBAdmin.execCommands:1007] java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
    java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
            at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:998)
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3835)
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:870)
            at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659)
            at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1206)
            at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2239)
            at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2270)
            at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069)
            at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
            at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
            at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
            at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
            at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
            at java.sql.DriverManager.getConnection(DriverManager.java:664)
            at java.sql.DriverManager.getConnection(DriverManager.java:247)
            at org.opengts.dbtools.DBConnection.getConnection(DBConnection.java:809)
            at org.opengts.dbtools.DBConnection.createStatement(DBConnection.java:945)
            at org.opengts.dbtools.DBConnection.createStatement(DBConnection.java:933)
            at org.opengts.dbtools.DBConnection._executeUpdate(DBConnection.java:1188)
            at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:1143)
            at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:1124)
            at org.opengts.dbtools.DBProvider.createDatabase(DBProvider.java:1699)
            at org.opengts.dbtools.DBAdmin.execCommands(DBAdmin.java:995)
            at org.opengts.db.DBConfig._main(DBConfig.java:2036)
            at org.opengts.db.DBConfig.main(DBConfig.java:2180)
于 2017-05-16T05:29:38.490 回答
0
"C:\OpenGTS_2.6.4\bin>initdb.bat -rootUser=<logindb> -rootPass=<dbpassword>
于 2022-01-20T15:45:13.703 回答