You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Christian Castelli <ch...@habble.it> on 2017/01/25 09:04:57 UTC

ClassCastException while opening XLSX files

Hi all,
when I deploy my web application on a different machine other than mine I
receive this Exception when I try to open XLSX files with

Workbook wb = WorkbookFactory.create(new File(IVENTORY_TEMPLATE));

java.lang.ClassCastException:
org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast
to org.apache.xerces.xni.parser.XMLParserConfiguration

I'm using POI 3.15 in a multi-module maven web application (web, ejb, jpa)
packaged as an EAR archive. I've attached here the complete stacktrace and
my maven dependency tree from EAR project. Can you spot a misconfiguration
or do you have any advice on how to solve this issue? We're pretty sure
there's nothing wrong with the Excel files (created both with Excel 2007
and OpenOffice).
Thanks in advance.

-- 
*Christian Castelli*
Senior Developer


*Habble Srl*
Via della Canapiglia, 5
56019 Vecchiano (Pi) - Italy
Lat: 43° 46' 53.03" N
Long: 10° 20' 10.36" E
Help Desk: +39 050 6397490
E-Fax:+39 050 6390236
Web: http://www.habble.it
Skype id: christrack
LinkedIn: christian.castelli <http://it.linkedin.com/in/christiancastelli/>


Rispetta l'ambiente, stampa questa mail solo se veramente necessario.

Re: ClassCastException while opening XLSX files

Posted by Christian Castelli <ch...@habble.it>.
Thanks Javen,
I'll try it.

2017-01-25 16:26 GMT+01:00 Javen O'Neal <on...@apache.org>:

> Looks like both POI 3.15 and 3.6 tried to load, but Maven correctly
> rejected 3.6 due to a duplicate version conflict. However, if the library
> that tried to import 3.6 is expecting a class from 3.6 that was removed or
> renamed in 3.15, you would likely get some kind of Class error.
> Seems to be from it.habble:habble-ejbs:ejb based on your dependency tree.
> Either remove that dependency or fork and rebuild that dependency with POI
> 3.15 to avoid mixed versions.
>
> You also use both org.apache.xmlbeans 2.3 and 2.6, and maven rejects 2.6.
> Either version should work, but 2.6 is preferred.
> https://poi.apache.org/overview.html#components
>
>
>
> On Jan 25, 2017 02:10, "Christian Castelli" <ch...@habble.it>
> wrote:
>
> > It's important to notice that this exception is occasionally thrown, so
> > it's Maven related but I cannot understand what causes differences
> between
> > builds...
> >
> > On 2017-01-25 10:09 (+0100), Jörn Franke <jo...@gmail.com> wrote:
> > > Might be that one dependency loads a different version of the parser?
> > >
> > > > On 25 Jan 2017, at 10:04, Christian Castelli <
> > christian.castelli@habble.it> wrote:
> > > >
> > > > Hi all,
> > > > when I deploy my web application on a different machine other than
> > mine I receive this Exception when I try to open XLSX files with
> > > >
> > > > Workbook wb = WorkbookFactory.create(new File(IVENTORY_TEMPLATE));
> > > >
> > > > java.lang.ClassCastException: org.apache.xerces.parsers.
> > XIncludeAwareParserConfiguration cannot be cast to
> > org.apache.xerces.xni.parser.XMLParserConfiguration
> > > >
> > > > I'm using POI 3.15 in a multi-module maven web application (web, ejb,
> > jpa) packaged as an EAR archive. I've attached here the complete
> stacktrace
> > and my maven dependency tree from EAR project. Can you spot a
> > misconfiguration or do you have any advice on how to solve this issue?
> > We're pretty sure there's nothing wrong with the Excel files (created
> both
> > with Excel 2007 and OpenOffice).
> > > > Thanks in advance.
> > > >
> > > > --
> > > > Christian Castelli
> > > > Senior Developer
> > > >
> > > >
> > > > Habble Srl
> > > > Via della Canapiglia, 5
> > > > 56019 Vecchiano (Pi) - Italy
> > > > Lat: 43° 46' 53.03" N
> > > > Long: 10° 20' 10.36" E
> > > > Help Desk: +39 050 6397490
> > > > E-Fax:+39 050 6390236
> > > > Web: http://www.habble.it
> > > > Skype id: christrack
> > > > LinkedIn: christian.castelli
> > > >
> > > > Rispetta l'ambiente, stampa questa mail solo se veramente necessario.
> > > > <stacktrace.txt>
> > > > <mvn_tree_dependencies.txt>
> > > >
> > > > ------------------------------------------------------------
> ---------
> > > > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> > > > For additional commands, e-mail: user-help@poi.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> > For additional commands, e-mail: user-help@poi.apache.org
> >
> >
>



-- 
*Christian Castelli*
Senior Developer


*Habble Srl*
Via della Canapiglia, 5
56019 Vecchiano (Pi) - Italy
Lat: 43° 46' 53.03" N
Long: 10° 20' 10.36" E
Help Desk: +39 050 6397490
E-Fax:+39 050 6390236
Web: http://www.habble.it
Skype id: christrack
LinkedIn: christian.castelli <http://it.linkedin.com/in/christiancastelli/>


Rispetta l'ambiente, stampa questa mail solo se veramente necessario.

Re: ClassCastException while opening XLSX files

Posted by Javen O'Neal <on...@apache.org>.
Looks like both POI 3.15 and 3.6 tried to load, but Maven correctly
rejected 3.6 due to a duplicate version conflict. However, if the library
that tried to import 3.6 is expecting a class from 3.6 that was removed or
renamed in 3.15, you would likely get some kind of Class error.
Seems to be from it.habble:habble-ejbs:ejb based on your dependency tree.
Either remove that dependency or fork and rebuild that dependency with POI
3.15 to avoid mixed versions.

You also use both org.apache.xmlbeans 2.3 and 2.6, and maven rejects 2.6.
Either version should work, but 2.6 is preferred.
https://poi.apache.org/overview.html#components



On Jan 25, 2017 02:10, "Christian Castelli" <ch...@habble.it>
wrote:

> It's important to notice that this exception is occasionally thrown, so
> it's Maven related but I cannot understand what causes differences between
> builds...
>
> On 2017-01-25 10:09 (+0100), Jörn Franke <jo...@gmail.com> wrote:
> > Might be that one dependency loads a different version of the parser?
> >
> > > On 25 Jan 2017, at 10:04, Christian Castelli <
> christian.castelli@habble.it> wrote:
> > >
> > > Hi all,
> > > when I deploy my web application on a different machine other than
> mine I receive this Exception when I try to open XLSX files with
> > >
> > > Workbook wb = WorkbookFactory.create(new File(IVENTORY_TEMPLATE));
> > >
> > > java.lang.ClassCastException: org.apache.xerces.parsers.
> XIncludeAwareParserConfiguration cannot be cast to
> org.apache.xerces.xni.parser.XMLParserConfiguration
> > >
> > > I'm using POI 3.15 in a multi-module maven web application (web, ejb,
> jpa) packaged as an EAR archive. I've attached here the complete stacktrace
> and my maven dependency tree from EAR project. Can you spot a
> misconfiguration or do you have any advice on how to solve this issue?
> We're pretty sure there's nothing wrong with the Excel files (created both
> with Excel 2007 and OpenOffice).
> > > Thanks in advance.
> > >
> > > --
> > > Christian Castelli
> > > Senior Developer
> > >
> > >
> > > Habble Srl
> > > Via della Canapiglia, 5
> > > 56019 Vecchiano (Pi) - Italy
> > > Lat: 43° 46' 53.03" N
> > > Long: 10° 20' 10.36" E
> > > Help Desk: +39 050 6397490
> > > E-Fax:+39 050 6390236
> > > Web: http://www.habble.it
> > > Skype id: christrack
> > > LinkedIn: christian.castelli
> > >
> > > Rispetta l'ambiente, stampa questa mail solo se veramente necessario.
> > > <stacktrace.txt>
> > > <mvn_tree_dependencies.txt>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> > > For additional commands, e-mail: user-help@poi.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: ClassCastException while opening XLSX files

Posted by Christian Castelli <ch...@habble.it>.
It's important to notice that this exception is occasionally thrown, so it's Maven related but I cannot understand what causes differences between builds...

On 2017-01-25 10:09 (+0100), Jörn Franke <jo...@gmail.com> wrote: 
> Might be that one dependency loads a different version of the parser?
> 
> > On 25 Jan 2017, at 10:04, Christian Castelli <ch...@habble.it> wrote:
> > 
> > Hi all,
> > when I deploy my web application on a different machine other than mine I receive this Exception when I try to open XLSX files with 
> > 
> > Workbook wb = WorkbookFactory.create(new File(IVENTORY_TEMPLATE));
> > 
> > java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
> > 
> > I'm using POI 3.15 in a multi-module maven web application (web, ejb, jpa) packaged as an EAR archive. I've attached here the complete stacktrace and my maven dependency tree from EAR project. Can you spot a misconfiguration or do you have any advice on how to solve this issue? We're pretty sure there's nothing wrong with the Excel files (created both with Excel 2007 and OpenOffice).
> > Thanks in advance.
> > 
> > -- 
> > Christian Castelli
> > Senior Developer
> > 
> > 
> > Habble Srl
> > Via della Canapiglia, 5
> > 56019 Vecchiano (Pi) - Italy
> > Lat: 43° 46' 53.03" N
> > Long: 10° 20' 10.36" E
> > Help Desk: +39 050 6397490
> > E-Fax:+39 050 6390236
> > Web: http://www.habble.it 
> > Skype id: christrack
> > LinkedIn: christian.castelli
> >  
> > Rispetta l'ambiente, stampa questa mail solo se veramente necessario.
> > <stacktrace.txt>
> > <mvn_tree_dependencies.txt>
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> > For additional commands, e-mail: user-help@poi.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: ClassCastException while opening XLSX files

Posted by Christian Castelli <ch...@habble.it>.
Maybe, it could be a conflict with some other library, I can see from Maven dependency tree that when it packages EAR it removes many artifacts for avoiding duplicates or conflicts, so I cannot understand what's the problem...

On 2017-01-25 10:09 (+0100), Jörn Franke <jo...@gmail.com> wrote: 
> Might be that one dependency loads a different version of the parser?
> 
> > On 25 Jan 2017, at 10:04, Christian Castelli <ch...@habble.it> wrote:
> > 
> > Hi all,
> > when I deploy my web application on a different machine other than mine I receive this Exception when I try to open XLSX files with 
> > 
> > Workbook wb = WorkbookFactory.create(new File(IVENTORY_TEMPLATE));
> > 
> > java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
> > 
> > I'm using POI 3.15 in a multi-module maven web application (web, ejb, jpa) packaged as an EAR archive. I've attached here the complete stacktrace and my maven dependency tree from EAR project. Can you spot a misconfiguration or do you have any advice on how to solve this issue? We're pretty sure there's nothing wrong with the Excel files (created both with Excel 2007 and OpenOffice).
> > Thanks in advance.
> > 
> > -- 
> > Christian Castelli
> > Senior Developer
> > 
> > 
> > Habble Srl
> > Via della Canapiglia, 5
> > 56019 Vecchiano (Pi) - Italy
> > Lat: 43° 46' 53.03" N
> > Long: 10° 20' 10.36" E
> > Help Desk: +39 050 6397490
> > E-Fax:+39 050 6390236
> > Web: http://www.habble.it 
> > Skype id: christrack
> > LinkedIn: christian.castelli
> >  
> > Rispetta l'ambiente, stampa questa mail solo se veramente necessario.
> > <stacktrace.txt>
> > <mvn_tree_dependencies.txt>
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> > For additional commands, e-mail: user-help@poi.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: ClassCastException while opening XLSX files

Posted by Jörn Franke <jo...@gmail.com>.
Might be that one dependency loads a different version of the parser?

> On 25 Jan 2017, at 10:04, Christian Castelli <ch...@habble.it> wrote:
> 
> Hi all,
> when I deploy my web application on a different machine other than mine I receive this Exception when I try to open XLSX files with 
> 
> Workbook wb = WorkbookFactory.create(new File(IVENTORY_TEMPLATE));
> 
> java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
> 
> I'm using POI 3.15 in a multi-module maven web application (web, ejb, jpa) packaged as an EAR archive. I've attached here the complete stacktrace and my maven dependency tree from EAR project. Can you spot a misconfiguration or do you have any advice on how to solve this issue? We're pretty sure there's nothing wrong with the Excel files (created both with Excel 2007 and OpenOffice).
> Thanks in advance.
> 
> -- 
> Christian Castelli
> Senior Developer
> 
> 
> Habble Srl
> Via della Canapiglia, 5
> 56019 Vecchiano (Pi) - Italy
> Lat: 43° 46' 53.03" N
> Long: 10° 20' 10.36" E
> Help Desk: +39 050 6397490
> E-Fax:+39 050 6390236
> Web: http://www.habble.it 
> Skype id: christrack
> LinkedIn: christian.castelli
>  
> Rispetta l'ambiente, stampa questa mail solo se veramente necessario.
> <stacktrace.txt>
> <mvn_tree_dependencies.txt>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org