Following exception is seen when we try to create an object of PropertyIDMap class using getSummaryInformationProperties() or getDocumentSummaryInformationProperties() or getFallbackProperties() method: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/hpsf/wellknown/PropertyIDMap at com.day.cq.dam.handler.standard.msoffice.Hello.main(Hello.java:10) Caused by: java.lang.ClassNotFoundException: org.apache.poi.hpsf.wellknown.PropertyIDMap 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) ... 1 more I wrote a simple class(Hello.java) to reproduce this (after setting up all the dependencies) : package hello; import org.apache.poi.hpsf.wellknown.PropertyIDMap; public class Hello { public static void main(String[] args) { System.out.println(PropertyIDMap.PID_TITLE); PropertyIDMap p = PropertyIDMap.getFallbackProperties(); } }
Are you sure you don't have multiple versions of Apache POI on your classpath? See http://poi.apache.org/help/faq.html#faq-N10006 for how to check
The first statement in Hello.java runs fine i.e. System.out.println(PropertyIDMap.PID_TITLE); Error comes in the second statement.
(In reply to Vishal Singh Arya from comment #0) > ... after setting up all the dependencies) : I've just create a simple maven project, having only one dependency to org.apache.poi:poi:4.0.0 in - your test isn't failing in this case. How do you setup the dependencies? ... i.e. do you use a dependency manager (maven,gradle,...)?
Very likely caused by duplicated dependencies which include older versions of Apache POI, thus closing worksforme unless you can provide a more self-sufficient testcase/sample project which reproduces the problem.