Alfresco安装后启动异常处理
生活随笔
收集整理的這篇文章主要介紹了
Alfresco安装后启动异常处理
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
當出現下面這些出錯信息時,只要知道其出錯的原理,就很容易解決它。?
⑴ org.alfresco.error.AlfrescoRuntimeException?
不能直接在alfresco/tomcat/bin中運行startup.bat啟動Tomcat,會報錯:?
00:31:34,687 ERROR [web.context.ContextLoader] Context initialization failed?
org.springframework.beans.factory.BeanCreationException: Error creating bean wit?
h name 'dictionaryRepositoryBootstrap' defined in class path resource [ alfresco/?
core-services-context.xml ]: Invocation of init method failed; nested exception i?
s org.alfresco.error.AlfrescoRuntimeException: Failure during rollback: org.alfr?
esco.repo.dictionary.DictionaryRepositoryBootstrap$1@2589c3?
Caused by:?
org.alfresco.error.AlfrescoRuntimeException : Failure during rollback: org.alfres?
co.repo.dictionary. DictionaryRepositoryBootstrap $1@2589c3??????
出錯是因為在alfresco/tomcat/bin中運行startup.bat啟動Tomcat,找不到相應的HSQL database的初始化信息,可以參考下面的 ⑶仔細思考一下。?
注1: 思考之后,你也許會嘗試把alfresco/alf_data/hsql_data這個文件夾放到alfresco/tomcat/bin目錄中,然后再次運行startup.bat啟動Tomcat,你可以看一下運行結果會怎樣,這會幫助你理解alfresco初始化)。?
注2: 如果你使用的是mysql數據庫,而mysql數據庫沒有運行mysqld啟動的話,也會報上面錯誤。?
⑵ 在alfresco.bat中這樣幾行字:?
rem The following options are only required for Sun JVMs prior to 1.5 update 8?
set JAVA_OPTS=%JAVA_OPTS% -XX:CompileCommand=exclude,org/apache/lucene/index/IndexReader$1,doBody -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo$Merger,mergeIndexes -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo$Merger,mergeDeletions?
注意上面綠色信息,如果你的JDK版本過低的話,上面這一行字是必須的。?
注: java -version 可以查看JDK版本?
我本機版本查看如下:?
java version "1.5.0_04"?
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)?
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)?
J2SE Development Kit 1.5 update 5?
如上,說明JDK版本是J2SE Development Kit 1.5 update 5,那么上面alfresco.bat中的幾行字按照上面綠色注釋也是必須加的。?
不過我嘗試去掉上面alfresco.bat中的幾行字,并沒有報錯,估計1.5 update 5到1.5 update 7中alfresco.bat中的幾行字也都是可以去掉的。?
要想去掉上面alfresco.bat中的幾行字,必須下載JDK的相應版本,下載地址為:http://java.sun.com/products/archive/?
⑶ alfresco/alf_data 下面有一個hsql_data文件夾,存放的是一些HSQL database的初始化信息,如果刪除,也會報 ⑴中的錯?
hsql_data 下面有兩個文件?
alfresco.properties :配置HSQL數據庫的一些初始化參數?
alfresco.script :創建HSQL數據庫用戶的sql語句,默認創建兩個HSQL用戶(如下)。?
CREATE USER SA PASSWORD ""?
CREATE USER ALFRESCO PASSWORD "ALFRESCO"?
注: 啟動alfresco時,如果HSQL數據庫被更改,alfresco.properties文件會被更新,文件中的modified=no更新為modified=yes?
⑷ 清空初始化信息和緩存(呵呵,當你進入http://localhost:8080/alfresco/進行了一些CRUD的操作之后就不要隨便清空了,這會重新初始化你的HSQL數據庫)。?
比較重要的一點是在出錯之后如果使用alf_start.bat重新啟動alfresco,最好要刪除清空文件夾:alfresco/alf_data(見注1),alfresco/tomcat/temp,否則很可能會報錯。?
注1: 使用alf_start.bat重新啟動alfresco后,會在alfresco/alf_data下生成4個文件夾:lucene-indexes/contentstore.deleted/contentstore/audit.contentstore?
注2: 其中alfresco/alf_data/hsql_data文件夾千萬不能刪除,原因如 ⑶所述?
注3: 另外,為徹底一點,你也可以清空alfresco/tomcat/work(tomcat下的/緩存文件夾)。?
⑸ 如果出現下面錯誤:?
Exception in thread " HSQLDB Timer @3de2df" java.lang.NullPointerException?
??????? at org.hsqldb.lib.HsqlTimer.nextTask(Unknown Source)?
??????? at org.hsqldb.lib.HsqlTimer$TaskRunner.run(Unknown Source)?
??????? at java.lang.Thread.run(Thread.java:595)?
可能是alfresco關閉時不正常,可以再次運行alfresco/alf_stop.bat進行關閉。?
⑹ 如果刪除alfresco/bin下的Win32NetBIOS.dll(我本機是32位XP系統,64位的對應Win32NetBIOSx64.dll),啟動alfresco/alf_start.bat時會出現下面錯誤:?
10:38:11,046 INFO? [repo.module.ModuleServiceImpl] Found 0 module(s).?
java.lang.UnsatisfiedLinkError: no Win32NetBIOS in java.library.path?
出現這種錯誤是因為刪除了Win32NetBIOS.dll,查看alfresco/alfresco.bat,可以看到:?
set PATH=%ALF_HOME%bin;%PATH%?
在啟動alfresco/alfresco.bat時java.library.path也會使用PATH中的路徑(alfresco/bin)去尋找相應的Win32NetBIOS.dll,如果找不到,就會報上面的錯誤。?
注1: 新建一個JAVA類,在其中調用System.out.println(System.getProperty("java.library.path"));?
可以得到java.library.path的值。?
下面是我本機得到的結果:?
C:\Java\jdk1.5.0_04\bin; .;C:\WINDOWS\system32;C:\WINDOWS;C:\Java\jdk1.5.0_04\bin;D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;E:\apache-ant-1.6.3\bin;E:\maven-1.0.2\bin;D:\mysql-5.0.45-win32\bin;C:\Program Files\OpenSSH\bin;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Subversion\bin?
觀察上面的java.library.path的值,可以看到它大概包括了三部分,即windows系統環境變量中PATH + JAVA_HOME/bin + 系統路徑(.;C:\WINDOWS\system32;C:\WINDOWS;)?
注2: 為了不依賴于alfresco/bin/Win32NetBIOS.dll這個路徑(如果你下載不是 alfresco-community-tomcat-2.1.0.zip 這種內嵌tomcat的版本,而是一個單獨的 alfresco-community-war-2.1.0.zip ,這點會非常有用),你可以把Win32NetBIOS.dll拷貝到C:\Java\jdk1.5.0_04\bin或C:\WINDOWS\system32路徑中,刪除alfresco/bin/Win32NetBIOS.dll依然可以使用alfresco/alf_start.bat正常啟動alfresco。?
⑺ 下面出錯信息:?
org.alfresco.error.AlfrescoRuntimeException: Ensure that the 'dir.root' property?
is pointing to the correct data location.?
alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco 下的repository.properties文件中:?
# Change the failure behaviour of the configuration checker?
system.bootstrap.config_check.strict=true?
改為:?
# Change the failure behaviour of the configuration checker?
system.bootstrap.config_check.strict=false?
16:30:32,546 ERROR [ConfigurationChecker] CONTENT INTEGRITY ERROR: Indexes not found for 5 stores.?
alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco 下的repository.properties文件中:?
# The index recovery mode (NONE, VALIDATE, AUTO, FULL)?
index.recovery.mode=VALIDATE?
改為:?
# The index recovery mode (NONE, VALIDATE, AUTO, FULL)?
index.recovery.mode=FULL?
可以重新創建索引。?
2 . alfresco 默認數據庫HSQL database?
① alfresco默認使用的數據庫為HSQL database,可在alfresco\tomcat\shared\classes\alfresco\extension中找到兩個與數據庫定義相關的文件custom-hibernate-dialect.properties和custom-repository.properties(還可以定義一些其它系統配置),其中?
custom-hibernate-dialect.properties :?
hibernate.dialect=org.hibernate.dialect.HSQLDialect?
custom-repository.properties :?
db.driver=org.hsqldb.jdbcDriver?
db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;?
這兩個文件是在alfresco\tomcat\shared\classes\alfresco\extension\custom-repository-context.xml中加載的。?
② 在alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco下有另外的一個文件repository.properties,這個文件與上面的custom-repository.properties相對應,如果在兩個properties文件中定義了相同的key/value資源,在加載文件中的資源時,custom-repository.properties會覆蓋repository.properties中的(實際上是map中value被覆蓋),這與兩者的加載順序有關:?
alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\application-context.xml 中先后加載(見下)。?
<import resource="classpath:alfresco/core-services-context.xml" />?
<import resource="classpath*:alfresco/extension/*-context.xml"/>?
repository.properties 與custom-repository.properties分別在core-services-context.xml與custom-repository-context.xml中指定?
注 : 查看repository.properties文件,可以看到?
db.username=alfresco?
db.password=alfresco?
這與上面1.- ② - ⑶ 中使用alfresco.script創建HSQL數據庫用戶的sql語句是對應的。?
3 . 把hsql轉為mysql(使用幫助也可參考alfresco/ README_mysql.txt )?
① alfresco 使用mysql數據庫?
⑴ 實際發布的時候一般不建議使用HSQL database這種文件型數據庫。?
啟動alf_start.bat可以看到控制臺有一行提示:?
11:10:57,062 INFO? [domain.schema.SchemaBootstrap] Alfresco is using the HSQL de?
fault database. Please only use this while evaluating Alfresco, it is NOT recomm?
ended for production or deployment!?
使用mysql數據庫前清空文件夾:alfresco/alf_data(其中alfresco/alf_data/hsql_data文件夾可以刪除,因為這時已經用不到HSQL數據庫了),alfresco/tomcat/temp, alfresco/tomcat/work。?
⑵ 打開alfresco/extras/databases/mysql下的db_setup.sql,可以看到:?
create database alfresco;?
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;?
grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;?
上面創建了alfresco數據庫,并創建用戶名alfresco密碼alfresco,分配管理權限。?
為確保國際化,統一使用UTF8編碼(alfresco/ README_mysql.txt 中也有提到),db_setup.sql修改為:?
create database alfresco DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;?
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;?
grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;?
運行alfresco/extras/databases/mysql/db_setup.bat,即可創建mysql數據庫。?
② alfresco\tomcat\shared\classes\alfresco\extension 中找到兩個與數據庫定義相關的文件custom-hibernate-dialect.properties和custom-repository.properties(還可以定義一些其它系統配置),其中?
custom-hibernate-dialect.properties :?
hibernate.dialect=org.hibernate.dialect.HSQLDialect?
custom-repository.properties :?
db.driver=org.hsqldb.jdbcDriver?
db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;?
修改為?
custom-hibernate-dialect.properties :?
#hibernate.dialect=org.hibernate.dialect.HSQLDialect?
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect?
custom-repository.properties :?
#db.driver=org.hsqldb.jdbcDriver?
#db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;?
db.driver=org.gjt.mm.mysql.Driver?
db.url=jdbc:mysql://localhost/alfresco?
默認的alfresco數據庫用戶名和密碼位于alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco下的repository.properties文件中(可參考2.- ② -注)。?
③ 啟動alfresco/alf_start.bat,可以看到在alfresco/alf_data下生成4個文件夾:lucene-indexes/contentstore.deleted/contentstore/audit.contentstore。?
alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco 下的repository.properties文件中定義了這些初始化參數:?
# Directory configuration?
dir.root=./alf_data?
dir.contentstore=${dir.root}/contentstore?
dir.contentstore.deleted=${dir.root}/contentstore.deleted?
dir.auditcontentstore=${dir.root}/audit.contentstore?
# The location for lucene index files?
dir.indexes=${dir.root}/lucene-indexes?
# The location for lucene index locks?
dir.indexes.lock=${dir.indexes}/locks?
注: alfresco 數據庫中保存的是一些數據庫關系(以及JBPM的一些表),比如預定義的permission/node/access_control等,而數據(data)和內容(content)保存在alfresco/alf_data文件夾下。?
4 . 使用mysql數據庫亂碼問題?
① 如上3.轉換為mysql數據庫后,訪問http://localhost:8080/alfresco/如果語言選擇中文,進入系統后一些地方會出現中文亂碼。?
我使用的是mysql-5.0.45-win32解壓版數據庫,如果出現亂碼,首先確保你數據庫編碼設置正確,使用show variables like 'chara%';查看你數據庫編碼,比較重要的有四個編碼:?
character_set_client : 客戶端字符集(應用程序客戶端使用的字符集)。?
character_set_connection : 連接字符集。?
character_set_results : 指的是使用sql查詢處理以后返回結果使用的字符集。?
character_set_database : 指的數據庫表中物理存儲使用的字符集。?
因為alfresco代碼使用的是utf8格式,所以在使用?
create database alfresco DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;?
創建數據庫之前,首先設置mysql數據庫編碼,這樣在啟動alfresco/alf_start.bat初始化mysql數據庫時(創建alfresco表和數據)時,才能保證表和數據格式的正確。?
set character_set_database='gbk';? (設置為gbk可以在查看表數據時顯示中文數據)?
set names 'utf8'; (設置character_set_client/ character_set_connection/ character_set_results字符集)?
alfresco\tomcat\shared\classes\alfresco\extension 中?
custom-repository.properties :?
db.url=jdbc:mysql://localhost/alfresco?
修改為?
custom-repository.properties :?
db.url=jdbc:mysql://localhost/alfresco?characterEncoding=gbk&useUnicode=true
⑴ org.alfresco.error.AlfrescoRuntimeException?
不能直接在alfresco/tomcat/bin中運行startup.bat啟動Tomcat,會報錯:?
00:31:34,687 ERROR [web.context.ContextLoader] Context initialization failed?
org.springframework.beans.factory.BeanCreationException: Error creating bean wit?
h name 'dictionaryRepositoryBootstrap' defined in class path resource [ alfresco/?
core-services-context.xml ]: Invocation of init method failed; nested exception i?
s org.alfresco.error.AlfrescoRuntimeException: Failure during rollback: org.alfr?
esco.repo.dictionary.DictionaryRepositoryBootstrap$1@2589c3?
Caused by:?
org.alfresco.error.AlfrescoRuntimeException : Failure during rollback: org.alfres?
co.repo.dictionary. DictionaryRepositoryBootstrap $1@2589c3??????
出錯是因為在alfresco/tomcat/bin中運行startup.bat啟動Tomcat,找不到相應的HSQL database的初始化信息,可以參考下面的 ⑶仔細思考一下。?
注1: 思考之后,你也許會嘗試把alfresco/alf_data/hsql_data這個文件夾放到alfresco/tomcat/bin目錄中,然后再次運行startup.bat啟動Tomcat,你可以看一下運行結果會怎樣,這會幫助你理解alfresco初始化)。?
注2: 如果你使用的是mysql數據庫,而mysql數據庫沒有運行mysqld啟動的話,也會報上面錯誤。?
⑵ 在alfresco.bat中這樣幾行字:?
rem The following options are only required for Sun JVMs prior to 1.5 update 8?
set JAVA_OPTS=%JAVA_OPTS% -XX:CompileCommand=exclude,org/apache/lucene/index/IndexReader$1,doBody -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo$Merger,mergeIndexes -XX:CompileCommand=exclude,org/alfresco/repo/search/impl/lucene/index/IndexInfo$Merger,mergeDeletions?
注意上面綠色信息,如果你的JDK版本過低的話,上面這一行字是必須的。?
注: java -version 可以查看JDK版本?
我本機版本查看如下:?
java version "1.5.0_04"?
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)?
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)?
J2SE Development Kit 1.5 update 5?
如上,說明JDK版本是J2SE Development Kit 1.5 update 5,那么上面alfresco.bat中的幾行字按照上面綠色注釋也是必須加的。?
不過我嘗試去掉上面alfresco.bat中的幾行字,并沒有報錯,估計1.5 update 5到1.5 update 7中alfresco.bat中的幾行字也都是可以去掉的。?
要想去掉上面alfresco.bat中的幾行字,必須下載JDK的相應版本,下載地址為:http://java.sun.com/products/archive/?
⑶ alfresco/alf_data 下面有一個hsql_data文件夾,存放的是一些HSQL database的初始化信息,如果刪除,也會報 ⑴中的錯?
hsql_data 下面有兩個文件?
alfresco.properties :配置HSQL數據庫的一些初始化參數?
alfresco.script :創建HSQL數據庫用戶的sql語句,默認創建兩個HSQL用戶(如下)。?
CREATE USER SA PASSWORD ""?
CREATE USER ALFRESCO PASSWORD "ALFRESCO"?
注: 啟動alfresco時,如果HSQL數據庫被更改,alfresco.properties文件會被更新,文件中的modified=no更新為modified=yes?
⑷ 清空初始化信息和緩存(呵呵,當你進入http://localhost:8080/alfresco/進行了一些CRUD的操作之后就不要隨便清空了,這會重新初始化你的HSQL數據庫)。?
比較重要的一點是在出錯之后如果使用alf_start.bat重新啟動alfresco,最好要刪除清空文件夾:alfresco/alf_data(見注1),alfresco/tomcat/temp,否則很可能會報錯。?
注1: 使用alf_start.bat重新啟動alfresco后,會在alfresco/alf_data下生成4個文件夾:lucene-indexes/contentstore.deleted/contentstore/audit.contentstore?
注2: 其中alfresco/alf_data/hsql_data文件夾千萬不能刪除,原因如 ⑶所述?
注3: 另外,為徹底一點,你也可以清空alfresco/tomcat/work(tomcat下的/緩存文件夾)。?
⑸ 如果出現下面錯誤:?
Exception in thread " HSQLDB Timer @3de2df" java.lang.NullPointerException?
??????? at org.hsqldb.lib.HsqlTimer.nextTask(Unknown Source)?
??????? at org.hsqldb.lib.HsqlTimer$TaskRunner.run(Unknown Source)?
??????? at java.lang.Thread.run(Thread.java:595)?
可能是alfresco關閉時不正常,可以再次運行alfresco/alf_stop.bat進行關閉。?
⑹ 如果刪除alfresco/bin下的Win32NetBIOS.dll(我本機是32位XP系統,64位的對應Win32NetBIOSx64.dll),啟動alfresco/alf_start.bat時會出現下面錯誤:?
10:38:11,046 INFO? [repo.module.ModuleServiceImpl] Found 0 module(s).?
java.lang.UnsatisfiedLinkError: no Win32NetBIOS in java.library.path?
出現這種錯誤是因為刪除了Win32NetBIOS.dll,查看alfresco/alfresco.bat,可以看到:?
set PATH=%ALF_HOME%bin;%PATH%?
在啟動alfresco/alfresco.bat時java.library.path也會使用PATH中的路徑(alfresco/bin)去尋找相應的Win32NetBIOS.dll,如果找不到,就會報上面的錯誤。?
注1: 新建一個JAVA類,在其中調用System.out.println(System.getProperty("java.library.path"));?
可以得到java.library.path的值。?
下面是我本機得到的結果:?
C:\Java\jdk1.5.0_04\bin; .;C:\WINDOWS\system32;C:\WINDOWS;C:\Java\jdk1.5.0_04\bin;D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;E:\apache-ant-1.6.3\bin;E:\maven-1.0.2\bin;D:\mysql-5.0.45-win32\bin;C:\Program Files\OpenSSH\bin;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Subversion\bin?
觀察上面的java.library.path的值,可以看到它大概包括了三部分,即windows系統環境變量中PATH + JAVA_HOME/bin + 系統路徑(.;C:\WINDOWS\system32;C:\WINDOWS;)?
注2: 為了不依賴于alfresco/bin/Win32NetBIOS.dll這個路徑(如果你下載不是 alfresco-community-tomcat-2.1.0.zip 這種內嵌tomcat的版本,而是一個單獨的 alfresco-community-war-2.1.0.zip ,這點會非常有用),你可以把Win32NetBIOS.dll拷貝到C:\Java\jdk1.5.0_04\bin或C:\WINDOWS\system32路徑中,刪除alfresco/bin/Win32NetBIOS.dll依然可以使用alfresco/alf_start.bat正常啟動alfresco。?
⑺ 下面出錯信息:?
org.alfresco.error.AlfrescoRuntimeException: Ensure that the 'dir.root' property?
is pointing to the correct data location.?
alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco 下的repository.properties文件中:?
# Change the failure behaviour of the configuration checker?
system.bootstrap.config_check.strict=true?
改為:?
# Change the failure behaviour of the configuration checker?
system.bootstrap.config_check.strict=false?
16:30:32,546 ERROR [ConfigurationChecker] CONTENT INTEGRITY ERROR: Indexes not found for 5 stores.?
alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco 下的repository.properties文件中:?
# The index recovery mode (NONE, VALIDATE, AUTO, FULL)?
index.recovery.mode=VALIDATE?
改為:?
# The index recovery mode (NONE, VALIDATE, AUTO, FULL)?
index.recovery.mode=FULL?
可以重新創建索引。?
2 . alfresco 默認數據庫HSQL database?
① alfresco默認使用的數據庫為HSQL database,可在alfresco\tomcat\shared\classes\alfresco\extension中找到兩個與數據庫定義相關的文件custom-hibernate-dialect.properties和custom-repository.properties(還可以定義一些其它系統配置),其中?
custom-hibernate-dialect.properties :?
hibernate.dialect=org.hibernate.dialect.HSQLDialect?
custom-repository.properties :?
db.driver=org.hsqldb.jdbcDriver?
db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;?
這兩個文件是在alfresco\tomcat\shared\classes\alfresco\extension\custom-repository-context.xml中加載的。?
② 在alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco下有另外的一個文件repository.properties,這個文件與上面的custom-repository.properties相對應,如果在兩個properties文件中定義了相同的key/value資源,在加載文件中的資源時,custom-repository.properties會覆蓋repository.properties中的(實際上是map中value被覆蓋),這與兩者的加載順序有關:?
alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\application-context.xml 中先后加載(見下)。?
<import resource="classpath:alfresco/core-services-context.xml" />?
<import resource="classpath*:alfresco/extension/*-context.xml"/>?
repository.properties 與custom-repository.properties分別在core-services-context.xml與custom-repository-context.xml中指定?
注 : 查看repository.properties文件,可以看到?
db.username=alfresco?
db.password=alfresco?
這與上面1.- ② - ⑶ 中使用alfresco.script創建HSQL數據庫用戶的sql語句是對應的。?
3 . 把hsql轉為mysql(使用幫助也可參考alfresco/ README_mysql.txt )?
① alfresco 使用mysql數據庫?
⑴ 實際發布的時候一般不建議使用HSQL database這種文件型數據庫。?
啟動alf_start.bat可以看到控制臺有一行提示:?
11:10:57,062 INFO? [domain.schema.SchemaBootstrap] Alfresco is using the HSQL de?
fault database. Please only use this while evaluating Alfresco, it is NOT recomm?
ended for production or deployment!?
使用mysql數據庫前清空文件夾:alfresco/alf_data(其中alfresco/alf_data/hsql_data文件夾可以刪除,因為這時已經用不到HSQL數據庫了),alfresco/tomcat/temp, alfresco/tomcat/work。?
⑵ 打開alfresco/extras/databases/mysql下的db_setup.sql,可以看到:?
create database alfresco;?
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;?
grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;?
上面創建了alfresco數據庫,并創建用戶名alfresco密碼alfresco,分配管理權限。?
為確保國際化,統一使用UTF8編碼(alfresco/ README_mysql.txt 中也有提到),db_setup.sql修改為:?
create database alfresco DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;?
grant all on alfresco.* to 'alfresco'@'localhost' identified by 'alfresco' with grant option;?
grant all on alfresco.* to 'alfresco'@'localhost.localdomain' identified by 'alfresco' with grant option;?
運行alfresco/extras/databases/mysql/db_setup.bat,即可創建mysql數據庫。?
② alfresco\tomcat\shared\classes\alfresco\extension 中找到兩個與數據庫定義相關的文件custom-hibernate-dialect.properties和custom-repository.properties(還可以定義一些其它系統配置),其中?
custom-hibernate-dialect.properties :?
hibernate.dialect=org.hibernate.dialect.HSQLDialect?
custom-repository.properties :?
db.driver=org.hsqldb.jdbcDriver?
db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;?
修改為?
custom-hibernate-dialect.properties :?
#hibernate.dialect=org.hibernate.dialect.HSQLDialect?
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect?
custom-repository.properties :?
#db.driver=org.hsqldb.jdbcDriver?
#db.url=jdbc:hsqldb:file:alf_data/hsql_data/alfresco;ifexists=true;shutdown=true;?
db.driver=org.gjt.mm.mysql.Driver?
db.url=jdbc:mysql://localhost/alfresco?
默認的alfresco數據庫用戶名和密碼位于alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco下的repository.properties文件中(可參考2.- ② -注)。?
③ 啟動alfresco/alf_start.bat,可以看到在alfresco/alf_data下生成4個文件夾:lucene-indexes/contentstore.deleted/contentstore/audit.contentstore。?
alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco 下的repository.properties文件中定義了這些初始化參數:?
# Directory configuration?
dir.root=./alf_data?
dir.contentstore=${dir.root}/contentstore?
dir.contentstore.deleted=${dir.root}/contentstore.deleted?
dir.auditcontentstore=${dir.root}/audit.contentstore?
# The location for lucene index files?
dir.indexes=${dir.root}/lucene-indexes?
# The location for lucene index locks?
dir.indexes.lock=${dir.indexes}/locks?
注: alfresco 數據庫中保存的是一些數據庫關系(以及JBPM的一些表),比如預定義的permission/node/access_control等,而數據(data)和內容(content)保存在alfresco/alf_data文件夾下。?
4 . 使用mysql數據庫亂碼問題?
① 如上3.轉換為mysql數據庫后,訪問http://localhost:8080/alfresco/如果語言選擇中文,進入系統后一些地方會出現中文亂碼。?
我使用的是mysql-5.0.45-win32解壓版數據庫,如果出現亂碼,首先確保你數據庫編碼設置正確,使用show variables like 'chara%';查看你數據庫編碼,比較重要的有四個編碼:?
character_set_client : 客戶端字符集(應用程序客戶端使用的字符集)。?
character_set_connection : 連接字符集。?
character_set_results : 指的是使用sql查詢處理以后返回結果使用的字符集。?
character_set_database : 指的數據庫表中物理存儲使用的字符集。?
因為alfresco代碼使用的是utf8格式,所以在使用?
create database alfresco DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;?
創建數據庫之前,首先設置mysql數據庫編碼,這樣在啟動alfresco/alf_start.bat初始化mysql數據庫時(創建alfresco表和數據)時,才能保證表和數據格式的正確。?
set character_set_database='gbk';? (設置為gbk可以在查看表數據時顯示中文數據)?
set names 'utf8'; (設置character_set_client/ character_set_connection/ character_set_results字符集)?
alfresco\tomcat\shared\classes\alfresco\extension 中?
custom-repository.properties :?
db.url=jdbc:mysql://localhost/alfresco?
修改為?
custom-repository.properties :?
db.url=jdbc:mysql://localhost/alfresco?characterEncoding=gbk&useUnicode=true
總結
以上是生活随笔為你收集整理的Alfresco安装后启动异常处理的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 批量压缩图片 | 批量转换图片
- 下一篇: EMC存储各产品线收集日志