Bonjour je voudrais lire un fichier Excel avec dans une servlet mais cela me retourne toujours une erreur sur la définition du classeur.
Voici un bout de mon code :
Selon vous d’où peut bien provenir l'erreur et comment le régler.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { String applicationPath=request.getServletContext().getRealPath(""); String basePath=applicationPath+File.separator+UPLOAD_DIR+File.separator; String fileName1=basePath + "monfichier.xlsx"; try { File file=new File(fileName1); FileInputStream fichier=new FileInputStream(file); XSSFWorkbook wb = new XSSFWorkbook(fichier); XSSFSheet feuille1=wb.getSheetAt(0); XSSFRow ligne1= feuille1.getRow(0); System.out.println(ligne1.getCell(0).getStringCellValue()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
Merci de votre aide
En cas de besoin voici l'erreur que j'obtiens :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 GRAVE: Servlet.service() for servlet [Integration] in context with path [/testexcel] threw exception [L''exécution de la servlet a lancé une exception] with root cause java.lang.ClassNotFoundException: org.apache.commons.collections4.ListValuedMap at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735) at com.Integration.doGet(Integration.java:97)
Partager