jfinal-ext 关于PoiRender导出excel但是无数据.

漠上刀栈 发布于 2015/11/17 18:12
阅读 595
收藏 0

jfinal-ext 关于PoiRender导出excel但是无数据.

导出excel----carInfo.xls但是里面没有数据,后台报错。

引用jar包:jfinal 2.0  jfinal-ext 3.1.4

代码如下:

public void carsToExc(){
			UserRecord user= getSessionAttr("user");
			System.out.println(getAttr("draw"));
			System.out.println(getAttr("start"));
			System.out.println(getAttr("length"));

			int userid=user.getInt("id");
			List<CarinfoRecord> objs= carInfoService.findCarsByUser(userid);
			System.out.println(JSON.toString(objs));
			String []  header={"编号","证件号码","加入时间","驾龄","电话"};
			String []  columns={"id","transport_license","create_time","driving_time","phone_number"};
		
			Render poiRender=PoiRender.me(objs).fileName("carInfo.xls").headers(header).columns(columns).cellWidth(5000).headerRow(2);
			render(poiRender);
			
			
		}





后台报错如下:
[ERROR]-[Thread: qtp29585222-15]-[com.jfinal.core.ActionHandler.handle()]: /carInfo/carsToExc
java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
	at com.jfinal.ext.render.excel.PoiRender.render(PoiRender.java:57)
	at com.jfinal.core.ActionHandler.handle(ActionHandler.java:93)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:365)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
	at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:430)
	at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
	... 26 more

2015-11-17 13:56:15
[ERROR]-[Thread: qtp29585222-15]-[com.jfinal.core.JFinalFilter.doFilter()]: /carInfo/carsToExc
java.lang.IllegalStateException: STREAM
	at org.eclipse.jetty.server.Response.getWriter(Response.java:699)
	at com.jfinal.render.ErrorRender.render(ErrorRender.java:59)
	at com.jfinal.core.ActionHandler.handle(ActionHandler.java:126)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:365)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
	at java.lang.Thread.run(Thread.java:744)



数据源如下:
{id:1, phone_number:123, driving_time:12, transport_license:D10D9554A7994A17AE25F182701FFC60, create_time:2015-07-23 09:40:32, plate_number:鄂A12345, transport_user:张三}","com.jiexun.jiexun56.mvc.record.CarinfoRecord@de367719 {id:2, phone_number:null, driving_time:null, transport_license:null, create_time:null, plate_number:鄂A32423, transport_user:null}","com.jiexun.jiexun56.mvc.record.CarinfoRecord@633a0bfe {id:3, phone_number:123, driving_time:12, transport_license:D10D9554A7994A17AE25F182701FFC60, create_time:2015-07-23 09:40:32, plate_number:鄂A1345, transport_user:张三}","com.jiexun.jiexun56.mvc.record.CarinfoRecord@633a0c0b {id:4, phone_number:123, driving_time:12, transport_license:D10D9554A7994A17AE25F182701FFC60, create_time:2015-07-23 09:40:32, plate_number:鄂A1347, transport_user:张三}



建议在OS的开源项目页面建个群号,大家能直接加群讨论交流jfinal-ext.
加载中
0
CapJes
CapJes
http://www.oschina.net/code/snippet_875267_22091
返回顶部
顶部