OpenGTS Integration in Eclipse
*将整个opengts代码导入到eclispse工作区中。
*创建了四个环境变量,如GTS_HOME,CATALINA_HOME,ANT_HOME,JAVA_HOME作为系统变量。
*在下一步中,我将尝试为文档中提到的opengts配置数据库。
*请参阅以下链接 "http://opengts.sourceforge.net/OpenGTS_Config.pdf"。
- 参考上面的链接,我试图运行pdf文件中给出的命令
*我们需要运行的第一个命令是 initdb.bat Windows 命令提示符中的命令。
*当我运行上述命令时,系统会动态创建与该数据库相关的 gts 数据库和表。
*此刻我被错误击中
"C:OpenGTS_2.6.4bin>initdb.bat
"C:Program FilesJavajdk1.8.0_45binjava" "-Dfile.encoding=UTF-8" -classpath "C:OpenGTS_2.6.4buildlib"gtsdb.jar;"C:OpenGTS_2.6.4buildlib"gtsutils.jar;"C:OpenGTS_2.6.4buildlib"optdb.jar;"C:OpenGTS_2.6.4buildlib"ruledb.jar;"C:OpenGTS_2.6.4buildlib"bcrossdb.jar;"C:OpenGTS_2.6.4buildlib"custom.jar;"C:OpenGTS_2.6.4buildlib"dmtpserv.jar;"C:OpenGTS_2.6.4buildlib"gtsdmtp.jar; org.opengts.db.DBConfig -conf:"C:OpenGTS_2.6.4default.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 + "]");
}
}
}
在 System.conf 文件中,您必须将 Mysql 数据库密码设置为与本地主机数据库相同。而不是尝试构建项目。它会起作用。 您必须运行如下所示的 initdb 命令。
C:\OpenGTS_2.5.9\bin>initdb.bat "-rootUser:db root username" "-rootPass:db rootpassword">
结果应该是这样的:
正在验证表列...
表 '帐户' 1 验证列...
继续。。
我已经检查了用户名和密码..即使它在我尝试运行 initdb 时给出相同的错误.bat在命令提示符下如下所示
C:OpenGTS_2.6.4bin>initdb.bat
"C:Program FilesJavajdk1.8.0_45binjava" "-Dfile.encoding=UTF-8" -classpath
"C:OpenGTS_2.6.4buildlib"gtsdb.jar;"C:OpenGTS_2.6.4buildlib"gtsutils.jar;"C:OpenGTS_2.6.4buildlib"optdb.jar;"C:OpenGTS_2.6.4buildlib"ruledb.jar;"C:OpenGTS_2.6.4buildlib"bcrossdb.jar;"C:OpenGTS_2.6.4buildlib"custom.jar;"C:OpenGTS_2.6.4buildlib"dmtpserv.jar;"C:OpenGTS_2.6.4buildlib"gtsdmtp.jar; org.opengts.db.DBConfig -conf:"C:OpenGTS_2.6.4default.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)
"C:OpenGTS_2.6.4bin>initdb.bat -rootUser=<logindb> -rootPass=<dbpassword>