Eclipse中的OpenGTS集成

时间:2017-05-15 13:10:24

标签: java mysql eclipse gps opengts

Eclipse中的OpenGTS集成

*导入整个opengts代码到eclispse工作区。

*创建了四个环境变量,如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)"

*在DBAdmin.Java类中出现错误,在opengts代码中给出了两个方法。 方法是    .............................(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;
        }

....................................(2)................. ............

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 + "]");
                }
            }
        }

2 个答案:

答案 0 :(得分:0)

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

public function searchColors(string $die, Request $request)
{
    // dd($die);
}

答案 1 :(得分:0)

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

C:\ OpenGTS_2.5.9 \ bin&gt; initdb.bat&#34; -rootUser:db root username&#34; &#34; -rootPass:db rootpassword&#34;

结果应该是这样的:

验证表格列...

表&#39;帐户&#39; 1验证列...

继续..