从weblib3.5升级到4.0
<h1>从weblib3.5升级到4.0</h1>
<p><strong>注意:grouper和userSystem不动,升级之前先备份resource之前的WEB-INF</strong></p>
<p>1.把WEB-INF.tar传到服务器,解压(升级之前先备份之前的WEB-INF)。</p>
<p>/resource/webapps/ROOT/WEB-INF</p>
<p>3.把3.5版本的/resource/webapps/ROOT/WEB-INF/classes/groups.properties复制到新的WEB-INF/classes/中,
并且进去修改版本号为4.0.0,添加一条记录</p>
<pre><code>#分页查询默认每页条数
searchDefaultPageSize=10</code></pre>
<p>4.数据库部分
4.1创建新的数据库weblibnew, 将之前的weblib数据库dump出来,然后source到weblibnew</p>
<pre><code>创建数据库
create database weblibnew default charset utf8;
用户授权
grant all privileges on weblibnew.* to 'weblib'@'%';
grant all privileges on weblibnew.* to 'weblib'@'localhost';
flush privileges;
导入数据
use weblibnew;
//weblib4update.sql为刚刚weblib数据库dump出来的sql语句
source /home/weblib/weblib4update.sql;</code></pre>
<p>4.2修改脚本(新建的数据库若为weblibnew则不需要修改),执行脚本升级材料中的updatescript.sql</p>
<pre><code>use weblibnew;
source /home/weblib/updatescript.sql;</code></pre>
<p>4.3检查应用中的数据库连接信息(jdbc.properties),此时应该连接到weblibnew</p>
<p>5.启动tomcat日志不报错的情况下进去weblib应用进行功能测试,如果有以下报错则按文档解决。如果升级失败需要恢复到3.5版本,则可以直接将WEB-INF换成之前备份的WEB-INF 启动即可。</p>
<p>启动后报错修改
1。进入文件柜管理时如果报错</p>
<pre><code>javax.persistence.EntityNotFoundException: Unable to find com.dcampus.weblib.entity.Member with id 0
at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:155)
at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:210)
at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:244)
at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:148)
at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1078)
at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1005)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:651)
at org.hibernate.type.EntityType.resolve(EntityType.java:471)
at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:167)
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:137)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1103)
at org.hibernate.loader.Loader.processResultSet(Loader.java:960)
at org.hibernate.loader.Loader.doQuery(Loader.java:910)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
at org.hibernate.loader.Loader.doList(Loader.java:2516)
at org.hibernate.loader.Loader.doList(Loader.java:2502)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332)
at org.hibernate.loader.Loader.list(Loader.java:2327)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:490)</code></pre>
<p>进入数据库执行</p>
<pre><code>use weblibnew;
update weblib_domain set creator_id=(select id from weblib_member where account = &quot;root&quot;) where domain_name = &quot;根域&quot;;</code></pre>
<p>2.getMyShared不报错
/group/getMySharedResources.action报错</p>
<pre><code>javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:273)
at com.dcampus.common.persistence.HibernateDao.findAll(HibernateDao.java:130)
at com.dcampus.weblib.dao.GroupResourceShareDao.getAllResourceShareByProvider(GroupResourceShareDao.java:66)
at com.dcampus.weblib.service.ResourceService.getSharedResourceByProvider(ResourceService.java:2670)
at com.dcampus.weblib.service.ResourceService$$FastClassBySpringCGLIB$$33cb7f49.invoke(&lt;generated&gt;)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)</code></pre>
<p>已经代码解决</p>