File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes MPXJ : Jaxb error reading xml file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "MPXJ : Jaxb error reading xml file " Watch "MPXJ : Jaxb error reading xml file " New topic
Author

MPXJ : Jaxb error reading xml file

Nija Shah
Greenhorn

Joined: Nov 12, 2008
Posts: 7
I am trying to use mpxj to read from and write to an xml file but I am getting a jaxb error "Failed to parse file". I can see that it fails at this line on the MSPDIReader

JAXBContext context = JAXBContext.newInstance ("net.sf.mpxj.mspdi.schema");

I have installed the jaxb and other jar files in the right location. One thing I did notice was the the poi jar shipped with mpxj was a newer one, so I replaced my old version with the new one. Any suggestions on getting past this much appreciated.

thanks
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Welcome to Javaranch!

Can you show us the stack trace that gets produced? It's saying that it can't parse the file but there can be many reasons for that...


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Nija Shah
Greenhorn

Joined: Nov 12, 2008
Posts: 7
Hi Marijn,
Looks like a jaxbException... Here's the stack.
wt.util.WTException: net.sf.mpxj.MPXJException: Failed to parse file
Nested exception is: net.sf.mpxj.MPXJException: Failed to parse file
at net.sf.mpxj.mspdi.MSPDIReader.read(MSPDIReader.java:153)
at com.ptc.projectmanagement.msproject.MspImporter.constructPlanHierarchy(MspImporter.java:387)
Nija Shah
Greenhorn

Joined: Nov 12, 2008
Posts: 7
Also, at the bottom of the stack I noticed it is still looking for the properties file

Caused by: javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package net.sf.mpxj.mspdi.schema
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:205)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:238)
at net.sf.mpxj.mspdi.MSPDIReader.read(MSPDIReader.java:106)
... 27 more
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

OK, is jaxb.properties on the CLASSPATH?
Nija Shah
Greenhorn

Joined: Nov 12, 2008
Posts: 7
Hi Martjin,

Sorry for the late response. Was on vacation. I got past the jaxbexception. Turned out I still had jaxb 1.0 in my codebase taking precedence over the 2.0 I placed elsewhere. Now that I have 2.0 in all the right places, I'm able to import/export xml files !

thanks for the suggestions !
Nija
[ November 20, 2008: Message edited by: Nija Shah ]
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Nija, glad to hear it was solved! Thanks for replying.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MPXJ : Jaxb error reading xml file
 
Similar Threads
MPXJ - getEditableActualCosts is always false ?!
MPXJ isnt reading the right daysPerMonth from project header?!
Having Problems open a xml file generated with mpxj
MPXJ problem
Read a MSProject 2007 with mpxj