[英]java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook AND java.lang.ClassNotFoundException: org.apache.poi.xssf.usermodel.XSSF
I'm using Apache poi 5.0.0 to read some data from an Excel(.xlsx) file.我正在使用 Apache poi 5.0.0 从 Excel(.xlsx) 文件中读取一些数据。 I started the project as a console appliacation so the implemetations work.
我将该项目作为控制台应用程序启动,因此实现工作。 I transfered the classes I use to a Servlet Project.
我将我使用的类转移到了一个 Servlet 项目。 Now the problem is, when I request 'generate' from my main page, I create a ReadXL instance.
现在的问题是,当我从主页请求“生成”时,我创建了一个 ReadXL 实例。 But when I try to instantiate the XSSF workbook I get the errors above.
但是当我尝试实例化 XSSF 工作簿时,我得到了上面的错误。 I have included all poi libraries (using IntelliJ) to the project (poi-ooxml-full, poi-ooxml too).
我已将所有 poi 库(使用 IntelliJ)包含到项目中(poi-ooxml-full,poi-ooxml 也是)。
Requesting 'generate':请求“生成”:
<form action="generate" method="get">
<div id="list">
<br>
<!-- <div class="fileName">List</div> <div class="deleteFile"> X </div><br><br>
<div class="fileName">List</div> <div class="deleteFile"> X </div><br><br>
<div class="fileName">List</div> <div class="deleteFile"> X </div><br><br>
<div class="fileName">List</div> <div class="deleteFile" onclick="alert('hi')"> X </div><br><br> -->
</div><br><br>
<input type="submit" value="GENERATE .XLSX">
</form>
Controller: Controller:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
ReadXL newXL = new ReadXL("C:\\xampp\\tomcat\\webapps\\Public\\ΠΡΟΤΥΠΟ ΠΡΟΜΗΘΕΥΤΗ.xlsx");
RequestDispatcher rd=request.getRequestDispatcher("index.html");
rd.forward(request, response);
}
ReadXL:阅读XL:
public ReadXL(String path) throws IOException{
this.openXL(path);
.
.
.
}
private void openXL(String path) throws IOException{
xlFile = new File(path);
fis = new FileInputStream(xlFile);
workbook = new XSSFWorkbook(fis); // get workbook <-- ERROR THROWN HERE
.
.
.
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.