The liferay documentation library's Portlet is very convenient to use, but we found that when you redeploy This tomcat or port This tomcat to another machine, the previously uploaded documents in the document library cannot be downloaded even though the information is still in progress.
The reason is that, in the liferay document library, the default configuration is to store the document data to the $ {user on the server where your Tomcat is located. home}/liferay's jackrabbit folder, so you cannot download it when you redeploy tomcat or port tomcat to another server.
Solution:
1. In portal. properties, change resource. repositories. Root =$ {user. Home}/liferay's $ {user. Home} To Your Tomcat path. Do not store this information in your user folder.
2. I think this method is better to store documents in the database as data. Modify repository. XML in $ {user. Home}/liferay/jackrabbit.
The modified file is as follows:
<? XML version = "1.0"?>
<Repository>
<! -- <Filesystem class = "org. Apache. jackrabbit. Core. fs. Local. localfilesystem">
<Param name = "path" value = "$ {rep. Home}/repository"/>
</Filesystem> -->
<! --
Database File System (cluster configuration)
This is sample configuration for MySQL persistence that can be used
Clustering jackrabbit. For other databases, change the connection,
Credentials, and schema settings.
-->
<Filesystem class = "org. Apache. jackrabbit. Core. fs. DB. dbfilesystem">
<Param name = "driver" value = "com. MySQL. JDBC. Driver"/>
<Param name = "url" value = "JDBC: mysql: // localhost/JCR"/>
<Param name = "user" value = "root"/>
<Param name = "password" value = "admin"/>
<Param name = "schema" value = "MySQL"/>
<Param name = "schemaobjectprefix" value = "j_r_fs _"/>
</Filesystem>
<Security appname = "Jackrabbit">
<Accessmanager class = "org. Apache. jackrabbit. Core. Security. simpleaccessmanager"/>
<Loginmodule class = "org. Apache. jackrabbit. Core. Security. simpleloginmodule">
<Param name = "anonymousid" value = "anonymous"/>
</Loginmodule>
</Security>
<Workspaces rootpath = "$ {rep. Home}/workspaces" defaultworkspace = "liferay"/>
<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. state. xml. xmlpersistencemanager"/>
-->
<! --
Database File System and persistence (cluster configuration)
This is sample configuration for MySQL persistence that can be used
Clustering jackrabbit. For other databases, change the connection,
Credentials, and schema settings.
-->
<Persistencemanager class = "org. Apache. jackrabbit. Core. state. DB. simpledbpersistencemanager">
<Param name = "driver" value = "com. MySQL. JDBC. Driver"/>
<Param name = "url" value = "JDBC: mysql: // localhost/JCR"/>
<Param name = "user" value = "root"/>
<Param name = "password" value = "admin"/>
<Param name = "schema" value = "MySQL"/>
<Param name = "schemaobjectprefix" value = "j_pm _ $ {WSP. name} _"/>
<Param name = "externalblobs" value = "false"/>
</Persistencemanager>
<Filesystem class = "org. Apache. jackrabbit. Core. fs. DB. dbfilesystem">
<Param name = "driver" value = "com. MySQL. JDBC. Driver"/>
<Param name = "url" value = "JDBC: mysql: // localhost/JCR"/>
<Param name = "user" value = "root"/>
<Param name = "password" value = "admin"/>
<Param name = "schema" value = "MySQL"/>
<Param name = "schemaobjectprefix" value = "j_fs _ $ {WSP. name} _"/>
</Filesystem>
</Workspace>
<Versioning rootpath = "$ {rep. Home}/version">
<! -- <Filesystem class = "org. Apache. jackrabbit. Core. fs. Local. localfilesystem">
<Param name = "path" value = "$ {rep. Home}/version"/>
</Filesystem>
<Persistencemanager class = "org. Apache. jackrabbit. Core. state. xml. xmlpersistencemanager"/>
-->
<! --
Database File System and persistence (cluster configuration)
This is sample configuration for MySQL persistence that can be used
Clustering jackrabbit. For other databases, change the connection,
Credentials, and schema settings.
-->
<Filesystem class = "org. Apache. jackrabbit. Core. fs. DB. dbfilesystem">
<Param name = "driver" value = "com. MySQL. JDBC. Driver"/>
<Param name = "url" value = "JDBC: mysql: // localhost/JCR"/>
<Param name = "user" value = "root"/>
<Param name = "password" value = "admin"/>
<Param name = "schema" value = "MySQL"/>
<Param name = "schemaobjectprefix" value = "j_v_fs _"/>
</Filesystem>
<Persistencemanager class = "org. Apache. jackrabbit. Core. state. DB. simpledbpersistencemanager">
<Param name = "driver" value = "com. MySQL. JDBC. Driver"/>
<Param name = "url" value = "JDBC: mysql: // localhost/JCR"/>
<Param name = "user" value = "root"/>
<Param name = "password" value = "admin"/>
<Param name = "schema" value = "MySQL"/>
<Param name = "schemaobjectprefix" value = "j_v_pm _"/>
<Param name = "externalblobs" value = "false"/>
</Persistencemanager>
</Versioning>
<! --
Cluster configuration
This is sample configuration for MySQL persistence that can be used
Clustering jackrabbit. For other databases, change the connection,
Credentials, and schema settings.
-->
<! -- <Cluster id = "node_1" syncdelay = "5">
<Journal class = "org. Apache. jackrabbit. Core. Journal. databasejournal">
<Param name = "revision" value = "$ {rep. Home}/revision"/>
<Param name = "driver" value = "com. MySQL. JDBC. Driver"/>
<Param name = "url" value = "JDBC: mysql: // localhost/JCR"/>
<Param name = "user" value = ""/>
<Param name = "password" value = ""/>
<Param name = "schema" value = "MySQL"/>
<Param name = "schemaobjectprefix" value = "j_c _"/>
</Journal>
</Cluster> -->
</Repository>
Note: The username and password used to connect to the database are correct, and there are database names. If you do not want to use the same database as Tomcat, create another JCR database, the table is automatically generated.
In this way, no matter how Tomcat is redeployed or transplanted, the document data is stored in the database, and can be downloaded whenever the database file is still in progress.
Reference: http://wiki.liferay.com/index.php/Jackrabbit
Supplement:
Just now, a netizen told me that I could modify the configuration of the portal source code before deployment, so that the repository. xml generated by Tomcat for the first deployment is the configuration stored in the database. The modified source code is portal-impl.jar/COM/liferay/portal/JCR/jackrabbit/dependencies/Repository. XML, which is the original file before deploying repository. xml.