UniTime / unitime

Comprehensive University Timetabling System
http://www.unitime.org
Apache License 2.0
274 stars 162 forks source link

Error while installing #48

Closed KarthikRv93 closed 5 years ago

KarthikRv93 commented 5 years ago

Hi,

I am trying to work on UniTime but after installing I am getting the following error:

Errors occurred during the build. Errors running builder 'Java Builder' on project 'UniTime'. org.eclipse.jdt.internal.core.JavaProject.computePackageFragmentRoots([Lorg/eclipse/jdt/core/IClasspathEntry;ZLjava/util/Map;)[Lorg/eclipse/jdt/core/IPackageFragmentRoot;

Can anyone tell me how to resolve it?

tomas-muller commented 5 years ago

I will need more details as this is not a UniTime exception. Did you follow the Installation Instructions?

If you are trying to setup UniTime in Eclipse, please see http://help.unitime.org/eclipse

KarthikRv93 commented 5 years ago

@tomas-muller, Thanks for your suggestion. I have resolved the errors. But after installing UniTime on locally I am not able to get the top navigation bar capture

tomas-muller commented 5 years ago

This looks like you do not have the GWT client code compiled. If done properly, you should see a lot of rpc and js files under UniTime/WebContent/unitime (in the Eclipse) or Tomcat/webapps/UniTime/unitime (when deployed).

You can follow the eclipse instructions (see step 4c) or use the Apache Ant build (either target redeploy-gwt or redeploy-gwtdev, see build.xml for more details).

Or, you can follow the build instructions at http://help.unitime.org/build to create the UniTime.war file and deploy that.

KarthikRv93 commented 5 years ago

Thanks for your suggestion. I used Ant build and it seems to be working fine.

KarthikRv93 commented 5 years ago

@tomas-muller, After installing I logged in as a default user "admin" password "admin". I want to create a user and import the data from the other environment. But I am unable to see the administration tab. capture Can you please suggest me as to how to create new user and import the data.

tomas-muller commented 5 years ago

Have you made any changes to the data in the UniTime database (in particular to the roles and permissions)? Are there any errors in the tomcat log?

tomas-muller commented 5 years ago

You can reset the content of the UniTime database by 1) stop the tomcat 2) run schema.sql and blank-data.sql (or schema.sql and woebegon-data.sql) 3) start the tomcat

KarthikRv93 commented 5 years ago

@tomas-muller , I just ran schema.sql and black-data.sql. Now I am not able to login using username "admin" password: "admin". Error on console: [03/07/19 13:41:05] ERROR TaskExecutorService -> Failed to check for tasks: could not extract ResultSet org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:80) I used to get the same error previously then I ran all the database scripts manually under /UniTime/Documentation/Database/MySQL/Changes which allowed me to login.

Is there a script which runs all the SQL files in the order ?

tomas-muller commented 5 years ago

All the database updates are done automatically during the first deployment of UniTime. It is therefore important to restart the tomcat after the database has been refreshed (or as indicated earlier, stop it first, then reset the database, then start again). You should see something like this in the tomcat log:

[03/07/19 04:01:09] INFO   afterPropertiesSet ->  - Initializing Hibernate ... 
[03/07/19 04:01:09] INFO   Version -> HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
[03/07/19 04:01:09] INFO   Version -> HHH000412: Hibernate Core {4.3.11.Final}
[03/07/19 04:01:10] INFO   Dialect -> HHH000400: Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
[03/07/19 04:01:15] INFO   <init> -> Reading file:/Applications/apache-tomcat-9.0.13/webapps/UniTime/WEB-INF/lib/timetable.jar!/dbupdate.xml ...
[03/07/19 04:01:15] INFO   DatabaseUpdate -> Current UniTime database version: 123
[03/07/19 04:01:15] INFO   DatabaseUpdate ->   Performing UniTime update to version 124 (Instructor Note)
[03/07/19 04:01:16] INFO   DatabaseUpdate ->     UniTime Database version increased to: 124
[03/07/19 04:01:16] INFO   DatabaseUpdate ->   Performing UniTime update to version 125 (Solution Export XML)
[03/07/19 04:01:16] INFO   DatabaseUpdate ->     UniTime Database version increased to: 125
...
[03/07/19 04:01:29] INFO   DatabaseUpdate ->   Performing UniTime update to version 213 (Student Schedule Quality)
[03/07/19 04:01:29] INFO   DatabaseUpdate ->     UniTime Database version increased to: 213
[03/07/19 04:01:29] INFO   DatabaseUpdate ->   Performing UniTime update to version 214 (Student Min Credit Critical Requests)
[03/07/19 04:01:29] INFO   DatabaseUpdate ->     UniTime Database version increased to: 214
[03/07/19 04:01:29] INFO   DatabaseUpdate ->   Performing UniTime update to version 215 (Default Instructional Method)
[03/07/19 04:01:29] INFO   DatabaseUpdate ->     UniTime Database version increased to: 215
[03/07/19 04:01:29] INFO   DatabaseUpdate ->   Performing UniTime update to version 216 (Student Sectioning Preferences)
[03/07/19 04:01:29] INFO   DatabaseUpdate ->     UniTime Database version increased to: 216
[03/07/19 04:01:29] INFO   DatabaseUpdate -> New UniTime database version: 216
[03/07/19 04:01:29] INFO   afterPropertiesSet ->  - Creating Message Log Appender ... 
[03/07/19 04:01:29] INFO   afterPropertiesSet ->  - Initializing Room Availability Service ... 
[03/07/19 04:01:29] INFO   afterPropertiesSet ->  - Cleaning Logs ...
[03/07/19 04:01:30] INFO   afterPropertiesSet ->  - Starting Event Expiration Service ...
[03/07/19 04:01:30] INFO   EventExpirationService -> Event expiration service started.
[03/07/19 04:01:30] INFO   afterPropertiesSet -> ******* UniTime 4.4.67 build on Thu, 7 Mar 2019 initialized successfully *******
KarthikRv93 commented 5 years ago

@tomcas-muller, I am getting the following error in my local: Capture

I have included mysql connector in my build path but still I am getting this error. Any clue as to what might be the issue?

tomas-muller commented 5 years ago

The error indicates that UniTime was unable to connect to the database. You will need to check the tomcat log to see more details about the error. Could be an incompatible version of Connector/J ass suggested in https://stackoverflow.com/questions/50081527/cant-connect-to-mysql-from-java-nullpointerexception-inside-mysql-driver-conne.

KarthikRv93 commented 5 years ago

@tomas-muller, Can you please let me know how to view the logs for this project. I have viewed all the log files in tomcat/log if I output the value as Progress() then I am able to see the output but if I am able to view to output from logfactory or System.out.println I am not able to view the same. Can you please help me on the same?

tomas-muller commented 5 years ago

The UniTime log messages are usually located in tomcat/log/catalina.out and tomcat/log/unitime.log.

UniTime is using log4j for logging. The logging should be configured automatically. If it is not, please try to enable log4j as described in this document.

KarthikRv93 commented 5 years ago

@tomas-muller, Thanks for your suggestion. It's working fine now.

KarthikRv93 commented 5 years ago

@tomas-muller, We want to add criteria just like BackToBack.java. This criterion is to restrict online classes. I have tried to make it a hard constraint like max load but doesnt work because it doesn't find a solution (Reason might be there are more online courses than the instructor so some courses end up getting unassigned). I realized we have to make this feature a soft constraint I have made the code changes but it doesn't seem to have changed the solution as expected. Can you please suggest me what I might be doing wrong ?

Referrence : Criteria :https://github.com/KarthikRv93/cpsolver/blob/master/src/org/cpsolver/instructor/criteria/OnlineClassRestriction.java

Adding criteria to the model: https://github.com/KarthikRv93/cpsolver/blob/09c277e480898363da975f88580520d43b341b2d/src/org/cpsolver/instructor/model/InstructorSchedulingModel.java#L88

tomas-muller commented 5 years ago

It looks like you want to penalize cases when an instructor has more than two online courses. However, the way the OnlineClassRestriction.getValue(...) is written is not incremental -- the value of this criterion is increased by 1000 every time an instructor get assigned third or later online class, however, the criterion is NEVER decreased, even when the third (or later) online class is unassigned or moved to some other instructor. This means that the value of this criterion will just keep on increasing as the search progresses.

Also, while the critrion is penalizing assigning an instructor with third or later online class, it provides no incentive for the solver to remove a third or later online class from an instructor.

Please take a closer look at the BackToBack criterion.

  1. First of all, the Back2Back criterion set to not automatically update as there is the following line in the constructor setValueUpdateType(ValueUpdateType.NoUpdate);

  2. Instead, the value of the Back2Back criterion is recomputed for each instructor when there is a change, see Instructor.updateCriteria(...)

  3. Instructor.countBackToBacks(...) that is used during evaluation returns the number of back-to-backs an instructor would have after the assignment change, which privides insentive to decrease (or increase) the number of back-to-backs based on the instructor's preference

Also, please note that this last question is not related to the UniTime/unitime project and it is not even remotely related to the original question.

KarthikRv93 commented 5 years ago

@tomas-muller, Thanks for your suggestion. I will post the future queries under cpsolver repository.

baziljoseph commented 4 years ago

I am trying to install "University Timetabling". I don't have experience in Java or tomcat. I have installed MySQL 8, OpenJDK 11 and tomcat 8 on ubuntu 18 as per the documentation. While importing the SQL I got some error due MySQL 8 password validation and grand option so I edited(changed default password) SQL and imported(both schema and blank SQL) the script successfully. But now I am getting the following error.

"UniTime 4.4.140 failed to start up properly, please check the application log for more details. HibernateException: Could not create a DBCP pool (at DBCPConnectionProvider.java:177) SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'timetable'@'localhost' (using password: YES)) (at BasicDataSource.java:1549) SQLException: Access denied for user 'timetable'@'localhost' (using password: YES) (at SQLError.java:129) "

Please help me fix this error. Tomcat is installed on /opt/tomcat/. Can you tell me in which file password needs to be updated if this is the issues?

I tried to add following in custom.properties. but I am not exactly sure were the custom.properties should be placed or if anything else is overriding it. Is there anything specific need to be done for MySQL 8

     # MySQL Configuration Example
     connection.url=jdbc:mysql://localhost:3306/timetable
     connection.username=timetable
     connection.password=sadsa@@#5455A$7A@@
     connection.driver_class=com.mysql.jdbc.Driver
     dialect=org.hibernate.dialect.MySQLInnoDBDialect
     tmtbl.uniqueid.generator=org.hibernate.id.TableHiLoGenerator
     default_schema=timetable

Screenshot of the same is also attached

last few lines of catalina.out ERROR TaskExecutorService -> Failed to check for tasks: The session factory has not been initialized (or an error occured during initialization) java.lang.RuntimeException: The session factory has not been initialized (or an error occured during initialization) at org.unitime.timetable.model.base._BaseRootDAO.getSessionFactory(_BaseRootDAO.java:111) at org.unitime.timetable.model.base._BaseRootDAO.getSession(_BaseRootDAO.java:151) at org.unitime.timetable.model.base._BaseRootDAO.createNewSession(_BaseRootDAO.java:141) at org.unitime.timetable.server.script.TaskExecutorService.checkForQueuedTasks(TaskExecutorService.java:67) UniTime 4 4

tomas-muller commented 4 years ago

The problem is that UniTime is not able to connect to the database:

   java.sql.SQLException: Access denied for user 'timetable'@'localhost' (using password: YES)

You can try to connect to the database as the timetable user using mysql tool with the following options (also trying to use the same port and protocol as the UniTime application):

   mysql --user=timetable --password=unitime --port=3306 --host=localhost --protocol=TCP timetable

If you are able to connect to mysql with "mysql -utimetable -punitime timetable" but not with "mysql --user=timetable --password=unitime --port=3306 --host=localhost --protocol=TCP timetable", the problem could be that TCP/IP networking is disabled.

The above description is using the UniTime's default database password (unitime), if you have set a different password, you need to change the --password parameter.

For the custom.properties file to be used, you need to add the following line in the catalina.properties file (e.g., /etc/tomcat8/catalina.properties):

   tmtbl.custom.properties=/etc/tomcat8/custom.properties

Also, since you are using MySQL 8, you may need to set the serverTimezone parameter when you see the following error, which does not seem to be the case:

   SQLNestedException: Cannot create PoolableConnectionFactory (The server time zone value 'PDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.) (at BasicDataSource.java:1549) 

The database connection string (property connection.url) can be changed using the catalina.properties or in the custom.properties or unitime.properties file if you have created it (e.g., see Timetabling Installation: Customization or step 6 of the UniTime Linux Installation document for more details). It should be something like this (when the serverTimezone parameter is included):

   connection.url=jdbc:mysql://localhost:3306/timetable?serverTimezone=Europe/Prague
baziljoseph commented 4 years ago

Hi Tomas,

Thanks for the quick replay. I tried the following "mysql --user=timetable --password=unitime --port=3306 --host=localhost --protocol=TCP timetable"

This command worked and I was able to login to MySQL shell.

As there were no files in /etc/tomcat8/. I have created /opt/tomcat/conf/custom.properties and added following in it.

MySQL Configuration Example

connection.url=jdbc:mysql://localhost:3306/timetable connection.username=timetable connection.password=sadsa@@#5455A$7A@@ connection.driver_class=com.mysql.jdbc.Driver dialect=org.hibernate.dialect.MySQLInnoDBDialect tmtbl.uniqueid.generator=org.hibernate.id.TableHiLoGenerator default_schema=timetable

Also updated /opt/tomcat/conf/catalina.properties and add the following to the bottom of the file

tmtbl.custom.properties=/opt/tomcat/conf/custom.properties

Then I updated the permission forcustom.properties with tomcat user and I removed files in the work folder and restarted the tomcat. But still, I am getting the same access denied error.

tomas-muller commented 4 years ago

Yes, that should work.

When you were able to connect using the following command:

mysql --user=timetable --password=unitime --port=3306 --host=localhost --protocol=TCP timetable

did you change the password parameter to what you have in the custom.properties file (sadsa@@#5455A$7A@@)? Because the above command is using the default password unitime, which is what you get by using the schema.sql.

baziljoseph commented 4 years ago

command i used was "mysql --user=timetable --password=sadsa@@#5455A$7A@@ --port=3306 --host=localhost --protocol=TCP timetable" Yes. I changed to "sadsa@@#5455A$7A@@" in custom.properties

tomas-muller commented 4 years ago

I do not see a reason why this is not working. Could you try to put the database connection properties directly at the end of the /opt/tomcat/conf/catalina.properties file?

baziljoseph commented 4 years ago

Thank a lot Tomas, As default password was blocked by MySQL password validate. After creating the user(timetable) I Altered the password to the default using the following command. I don't know if its a good method. I am able to login now.

As per MySql doc "Passwords specified as hashed values are not checked because the original password value is not available for checking:"

ALTER USER 'timetable'@'localhost' IDENTIFIED WITH mysql_native_password AS '*2E46E61A1C47ADC309CADC6DF8D89654F013D3DD';

Thanks :)

mohamed-azzam commented 4 years ago

I got this error when trying to login username admin password admin Authentication failed: could not extract ResultSet. error

tomas-muller commented 4 years ago

Looks like your database was not properly updated during the first deployment of UniTime. You need to use both the schema.sql and either the woebegon-data.sql or blank-data.sql. You can fix that by:

  1. stop the Tomcat
  2. run the blank-data.sql or woebegon-data.sql (if this does not work, run schema.sql first, then xx-data.sql again)
  3. start the Tomcat

Check the logs, you should see something like this:

[07/09/20 04:01:55] INFO   <init> -> Reading file:/Applications/apache-tomcat-9.0.13/webapps/UniTime/WEB-INF/lib/timetable.jar!/dbupdate.xml ...
[07/09/20 04:01:55] INFO   DatabaseUpdate -> Current UniTime database version: 123
[07/09/20 04:01:55] INFO   DatabaseUpdate ->   Performing UniTime update to version 124 (Instructor Note)
[07/09/20 04:01:55] INFO   DatabaseUpdate ->     UniTime Database version increased to: 124
...
[07/09/20 04:02:10] INFO   DatabaseUpdate ->   Performing UniTime update to version 228 (Advisor Critical Course Requests)
[07/09/20 04:02:10] INFO   DatabaseUpdate ->     UniTime Database version increased to: 228
[07/09/20 04:02:10] INFO   DatabaseUpdate ->   Performing UniTime update to version 229 (Important Course Demands)
[07/09/20 04:02:11] INFO   DatabaseUpdate ->     UniTime Database version increased to: 229
[07/09/20 04:02:11] INFO   DatabaseUpdate ->   Performing UniTime update to version 230 (Instructor Unavailable Days)
[07/09/20 04:02:11] INFO   DatabaseUpdate ->     UniTime Database version increased to: 230
[07/09/20 04:02:11] INFO   DatabaseUpdate -> New UniTime database version: 230

The last version depends on the UniTime version that you are trying to install. It is 225 for the latest UniTime 4.4, 233 for the latest UniTime 4.5.

mohamed-azzam commented 4 years ago

i got the same error

tomas-muller commented 4 years ago

Could you share the whole log?

mohamed-azzam commented 4 years ago

thank u for helping me here is the log file log.txt

tomas-muller commented 4 years ago

It appears that the database update to version 130 has failed:

[07/09/20 13:00:53] ERROR DatabaseUpdate -> Update to version 130 failed.

You can update the database manually using the 130 Inherit Instructor Preferences Toggle.sql script. Stop the tomcat first, and try to start it up afterward and check if it starts updating with the following versions. All the update scripts are available at Documentation/Database/MySQL/Changes.

tomas-muller commented 4 years ago

The Documentation/Database/MySQL/Changes contains all update files, each file starts with the version number. Since the update 130 failed, you can:

1) stop the tomcat 2) open MySQL client (e.g., type in the following command on the console / command line) mysql -utimetable -punitime timetable 3) copy and paste the content of the 130 Inherit Instructor Preferences Toggle.sql script (some changes may fail, but it is fine -- e.g., it appears that the instructor_pref column has been already created) 4) start the tomcat 5) check the logs

mohamed-azzam commented 4 years ago

thanks for quick replay i will try and give u feedback

mohamed-azzam commented 4 years ago

sorry i got the same error after update 130 Inherit Instructor Preferences Toggle.sql here is the log log_2.txt

Updated Thanks it run will now