1 Reply Latest reply: Jun 24, 2014 5:51 AM by jwenting RSS

    Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1

    ec7208c0-2142-486e-a31d-f5076f53d528

      Hi,

      windows 7 64 bits

      jdk-7u60-windows-x64

      netbeans-8.0-windows

       

      My class is :

       

      package com.test.ca.ti.tools.excel;
      
      import java.io.BufferedInputStream;
      import java.io.FileInputStream;
      import java.io.IOException;
      import java.io.InputStream;
      import java.util.Iterator;
      import org.apache.poi.poifs.filesystem.POIFSFileSystem;
      import org.apache.poi.hssf.usermodel.HSSFCell;
      import org.apache.poi.hssf.usermodel.HSSFSheet;
      import org.apache.poi.hssf.usermodel.HSSFWorkbook;
      import org.apache.poi.hssf.usermodel.HSSFRow;
      
      public class ExcelReader {
      
          public static void main(String[] args) {
              try {
                  InputStream input = new BufferedInputStream(new FileInputStream("c:\\1.xlsx"));
      
                  POIFSFileSystem fs = new POIFSFileSystem(input);
                  HSSFWorkbook wb = new HSSFWorkbook(fs);
                  HSSFSheet sheet = wb.getSheetAt(0);
      
                  Iterator rows = sheet.rowIterator();
                  while (rows.hasNext()) {
                      HSSFRow row = (HSSFRow) rows.next();
                      System.out.println("\n");
      
                      Iterator cells = row.cellIterator();
                      while (cells.hasNext()) {
                          HSSFCell cell = (HSSFCell) cells.next();
      
                          if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType()) {
                              System.out.print(cell.getNumericCellValue() + " ");
                          } else if (HSSFCell.CELL_TYPE_STRING == cell.getCellType()) {
                              System.out.print(cell.getRichStringCellValue().getString() + " ");
                          } else if (HSSFCell.CELL_TYPE_BOOLEAN == cell.getCellType()) {
                              System.out.print(cell.getBooleanCellValue() + " ");
                          } else if (HSSFCell.CELL_TYPE_BLANK == cell.getCellType()) {
                              System.out.print("BLANK ");
                          } else {
                              System.out.print("Unknown cell type");
                          }
                      }
                  }
              } catch (IOException ex) {
                  System.out.print(ex.getMessage());
              }
          }
      }
      

       

      My pom.xml is :

       

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>
          <groupId>com.test.ca.ti.tools</groupId>
          <artifactId>Test</artifactId>
          <version>1.0-SNAPSHOT</version>
          <packaging>jar</packaging>
          <dependencies>
              <dependency>
                  <groupId>org.apache.poi</groupId>
                  <artifactId>poi</artifactId>
                  <version>3.10-FINAL</version>
                  <type>jar</type>
              </dependency>
          </dependencies>
          <properties>
              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
              <maven.compiler.source>1.7</maven.compiler.source>
              <maven.compiler.target>1.7</maven.compiler.target>
          </properties>
      </project>
      

       

       

      I get these errors hhen running my program :

       

      at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:131)
        at org.apache.poi.poifs.storage.HeaderBlock.<init>(HeaderBlock.java:104)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:128)
        at com.keurig.ca.ti.tools.excel.ExcelReader.main(ExcelReader.java:29)
      

       

      the 29th line in my program is

      POIFSFileSystem fs = new POIFSFileSystem(input);
      

       

      Any help please!

       

      Best regards!