OpenGTS Integration in Eclipse

452 views Asked by At

OpenGTS Integration in Eclipse

*Imported whole opengts code in to the eclispse workspace.

*Created the four environment variables like GTS_HOME,CATALINA_HOME,ANT_HOME,JAVA_HOME as system variables.

*In the next step am trying to configure the database for the opengts as they mentioned in the document.

*Refer the link below "http://opengts.sourceforge.net/OpenGTS_Config.pdf".

  • Taking reference of above link Am trying to run the commands given in the pdf file

*The first command we need to run is initdb.bat command in windows command prompt.

*When ever i run the above command the system dynasmically create the gts database and tables related to that db.

*At this moment am strucked with the error

 "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)"

*Am getting error in DBAdmin.Java class with two methods given in the opengts code. The methods are .............................(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 + "]");
                }
            }
        }
3

There are 3 answers

3
Prashant Gupta On BEST ANSWER

In System.conf file You have to set Mysql database password same as localhost DB.Than try to Build the project.It will work. You have to run initdb command like given below.

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

Result should be like this:

Validating table columns ...

Table 'Account' 1 Validating columns ...

continue..

0
Antony Sampath Kumar Reddy On

I have checked the username and password ..Even though it is giving the same error when am trying to run the initdb.bat in the command prompt as follows

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)
1
Olivier Kramoh On
"C:\OpenGTS_2.6.4\bin>initdb.bat -rootUser=<logindb> -rootPass=<dbpassword>