Bug 62874 - NoClassDefFoundError on calling getSummaryInformationProperties() method of PropertyIDMap class
Summary: NoClassDefFoundError on calling getSummaryInformationProperties() method of P...
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HPSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-01 08:04 UTC by Vishal Singh Arya
Modified: 2018-12-22 16:53 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vishal Singh Arya 2018-11-01 08:04:46 UTC
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();

    }
}
Comment 1 Nick Burch 2018-11-01 13:22:20 UTC
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
Comment 2 Vishal Singh Arya 2018-11-01 13:26:41 UTC
The first statement in Hello.java runs fine i.e. System.out.println(PropertyIDMap.PID_TITLE);
Error comes in the second statement.
Comment 3 Andreas Beeker 2018-11-06 22:04:46 UTC
(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,...)?
Comment 4 Dominik Stadler 2018-12-22 16:53:56 UTC
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.