OpenKM配置指南

OpenKM配置指南

OpenKM是一个非常优秀的电子文档管理工具。今天偶然发现,不仅被深深吸引。

配置方面,自己做一个笔记。

1、用户和组

OpenKM是基于JBoss的Java Web软件,它的用户和组的配置缺省情况下在:

{JBoss.Home}\server\default\conf\props目录下面,包含三个文件:

openkm-users.properties

openkm_roles.properties

openkm_emails.properties

分别对应着用户、用户组和用户Email的配置。都是文本文件,十分容易理解。

2、主配置文件

OpenKM的主配置文件配置(非常别扭?)在{JBoss.Home}目录下面的OpenKM.cfg文件里面,里面包含着配置文件repository.xml的位置,还包含用户组的配置以及文件上传大小限制等。

譬如:

# Default configuration values

#

# repository.config=repository.xml

# repository.home=repository

# system.user=system

# default.user.role=UserRol

# default.admin.role=AdminRol

# principal.adapter=es.git.openkm.core.UsersRolesPrincipalAdapter

# max.file.size=5

# max.search.results=25

主要的配置文件是repository.xml,我的配置好的文件(需要把Mysql JDBC Driver放到JBoss的Server\Default\lib目录)如下:

<?xml version="1.0"?>

<Repository>

<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">

<param name="driver" value="com.mysql.jdbc.Driver"/>

<param name="url" value="jdbc:mysql://192.168.1.3/openkm?autoReconnect=true"/>

<param name="schemaObjectPrefix" value="rep_"/>

<param name="schema" value="mysql"/>

<param name="user" value="openkm"/>

<param name="password" value="123456"/>

</FileSystem>

<Security appName="OpenKM">

<AccessManager class="es.git.openkm.core.OKMAccessManager"/>

<!– <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager"/> –>

</Security>

<Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" /> <Workspace name="${wsp.name}">

<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">

<param name="path" value="${wsp.home}"/>

</FileSystem>

<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager">

<param name="driver" value="com.mysql.jdbc.Driver"/>

<param name="url" value="jdbc:mysql://192.168.1.3/openkm?autoReconnect=true"/>

<param name="schemaObjectPrefix" value="${wsp.name}_"/>

<param name="schema" value="mysql"/>

<param name="externalBLOBs" value="false"/>

<param name="user" value="openkm"/>

<param name="password" value="123456"/>

</PersistenceManager>

<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex"> <param name="path" value="${wsp.home}/index"/>

<param name="useCompoundFile" value="true"/>

<param name="minMergeDocs" value="100"/>

<param name="volatileIdleTime" value="3"/>

<param name="maxMergeDocs" value="100000"/>

<param name="mergeFactor" value="10"/>

<param name="bufferSize" value="10"/>

<param name="cacheSize" value="1000"/>

<param name="forceConsistencyCheck" value="false"/>

<param name="autoRepair" value="true"/>

<param name="analyzer" value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>

<param name="respectDocumentOrder" value="false"/>

<param name="textFilterClasses" value="

org.apache.jackrabbit.core.query.lucene.TextPlainTextFilter,

org.apache.jackrabbit.extractor.MsExcelTextExtractor,

org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,

org.apache.jackrabbit.extractor.MsWordTextExtractor,

org.apache.jackrabbit.extractor.PdfTextExtractor,

org.apache.jackrabbit.extractor.HTMLTextExtractor,

org.apache.jackrabbit.extractor.XMLTextExtractor,

org.apache.jackrabbit.extractor.RTFTextExtractor,

org.apache.jackrabbit.extractor.OpenOfficeTextExtractor" />

</SearchIndex>

</Workspace>

<Versioning rootPath="${rep.home}/version">

<FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">

<param name="driver" value="com.mysql.jdbc.Driver"/>

<param name="url" value="jdbc:mysql://192.168.1.3/openkm?autoReconnect=true"/>

<param name="schemaObjectPrefix" value="ver_rep_"/>

<param name="schema" value="mysql"/>

<param name="user" value="openkm"/>

<param name="password" value="123456"/>

</FileSystem>

<PersistenceManager class="org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager">

<param name="driver" value="com.mysql.jdbc.Driver"/>

<param name="url" value="jdbc:mysql://192.168.1.3/openkm?autoReconnect=true"/>

<param name="schemaObjectPrefix" value="ver_"/>

<param name="schema" value="mysql"/>

<param name="externalBLOBs" value="false"/>

<param name="user" value="openkm"/>

<param name="password" value="123456"/>

</PersistenceManager>

</Versioning>

</Repository>

这个配置,可以用于普通的Mysql配置,在Mysql保持着文件数据,和版本信息等。

3、文件类型的管理

在OpenKM里面,可以上传的类型是有限制的。也就是说,如果在OpenKM的mime里面没有上传文件扩展名的数据,则OpenKM会提示不支持的文件类型。

可以用WinRAR打开OpenKM.ear文件来增加上传的类型,必须保护mime类型说明和相应的图标。具体步骤可以查看OpenKM的FAQ。

4、界面语言

OpenKM自身已经携带了近10种语言,包括中文支持。如果想增加语言支持,需要自己编译lang.java和相应的lang_*_*.java文件,不过非常简单,就是

1、lang.java增加几行语句,

2、lang_*_*.java另外把响应的内容翻译一下就可以了。

如果从OpenKM的SorceForge CVS库里面下载lang.java,修改一下,在增加一个语言文件,直接用javac编译一下,再加入到Ear文件里面就可以了(目前情况2.0如此,不排除以后改变的可能)。

5、速度问题

OpenKM的启动速度,不是非常快,还是等待一下,可能主要是Search Lucence的问题。

6、发布问题

如果架设Jboss成功,可能无法从远程访问,改变如下文件:

{Jboss.Home}\server\default\deploy\jboss-web.deployer\server.xml。

把8080一行后面的address改为IP地址就可以,否则只能从localhost或者127.0.0.1访问。

JBOSS 下如何配置C3P0的连接池(解决Mysql 8小时的问题)

问题引起:

在公司配置文档管理系统(OPENKM)时,把数据源切换到Mysql数据源下,经过测试,发现经过8小时后,数据库连接自动断开。

解决办法:

把原来的openkm-ds.xml删除掉。原openkm-ds.xml的内容如下:

<?xml version="1.0" encoding="UTF-8"?>

<datasources>

<!– OpenKM User Activity –>

<local-tx-datasource>

<jndi-name>OKMActivityDS</jndi-name>

<connection-url>jdbc:mysql://localhost:3306/openkm</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class>

<user-name>root</user-name>

<password>123456</password>

<min-pool-size>5</min-pool-size>

<max-pool-size>20</max-pool-size>

<idle-timeout-minutes>0</idle-timeout-minutes>

<track-statements/>

<!–<security-domain>HsqlDbRealm</security-domain>–>

<prepared-statement-cache-size>32</prepared-statement-cache-size> <metadata>

<type-mapping>mySQL</type-mapping>

</metadata>

<!– <depends>jboss:service=Hypersonic,database=OKMActivity</depends> –> </local-tx-datasource>

<!– OpenKM User Auth –>

<local-tx-datasource>

<jndi-name>OKMAuthDS</jndi-name>

<connection-url>jdbc:mysql://localhost:3306/openkm</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class>

<user-name>root</user-name>

<password>123456</password>

<min-pool-size>5</min-pool-size>

<max-pool-size>20</max-pool-size>

<idle-timeout-minutes>0</idle-timeout-minutes>

<track-statements/>

<!–<security-domain>HsqlDbRealm</security-domain>–>

<prepared-statement-cache-size>32</prepared-statement-cache-size> <metadata>

<type-mapping>mySQL</type-mapping>

</metadata>

<!–<depends>jboss:service=Hypersonic,database=OKMAuth</depends> –> </local-tx-datasource>

<!– OpenKM Dashboard Stats –>

<local-tx-datasource>

<jndi-name>OKMDashboardStatsDS</jndi-name>

<connection-url>jdbc:mysql://localhost:3306/openkm</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class>

<user-name>root</user-name>

<password>123456</password>

<min-pool-size>5</min-pool-size>

<max-pool-size>20</max-pool-size>

<idle-timeout-minutes>0</idle-timeout-minutes>

<track-statements/>

<!–<security-domain>HsqlDbRealm</security-domain>–>

<prepared-statement-cache-size>32</prepared-statement-cache-size> <metadata>

<type-mapping>mySQL</type-mapping>

</metadata>

<!– <depends>jboss:service=Hypersonic,database=OKMDashboardStats</depends>–>

</local-tx-datasource>

<!– OpenKM Workflow –>

<local-tx-datasource>

<jndi-name>OKMWorkflowDS</jndi-name>

<connection-url>jdbc:mysql://localhost:3306/openkm</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class>

<user-name>root</user-name>

<password>123456</password>

<min-pool-size>5</min-pool-size>

<max-pool-size>20</max-pool-size>

<idle-timeout-minutes>0</idle-timeout-minutes>

<track-statements/>

<!–<security-domain>HsqlDbRealm</security-domain>–>

<prepared-statement-cache-size>32</prepared-statement-cache-size> <metadata>

<type-mapping>mySQL</type-mapping>

</metadata>

</local-tx-datasource>

</datasources>

在{JBOSS_HOME}\server\default\deploy目录下新建 c3p0-service.xml 文件;文件内容如下

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE server>

<server>

<mbean code="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name="jboss:service=C3P0PooledDataSourceOKMWorkflowDS">

<attribute name="JndiName">java:OKMWorkflowDS</attribute>

<attribute name="JdbcUrl">jdbc:mysql://localhost:3306/openkm</attribute> <attribute name="DriverClass">com.mysql.jdbc.Driver</attribute>

<attribute name="User">root</attribute>

<attribute name="Password">123456</attribute>

<!– Uncomment and set any of the optional parameters below –>

<!– See c3p0's docs for more info. –>

<attribute name="AcquireIncrement">2</attribute>

<attribute name="AcquireRetryAttempts">30</attribute>

<!– <attribute name="AcquireRetryDelay">1000</attribute> –>

<!– <attribute name="AutoCommitOnClose">false</attribute> –> <!– <attribute name="AutomaticTestTable"></attribute> –>

<attribute name="BreakAfterAcquireFailure">true</attribute>

<!– <attribute name="CheckoutTimeout">0</attribute> –>

<!– <attribute name="ConnectionCustomizerClassName"></attribute> –> <!– <attribute name="ConnectionTesterClassName"></attribute> –>

<!– <attribute name="Description">A pooled c3p0 DataSource</attribute> –>

<!– <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> –>

<!– <attribute name="FactoryClassLocation"></attribute> –>

<!– <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute>

–>

<attribute name="IdleConnectionTestPeriod">40</attribute>

<attribute name="InitialPoolSize">2</attribute>

<!– <attribute name="MaxAdministrativeTaskTime">0</attribute> –> <!– <attribute name="MaxConnectionAge">0</attribute> –>

<attribute name="MaxIdleTime">1800</attribute>

<!– <attribute name="MaxIdleTimeExcessConnections">0</attribute> –> <attribute name="MaxPoolSize">15</attribute>

<attribute name="MaxStatements">0</attribute>

<!– <attribute name="MaxStatementsPerConnection">0</attribute> –> <attribute name="MinPoolSize">1</attribute>

<!– <attribute name="NumHelperThreads">3</attribute> –>

<!– <attribute name="PreferredTestQuery"></attribute> –>

<!– <attribute name="TestConnectionOnCheckin">false</attribute> –> <attribute name="TestConnectionOnCheckout">false</attribute>

<!– <attribute name="UnreturnedConnectionTimeout">0</attribute> –> <!– <attribute name="UsesTraditionalReflectiveProxies">false</attribute> –>

<depends>jboss:service=Naming</depends>

</mbean>

<mbean code="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name="jboss:service=C3P0PooledDataSourceOKMDashboardStatsDS">

<attribute name="JndiName">java:OKMDashboardStatsDS</attribute>

<attribute name="JdbcUrl">jdbc:mysql://localhost:3306/openkm</attribute> <attribute name="DriverClass">com.mysql.jdbc.Driver</attribute>

<attribute name="User">root</attribute>

<attribute name="Password">123456</attribute>

<!– Uncomment and set any of the optional parameters below –>

<!– See c3p0's docs for more info. –>

<attribute name="AcquireIncrement">2</attribute>

<attribute name="AcquireRetryAttempts">30</attribute>

<!– <attribute name="AcquireRetryDelay">1000</attribute> –>

<!– <attribute name="AutoCommitOnClose">false</attribute> –> <!– <attribute name="AutomaticTestTable"></attribute> –>

<attribute name="BreakAfterAcquireFailure">true</attribute>

<!– <attribute name="CheckoutTimeout">0</attribute> –>

<!– <attribute name="ConnectionCustomizerClassName"></attribute> –> <!– <attribute name="ConnectionTesterClassName"></attribute> –>

<!– <attribute name="Description">A pooled c3p0 DataSource</attribute> –>

<!– <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> –>

<!– <attribute name="FactoryClassLocation"></attribute> –>

<!– <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> –>

<attribute name="IdleConnectionTestPeriod">40</attribute>

<attribute name="InitialPoolSize">2</attribute>

<!– <attribute name="MaxAdministrativeTaskTime">0</attribute> –> <!– <attribute name="MaxConnectionAge">0</attribute> –>

<attribute name="MaxIdleTime">1800</attribute>

<!– <attribute name="MaxIdleTimeExcessConnections">0</attribute> –> <attribute name="MaxPoolSize">15</attribute>

<attribute name="MaxStatements">0</attribute>

<!– <attribute name="MaxStatementsPerConnection">0</attribute> –> <attribute name="MinPoolSize">1</attribute>

<!– <attribute name="NumHelperThreads">3</attribute> –>

<!– <attribute name="PreferredTestQuery"></attribute> –>

<!– <attribute name="TestConnectionOnCheckin">false</attribute> –> <attribute name="TestConnectionOnCheckout">false</attribute>

<!– <attribute name="UnreturnedConnectionTimeout">0</attribute> –>

<!– <attribute name="UsesTraditionalReflectiveProxies">false</attribute> –>

<depends>jboss:service=Naming</depends>

</mbean>

<mbean code="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name="jboss:service=C3P0PooledDataSourceOKMAuthDS">

<attribute name="JndiName">java:OKMAuthDS</attribute>

<attribute name="JdbcUrl">jdbc:mysql://localhost:3306/openkm</attribute> <attribute name="DriverClass">com.mysql.jdbc.Driver</attribute>

<attribute name="User">root</attribute>

<attribute name="Password">123456</attribute>

<!– Uncomment and set any of the optional parameters below –>

<!– See c3p0's docs for more info. –>

<attribute name="AcquireIncrement">2</attribute>

<attribute name="AcquireRetryAttempts">30</attribute>

<!– <attribute name="AcquireRetryDelay">1000</attribute> –>

<!– <attribute name="AutoCommitOnClose">false</attribute> –> <!– <attribute name="AutomaticTestTable"></attribute> –>

<attribute name="BreakAfterAcquireFailure">true</attribute>

<!– <attribute name="CheckoutTimeout">0</attribute> –>

<!– <attribute name="ConnectionCustomizerClassName"></attribute> –> <!– <attribute name="ConnectionTesterClassName"></attribute> –>

<!– <attribute name="Description">A pooled c3p0 DataSource</attribute> –>

<!– <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> –>

<!– <attribute name="FactoryClassLocation"></attribute> –>

<!– <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> –>

<attribute name="IdleConnectionTestPeriod">40</attribute>

<attribute name="InitialPoolSize">2</attribute>

<!– <attribute name="MaxAdministrativeTaskTime">0</attribute> –> <!– <attribute name="MaxConnectionAge">0</attribute> –>

<attribute name="MaxIdleTime">1800</attribute>

<!– <attribute name="MaxIdleTimeExcessConnections">0</attribute> –> <attribute name="MaxPoolSize">15</attribute>

<attribute name="MaxStatements">0</attribute>

<!– <attribute name="MaxStatementsPerConnection">0</attribute> –> <attribute name="MinPoolSize">1</attribute>

<!– <attribute name="NumHelperThreads">3</attribute> –>

<!– <attribute name="PreferredTestQuery"></attribute> –>

<!– <attribute name="TestConnectionOnCheckin">false</attribute> –> <attribute name="TestConnectionOnCheckout">false</attribute>

<!– <attribute name="UnreturnedConnectionTimeout">0</attribute> –> <!– <attribute name="UsesTraditionalReflectiveProxies">false</attribute> –>

<depends>jboss:service=Naming</depends>

</mbean>

<mbean code="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name="jboss:service=C3P0PooledDataSourceOKMActivityDS">

<attribute name="JndiName">java:OKMActivityDS</attribute>

<attribute name="JdbcUrl">jdbc:mysql://localhost:3306/openkm</attribute> <attribute name="DriverClass">com.mysql.jdbc.Driver</attribute>

<attribute name="User">root</attribute>

<attribute name="Password">123456</attribute>

<!– Uncomment and set any of the optional parameters below –>

<!– See c3p0's docs for more info. –>

<attribute name="AcquireIncrement">2</attribute>

<attribute name="AcquireRetryAttempts">30</attribute>

<!– <attribute name="AcquireRetryDelay">1000</attribute> –>

<!– <attribute name="AutoCommitOnClose">false</attribute> –> <!– <attribute name="AutomaticTestTable"></attribute> –>

<attribute name="BreakAfterAcquireFailure">true</attribute>

<!– <attribute name="CheckoutTimeout">0</attribute> –>

<!– <attribute name="ConnectionCustomizerClassName"></attribute> –> <!– <attribute name="ConnectionTesterClassName"></attribute> –>

<!– <attribute name="Description">A pooled c3p0 DataSource</attribute> –>

<!– <attribute name="DebugUnreturnedConnectionStackTraces">false</attribute> –>

<!– <attribute name="FactoryClassLocation"></attribute> –>

<!– <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute> –>

<attribute name="IdleConnectionTestPeriod">40</attribute>

<attribute name="InitialPoolSize">2</attribute>

<!– <attribute name="MaxAdministrativeTaskTime">0</attribute> –> <!– <attribute name="MaxConnectionAge">0</attribute> –>

<attribute name="MaxIdleTime">1800</attribute>

<!– <attribute name="MaxIdleTimeExcessConnections">0</attribute> –> <attribute name="MaxPoolSize">15</attribute>

<attribute name="MaxStatements">0</attribute>

<!– <attribute name="MaxStatementsPerConnection">0</attribute> –> <attribute name="MinPoolSize">1</attribute>

<!– <attribute name="NumHelperThreads">3</attribute> –>

<!– <attribute name="PreferredTestQuery"></attribute> –>

<!– <attribute name="TestConnectionOnCheckin">false</attribute> –> <attribute name="TestConnectionOnCheckout">false</attribute>

<!– <attribute name="UnreturnedConnectionTimeout">0</attribute> –> <!– <attribute name="UsesTraditionalReflectiveProxies">false</attribute> –>

<depends>jboss:service=Naming</depends>

</mbean>

</server>

最后一步,把C3P0的JAR c3p0-09.1.11.jar COPY 到{JBOSS_HOME}\server\default\lib 目录下即可。

Posted in 使用说明.