Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1149189
  • 博文数量: 309
  • 博客积分: 6093
  • 博客等级: 准将
  • 技术积分: 3038
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-03 17:14
个人简介

linux学习记录

文章分类

全部博文(309)

文章存档

2014年(2)

2012年(37)

2011年(41)

2010年(87)

2009年(54)

2008年(88)

分类:

2008-09-22 13:17:39

Contents

[]

Q1: The session factory has not been initialized (or an error occurred during initialization).

The reason why session factory failed to initialize is usually listed in the tomcat log. It is located at ${TOMCAT_HOME}/logs/catalina.out or ${TOMCAT_HOME}/logs/catalina.date.log.

If everything goes right, you should be able to see the following messages in the log:

[11/06/07 17:03:45] INFO   logMessage -> ******* Initializing Timetabling Application : START *******
[11/06/07 17:03:45] INFO logMessage -> - Initializing Debugger ...
[11/06/07 17:03:45] INFO load -> Reading file:/Library/Tomcat/webapps/UniTime/WEB-INF/lib/timetable.jar!/application.properties ...
[11/06/07 17:03:45] INFO logMessage -> - Initializing Hibernate ...
[11/06/07 17:03:47] INFO ConnectionProviderFactory -> Initializing connection provider: org.unitime.commons.hibernate.connection.DBCPConnectionProvider
[11/06/07 17:03:47] INFO Dialect -> Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
[11/06/07 17:03:47] INFO TransactionFactoryFactory -> Using default transaction strategy (direct JDBC transactions)
[11/06/07 17:03:47] INFO TransactionManagerLookupFactory -> No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[11/06/07 17:03:47] INFO ASTQueryTranslatorFactory -> Using ASTQueryTranslatorFactory
[11/06/07 17:03:47] INFO SessionFactoryImpl -> building session factory
[11/06/07 17:03:48] INFO run -> InfoCache cleanup thread started.
[11/06/07 17:03:51] INFO SessionFactoryObjectFactory -> Not binding factory to JNDI, no JNDI name configured
[11/06/07 17:03:51] INFO UpdateTimestampsCache -> starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCache
[11/06/07 17:03:51] INFO StandardQueryCache -> starting query cache at region: org.hibernate.cache.StandardQueryCache
[11/06/07 17:03:51] INFO logMessage -> - Initializing Solver Register ...
[11/06/07 17:03:51] INFO SolverRegisterService -> service started
[11/06/07 17:03:51] INFO logMessage -> ******* Timetabling Application : Initializing DONE *******

If not, please refer to the following FAQs and/or write us an email to . Please, do not forget to attach the tomcat log.


Q2: Untrusted apps are not allowed to connect to or launch Window Server before login.

If you see the above message (or similar) in the tomcat log, the problem can be easily fixed by setting Java system property java.awt.headless to true. You can do this, e.g., by calling

On Unix/Linux/MacOS:

export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"

On Windows:

set JAVA_OPTS=%JAVA_OPTS% -Djava.awt.headless=true

prior to starting Tomcat.


Q3: Table APPLICATION_CONFIG or USERS not found.

On Lynux based systems, MySQL is case sensitive on table names by default. To change this, add the following line to the /etc/my.cnf file. This forces MySQL to translate all table names to lowercase before executing the statement.

lower_case_table_names=1


Q4: Access denied for user 'timetable'@'localhost'

Is the user timetable created? Was there any error/message printed during creation of the timetable database (execution of file schema.sql)? Are you using the default password (unitime)?

You can verify some of that by checking the content of table mysql.user (there should be a line with user=timetable). You can also try to connect to the database as 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 the user is there, but you cannot connect to the database with the above line, try to post the following sql commands (as mysql root):

update mysql.user set password=PASSWORD('unitime') where user='timetable';
commit;
grant all on timetable.* to timetable;
flush privileges;


Q5: Unable to locate a login configuration

It seems that the JAAS (Java Authentication and Authorization Service) configuration file is not being used. Do you have the file .java.login.config in the home folder of the user who is running tomcat with the following lines in it?

Timetabling {
org.unitime.timetable.authenticate.jaas.DbAuthenticateModule required;
};

If it is there, you can try to tell Java about it by setting Java system property java.security.auth.login.config. You can do that by setting JAVA_OPTS environmental variable before starting tomcat, e.g.:

On Unix/Linux/MacOS:

export JAVA_OPTS="${JAVA_OPTS} -Djava.security.auth.login.config=/path/.java.login.conf"

On Windows:

set JAVA_OPTS=%JAVA_OPTS% -Djava.security.auth.login.config=path\.java.login.conf


Q6: Authentacation Failed

Is there any error in the tomcat's log?

If not, please enable debugging in JAAS configuration file .java.login.config, i.e., add debug=true at the end of the DbAuthenticateModule line:

Timetabling {
org.unitime.timetable.authenticate.jaas.DbAuthenticateModule required debug=true;
};

Now, when you try to login, there should be some messages in the log showing that the correct authentication module is used (message " Performing db authentication ...") and explaining why the login failed.

There is a possibility that a password hash is computed differently due to a use of a different Java or operation system (we are using MD5 encoding provided by Java class java.security.MessageDigest). If the password is incorrect, there should be the following messages in the log (when JAAS debugging is enabled):

Performing db authentication ...
Db authentication failed ...
ERROR execute -> Login Failure: all modules ignored

In such a case, please generate a new password hash using solver/timetable.jar that is a part of the UniTime distribution (solver folder), i.e., execute:

java -cp solver/timetable.jar org.unitime.timetable.authenticate.jaas.DbAuthenticateModule admin

It just prints one string which is the hash of the given argument admin, in my case, it is "ISMvKXpXpadDiUoOSoAfww==". This string needs to be set as password in the users table, i.e.,

update timetable.users set password='ISMvKXpXpadDiUoOSoAfww==' where username='admin';
commit;

The users table seems to have the correct content for user admin with password admin (assuming the password hash gets computed the same way). Besides of this, there should be a line in timetable_manager table with external_uid column set to 1 (i.e., there is a timetabling manager associated with the user admin). There should be also a line in tmtbl_mgr_to_roles table linking the timetabling manager with an administrator role (roles table). Also, there should be a line in the sessions table.


Q7: Not enough resources to create a solver instance, please try again later.

You need to increase the memory limit for the tomcat (in order to prevent OutOfMemory exceptions, solver refuses to start unless there are 200MB available, which is an estimated size for solving of a problem with about 1000 classes). To increase the memory limit, you can for instance add -Xmx512m to JAVA_OPTS environmental variable before starting tomcat (this will allow tomcat to allocate up to 512MB of memory, default is 64MB):

On Unix/Linux/MacOS:

 export JAVA_OPTS="${JAVA_OPTS} -Xmx512m"

On windows:

 set JAVA_OPTS=%JAVA_OPTS% -Xmx512m

Alternatively, the limit on variable memory can be changed by setting the application property tmtbl.solver.mem_limit. This can be done using JAVA_OPTS environment variable before starting tomcat:

On Unix/Linix/MacOS:

 export JAVA_OPTS="${JAVA_OPTS} -Dtmtbl.solver.mem_limit=50"

On Windows:

 set JAVA_OPTS=%JAVA_OPTS% -Dtmtbl.solver.mem_limit=50

This limit is megabytes, it is applicable only on the tomcat side, the same limit is used for all solver servers.

Q8: Error during query: Unexpected Exception: java.io.CharConversionException message given: null

This problem is discussed in this MySQL forum thread where some potential solutions are listed as well.

In most cases the problem seemed to be resolved by using a newer version of Java (e.g., java 1.5 instead of some 1.4.x).

Other solution seems to be to set default-character-set variable to utf8 in mysql configuration (usually located at /etc/my.cnf, both mysqld and client sections):

 [client]
default-character-set=utf8
 [mysqld]
default-character-set=utf8

The mysql will use utf8 after it is restarted.

Q9: Unable to configure hibernate, reason: Connection refused: connect OR No route to host

Such an exception is thrown when (the tool we us for communicating with the database) is not able to validate the configuration XML files, with the DTD that is available online at . Basically, it was unable to download this hibernate-configuration-3.0.dtd file.

Do you have an internet connection and can you access this url (i.e., )?

If so, try to restart tomcat again. Occasionally it fails to get this file because of some timeout etc.

If not, there are the following two workarounds:

1. Disconnect all your networks, then start tomcat, then you can connect them back. If there is no connection, hibernate does not try to validate the given configuration (but it will still load it). Your need to have your database installed on the same machine as the tomcat though.

2. Remove the following lines from hibernate.cfg.xml (2nd – 4th line)

    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"" >

This file is located in the file timetable.jar, that is located in UniTime.war (in folder WEB-INF/lib). Both files (UniTime.war, timetable.jar) can unzipped/zipped using ZIP (e.g., WinZip).

Alternatively, you can go to ${tomcat_home}/webapps and:
  • Delete UniTime.war (it should be already unzipped into ${tomcat_home}/webapps/UniTime)
  • Create folder classes under ${tomcat_home}/webapps/UniTime/WEB-INF
  • Unzip all content of ${tomcat_home}/webapps/UniTime/WEB-INF/lib/timetable.jar into the new classes folder (${tomcat_home}/webapps/UniTime/WEB-INF/classes)
  • Delete timetable.jar (files from the folder classes will be used instead)
  • Edit file classes/hibernate.cfg.xml, delete the above three lines
  • Start tomcat
阅读(1310) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~