title: Apache POI Classnotfound Exception org.apache.poi.ss.usermodel.Cell
body: <p>Hello I am getting the following exception when running the jar. Can somebody help please?</p>
  
  <pre><code>U2007750s-MacBook-Pro:target u2007750$ java -jar ExcelCSVConverter-0.0.1-SNAPSHOT.jar
      Error: A JNI error has occurred, please check your installation and try again
      Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Cell
          at java.lang.Class.getDeclaredMethods0(Native Method)
          at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
          at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
          at java.lang.Class.getMethod0(Class.java:3018)
          at java.lang.Class.getMethod(Class.java:1784)
          at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
          at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
      Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Cell
          at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          ... 7 more
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>Until now I only had the <code>poi-ooxml</code> dependency in the pom.xml:</p>
  
  <pre><code>     &lt;dependency&gt;
          &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
          &lt;artifactId&gt;poi-ooxml&lt;/artifactId&gt;
          &lt;version&gt;3.17&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>The program executes correctly in eclipse. It's only in the command line where the error occurs. </p>
  
  <p>Now after recommendation of you guys, I have also added the second dependency <code>poi</code>:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
      &lt;artifactId&gt;poi&lt;/artifactId&gt;
      &lt;version&gt;3.17&lt;/version&gt;
  &lt;/dependency&gt; 
  </code></pre>
  
  <p>but still not success. Now the error occurs for this class:</p>
  
  <pre><code>U2007750s-MacBook-Pro:target u2007750$ java -jar ExcelCSVConverter-0.0.1-SNAPSHOT.jar
  Error: A JNI error has occurred, please check your installation and try again
  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/impl/values/XmlValueOutOfRangeException
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
      at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
      at java.lang.Class.getMethod0(Class.java:3018)
      at java.lang.Class.getMethod(Class.java:1784)
      at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
  Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 7 more
  </code></pre>
  
  <p>The method is:</p>
  
  <pre><code>private static String getCellData(XSSFCell myCell) {
          String cellData = "";
          if (myCell == null) {
              cellData += CSV_SEPERATOR_CHAR;
          } else {
              try {
                  switch (myCell.getCellTypeEnum()) {
                  case STRING:
                  case BOOLEAN:
                      cellData += myCell.getRichStringCellValue() + CSV_SEPERATOR_CHAR;
                      break;
                  case NUMERIC:
                      cellData += getNumericValue(myCell);
                      break;
                  case FORMULA:
                      cellData += getFormulaValue(myCell);
                  default:
                      cellData += CSV_SEPERATOR_CHAR;
                  }
              } catch (XmlValueOutOfRangeException e) {
                  int a =2;
                  //System.out.println("XmlValueOutOfRangeException for: "+ myCell.getRawValue());
                  String rawValue = myCell.getRawValue();
                  while(rawValue.startsWith("0")) {
                      rawValue = rawValue.substring(1);
                  }
                  cellData += rawValue+ CSV_SEPERATOR_CHAR;
              }
          }
          return cellData;
      }
  </code></pre>