分布式网上商城项目-项目查询功能错误

 

1、Jdbc内存泄露问题

 

 1 严重: The web application [] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
 2 
 3 6月 02, 2018 2:42:06 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
 4 
 5 严重: The web application [] registered the JDBC driver [com.alibaba.druid.mock.MockDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
 6 
 7 6月 02, 2018 2:42:06 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
 8 
 9 严重: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
10 
11 6月 02, 2018 2:42:06 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
12 
13 严重: The web application [] registered the JDBC driver [com.mysql.fabric.jdbc.FabricMySQLDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
14 
15 6月 02, 2018 2:42:06 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
16 
17 严重: The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
18 
19 6月 02, 2018 2:42:06 下午 org.apache.coyote.AbstractProtocol start

网上查询之后知道得到错误原因是DruidDriver内存泄漏,

 

要避免这个信息,应用或框架应该自己来保证在销毁时将JDBC Driver反注册掉。

我想DruidDriver应该有解决办法,于是改变关键词继续百度,发现最新版本的DruidDriver已经修复了这个bug,于是将版本更新为1.1.9

更新之后还是失败,

最后找到原因是pageHelper和逆向工程冲突使得没有办法销毁jdbc

 

2、web层接收数据错误

 

 1 com.alibaba.dubbo.remoting.RemotingException: Failed to send response: Response [id=2, version=2.0.0, status=20, event=false, error=null, result=RpcResult [result=cn.thyonline.taotao.common.pojo.EasyUIDataGridResult@348d42a0, exception=null]], cause: java.lang.IllegalStateException: Serialized class cn.thyonline.taotao.common.pojo.EasyUIDataGridResult must implement java.io.Serializable
 2 
 3 java.lang.IllegalStateException: Serialized class cn.thyonline.taotao.common.pojo.EasyUIDataGridResult must implement java.io.Serializable
 4 
 5          at com.alibaba.com.caucho.hessian.io.SerializerFactory.getDefaultSerializer(SerializerFactory.java:261)
 6 
 7          at com.alibaba.com.caucho.hessian.io.SerializerFactory.getSerializer(SerializerFactory.java:233)
 8 
 9          at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:406)
10 
11          at com.alibaba.dubbo.common.serialize.support.hessian.Hessian2ObjectOutput.writeObject(Hessian2ObjectOutput.java:92)
12 
13          at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.encodeResponseData(DubboCodec.java:200)
14 
15          at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encodeResponse(ExchangeCodec.java:276)
16 
17          at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:77)
18 
19          at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:39)
20 
21          at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:81)
22 
23          at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.doEncode(OneToOneEncoder.java:66)
24 
25          at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:59)
26 
27          at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)
28 
29          at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendDownstream(DefaultChannelPipeline.java:784)
30 
31          at org.jboss.netty.channel.SimpleChannelHandler.writeRequested(SimpleChannelHandler.java:292)
32 
33          at com.alibaba.dubbo.remoting.transport.netty.NettyHandler.writeRequested(NettyHandler.java:99)
34 
35          at org.jboss.netty.channel.SimpleChannelHandler.handleDownstream(SimpleChannelHandler.java:254)
36 
37          at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)
38 
39          at org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:582)
40 
41          at org.jboss.netty.channel.Channels.write(Channels.java:704)
42 
43          at org.jboss.netty.channel.Channels.write(Channels.java:671)
44 
45          at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
46 
47          at com.alibaba.dubbo.remoting.transport.netty.NettyChannel.send(NettyChannel.java:98)
48 
49          at com.alibaba.dubbo.remoting.transport.AbstractPeer.send(AbstractPeer.java:51)
50 
51          at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:171)
52 
53          at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)
54 
55          at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82)
56 
57          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
58 
59          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
60 
61          at java.base/java.lang.Thread.run(Thread.java:844)

java.io.Serializable可以发现因为在dubbo中传递的数据类型为EasyUIDataGridResult不是字节流形式传递,需要序列化操作

 

序列化是什么:

序列化就是将一个对象的状态(各个属性量)保存起来,然后在适当的时候再获得。

序列化分为两大部分:序列化和反序列化。序列化是这个过程的第一部分,将数据分解成字节流,以便存储在文件中或在网络上传输。反序列化就是打开字节流并重构对象。对象序列化不仅要将基本数据类型转换成字节表示,有时还要恢复数据。恢复数据要求有恢复数据的对象实例

 

3、pageHelper出错

 

 1 警告: Hessian/Burlap: 'com.github.pagehelper.Page' is an unknown class in WebappClassLoader
 2 
 3   context:
 4 
 5   delegate: false
 6 
 7   repositories:
 8 
 9     /WEB-INF/classes/
10 
11 ----------> Parent Classloader:
12 
13 ClassRealm[plugin>org.apache.tomcat.maven:tomcat7-maven-plugin:2.2, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@4629104a]
14 
15 :
16 
17 java.lang.ClassNotFoundException: com.github.pagehelper.Page


com.github.pagehelper.Page是一个没有找到的类。Google之后发现原因是 

service层有pageHelper的依赖,但是web层没有,所以传递过来的pageHelper的数据没有找对对应的类,解决办法就是在web层中加入pageHelper的依赖

 

4、页面没有显示查询列表,但是后端数据测试知道已经传递到前端

 

 1 Uncaught TypeError: Cannot read property 'length' of undefined
 2 
 3     at Object.render (jquery.easyui.min.js:9903)
 4 
 5     at _5f6 (jquery.easyui.min.js:8837)
 6 
 7     at jquery.easyui.min.js:9422
 8 
 9     at Object.success (jquery.easyui.min.js:10128)
10 
11     at j (jquery.min.js:2)
12 
13     at Object.fireWith [as resolveWith] (jquery.min.js:2)
14 
15     at x (jquery.min.js:4)
16 
17     at XMLHttpRequest.b (jquery.min.js:4)


 

查看网页的响应会发现数据已经在网页端接收到

所以可以推断整个架构没有问题。但是没能在页面正常显示。查看静态页面的写好的数据:

 1 {"total":28,"rows":[
 2 
 3          {"productid":"FI-SW-01","unitcost":10.00,"status":"P","listprice":36.50,"attr1":"Large","itemid":"EST-1"},
 4 
 5          {"productid":"K9-DL-01","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Spotted Adult Female","itemid":"EST-10"},
 6 
 7          {"productid":"RP-SN-01","unitcost":12.00,"status":"P","listprice":28.50,"attr1":"Venomless","itemid":"EST-11"},
 8 
 9          {"productid":"RP-SN-01","unitcost":12.00,"status":"P","listprice":26.50,"attr1":"Rattleless","itemid":"EST-12"},
10 
11          {"productid":"RP-LI-02","unitcost":12.00,"status":"P","listprice":35.50,"attr1":"Green Adult","itemid":"EST-13"},
12 
13          {"productid":"FL-DSH-01","unitcost":12.00,"status":"P","listprice":158.50,"attr1":"Tailless","itemid":"EST-14"},
14 
15          {"productid":"FL-DSH-01","unitcost":12.00,"status":"P","listprice":83.50,"attr1":"With tail","itemid":"EST-15"},
16 
17          {"productid":"FL-DLH-02","unitcost":12.00,"status":"P","listprice":63.50,"attr1":"Adult Female","itemid":"EST-16"},
18 
19          {"productid":"FL-DLH-02","unitcost":12.00,"status":"P","listprice":89.50,"attr1":"Adult Male","itemid":"EST-17"},
20 
21          {"productid":"AV-CB-01","unitcost":92.00,"status":"P","listprice":63.50,"attr1":"Adult Male","itemid":"EST-18"}
22 
23 ],"footer":[
24 
25          {"unitcost":19.80,"listprice":60.40,"productid":"Average:"},
26 
27          {"unitcost":198.00,"listprice":604.00,"productid":"Total:"}
28 
29 ]}

检查传来数据的名称和json需要的数据的名称可以发现EasyUIDataGridResult里面的参数写成了row然后转成json数据传递。但是在页面需要的数据为rows则不匹配。

于是将EasyUIDataGridResult中的数据名称修改,再次运行则成功显示。

posted @ 2018-06-03 03:04  floatthy  阅读(595)  评论(0编辑  收藏  举报