Liferay 集群中在一个节点上上传照片另外一个节点(3)

Liferay 集群中在一个节点上上传照片另外一个节点


 

 

Reason why we need to re-configure the hibernate-configs?

 

If you read my solution carefully ,you can see that I don’t use the default hibernate.configs ,I change the “META-INF/portal-hbm.xml” to “META-INF/portal-hbm-new.xml” and do some modifications to this mapping file .Why?

Because when you persist the resource to “DLCONTENT” table , you may meet with the following exception:

Liferay 集群中在一个节点上上传照片另外一个节点


 

The reason is in portal-hbm.xml Line 1416, the default type for dataBlob is “org.hibernate.type.BlobType” ,but when we want to persist into database ,what we want is  “java.sql.Blob

Liferay 集群中在一个节点上上传照片另外一个节点


 

So I modify this type of dataBlob in portal-hbm-new.xml and let Liferay framework to read this new file (portal-hbm-new.xml) instead of the default( portal-hbm.xml) ,then problem solved.

 

 解决方法2:用共享的文件服务器存储media资源

Suppose we put the shared folder in 192.168.0.138, this physical ip address is neither the same as node1 nor node2.

 

<!--[if !supportLists]-->1.       <!--[endif]-->Keep everything setting default ,then in each node ,add the following line in ${liferay_home}/portal-ext.properties (You must use  “ \\”  instead of “\”  as path separator):

#added by charles to use the file store to fixed the cluster

dl.store.file.system.root.dir=\\\\192.168.0.238\\WalmartShare\\Platform\\ClusterSharedFolder\\data\\document_library

 

<!--[if !supportLists]-->2.       <!--[endif]-->Then restart the clustering environment  and do the procedure as you supplied, you will see this issue is fixed.

You can check the location of shared file system,and will find the media files has been uploaded to this location successfully.

Liferay 集群中在一个节点上上传照片另外一个节点

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/6c1bd4cea160688057e7461b4f982c72.html