poi导入时报错问题记录

    使用POI导入excel时用我的机器上的office2007编辑过的都不会报错,在别人机器上用office2010编辑过的有时报错,调试代码发现总是在Sheet sheet = book.getSheet(0); 这一句出问题.

    我猜是jar包的原因,因为程序中用的jar比较老不支持office2010所以报错,开始认为是poi的jar比较老,替换了最新的还是不行,测试了几个jar后终于找到是哪一个,记录一下.之前用的是jxl-2.6.jar,我下载了最新的jxl-2.6.12.jar替换后导入正常了.

    在网上查找资料没有人记录此问题,现在记录一下方便以后遇到同样问题的人快速解决该问题.报错堆栈信息如下:

16:30:14,861 ERROR [STDERR] java.lang.NullPointerException
16:30:14,862 ERROR [STDERR] 	at jxl.biff.formula.SharedFormulaCellReference.read(SharedFormulaCellReference.java:89)
16:30:14,862 ERROR [STDERR] 	at jxl.biff.formula.TokenFormulaParser.parseSubExpression(TokenFormulaParser.java:172)
16:30:14,862 ERROR [STDERR] 	at jxl.biff.formula.TokenFormulaParser.parse(TokenFormulaParser.java:111)
16:30:14,862 ERROR [STDERR] 	at jxl.biff.formula.FormulaParser.parse(FormulaParser.java:110)
16:30:14,862 ERROR [STDERR] 	at jxl.biff.DVParser.<init>(DVParser.java:397)
16:30:14,862 ERROR [STDERR] 	at jxl.biff.DataValiditySettingsRecord.initialize(DataValiditySettingsRecord.java:140)
16:30:14,863 ERROR [STDERR] 	at jxl.biff.DataValiditySettingsRecord.getFirstColumn(DataValiditySettingsRecord.java:235)
16:30:14,863 ERROR [STDERR] 	at jxl.read.biff.SheetReader.read(SheetReader.java:913)
16:30:14,863 ERROR [STDERR] 	at jxl.read.biff.SheetImpl.readSheet(SheetImpl.java:650)
16:30:14,863 ERROR [STDERR] 	at jxl.read.biff.WorkbookParser.getSheet(WorkbookParser.java:249)
16:30:14,863 ERROR [STDERR] 	at com.assets.service.assetIO.AssetImpService.load(AssetImpService.java:155)
16:30:14,863 ERROR [STDERR] 	at com.assets.service.assetIO.AssetImpService$$FastClassByCGLIB$$bcb85b02.invoke(<generated>)
16:30:14,863 ERROR [STDERR] 	at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
16:30:14,863 ERROR [STDERR] 	at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
16:30:14,863 ERROR [STDERR] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
16:30:14,863 ERROR [STDERR] 	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
16:30:14,863 ERROR [STDERR] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
16:30:14,863 ERROR [STDERR] 	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
16:30:14,863 ERROR [STDERR] 	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
16:30:14,863 ERROR [STDERR] 	at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
16:30:14,863 ERROR [STDERR] 	at com.topsec.tsm.assets.service.assetIO.AssetImpService$$EnhancerByCGLIB$$c04a04ef.load(<generated>)
16:30:14,863 ERROR [STDERR] 	at com.topsec.tsm.assets.web.action.assetManage.AssetManagerAction.importAsset(AssetManagerAction.java:176)
16:30:14,863 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:30:14,863 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
16:30:14,863 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:30:14,863 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:597)
16:30:14,863 ERROR [STDERR] 	at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
16:30:14,863 ERROR [STDERR] 	at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
16:30:14,864 ERROR [STDERR] 	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
16:30:14,864 ERROR [STDERR] 	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
16:30:14,864 ERROR [STDERR] 	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
16:30:14,864 ERROR [STDERR] 	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
16:30:14,864 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
16:30:14,864 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
16:30:14,864 ERROR [STDERR] 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:358)
16:30:14,864 ERROR [STDERR] 	at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:342)
16:30:14,884 ERROR [STDERR] 	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
16:30:14,884 ERROR [STDERR] 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
16:30:14,885 ERROR [STDERR] 	at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
16:30:14,885 ERROR [STDERR] 	at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
16:30:14,885 ERROR [STDERR] 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
16:30:14,885 ERROR [STDERR] 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
16:30:14,885 ERROR [STDERR] 	at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
16:30:14,886 ERROR [STDERR] 	at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
16:30:14,886 ERROR [STDERR] 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
16:30:14,886 ERROR [STDERR] 	at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
16:30:14,886 ERROR [STDERR] 	at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
16:30:14,886 ERROR [STDERR] 	at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
16:30:14,886 ERROR [STDERR] 	at org.mortbay.http.HttpServer.service(HttpServer.java:879)
16:30:14,887 ERROR [STDERR] 	at org.jboss.jetty.Jetty.service(Jetty.java:460)
16:30:14,887 ERROR [STDERR] 	at org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
16:30:14,887 ERROR [STDERR] 	at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
16:30:14,887 ERROR [STDERR] 	at org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
16:30:14,887 ERROR [STDERR] 	at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
16:30:14,887 ERROR [STDERR] 	at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:331)
16:30:14,887 ERROR [STDERR] 	at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:520)
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值