0

Getting Exception in Data Driven Framework Scenario while using Apache POI

I am getting the exception when I execute a scenario using datadriven framework with Apache POI. I am not sure if its a version issue, can anyone please take a look at the exception below to see what is causing this issue and any resolution. Let me know if need anymore details.

Versions: Eclipse: Oxygen.3a Release (4.7.3a) WebDriver: 3.4.0 POI: 3.17

As a work around I have added dom4j-1.6.jar and xmlbeans-xmlpublic-2.3.0.jar, which dint seem to solve the issue.

 EXEPTION:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/impl/common/SystemCache
    at org.apache.poi.POIXMLDocument.init(POIXMLDocument.java:76)
    at org.apache.poi.POIXMLDocument.<init>(POIXMLDocument.java:62)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:295)
    at Carpet_Utility.ExcelUtils.setExcelfile(ExcelUtils.java:24)
    at Carpet_Main.Main1.main(Main1.java:19)
 Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.impl.common.SystemCache
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 5 more

Exception Screenshot

2
  • can you add xmlbeans-2.3.0.jar dependency as well? Commented Sep 19, 2019 at 3:09
  • 2
    Not clear why always the mysterious advise about the needed dependencies. Component Map clearly tells the needed dependencies. Commented Sep 19, 2019 at 3:42

2 Answers 2

1

I think you have downloaded the wrong jar xmlbeans-xmlpublic-2.3.0.jar.

You have to download the xmlbeans-x.x.x.jar.

If you are using maven, then add this dependency in the pom.xml :

<dependency>
    <groupId>org.apache.xmlbeans</groupId>
    <artifactId>xmlbeans</artifactId>
    <version>2.3.0</version>
</dependency>

or if you want to use jar, then download from here : mvnrepository

The screenshot of the org.apache.xmlbeans.impl.common.SystemCache class :

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

As i have already mentioned in a comments section that for apache poi functionality you have to add xmlbeans-2.3.0.jar dependency as well.

  1. If you are using maven then you have to add this dependency in pom.xml along with dom4j-1.6.jar.
  2. If you are using through jar dependency then you have to download this jar and then have to include in your project.

2 Comments

Thanks Gaurav, this time it worked, I dint pay attention that the incorrect jar was downloaded
@ZeeMo can you accept the answer also up vote as well so that this comment will be useful for someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.