栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

[Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTPhoneticRun报错

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

[Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTPhoneticRun报错

目录

前言

使用问题记录

总结



前言

接口自动化中的数据驱动采取的数据载体之一就是excel

其中广泛使用的excel jar包为apache poi相关的jar包,常用poi 、poi-ooxml两个包


使用问题记录

问题1 :

由于类型使用错误导致的报错问题,为了正确读取excel内容,通过cellType的类型获取单元格内容,但是在应该使用字符串类型的时候,错误的没有进行toString()操作,导致我在拼接成map之后,在想要转成jsonObject的时候,报错

case STRING:
    return cell.getRichStringCellValue();


错误信息:
Exception in thread "main" java.lang.NoClassDefFoundError: [Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTPhoneticRun;

刚开始以为是缺少解析包,就引入了poi-ooxml-full全部的包


    org.apache.poi
    poi-ooxml-full
    5.0.0


之后发现错误信息变成这个
Exception in thread "main" com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.76, class org.apache.xmlbeans.impl.schema.SchemaTypeImpl, fieldName : _schema_type, write javaBean error, fastjson version 1.2.76, class org.apache.xmlbeans.impl.schema.SchemaTypeImpl, fieldName : baseType 

 后来把问题聚焦 at com.alibaba.fastjson.serializer.ASMSerializer_1_XSSFRichTextString.write(Unknown Source)
时候,就想到了是拼接map的时候的去内容这块报错了,应该使用

return cell.getRichStringCellValue().toString();


总结

就是不细心引起来的问题,poi 及poi-ooxml包完全够用了

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/459412.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号