Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MPXJ : Jaxb error reading xml file

 
Nija Shah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Nija Shah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, is jaxb.properties on the CLASSPATH?
 
Nija Shah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nija, glad to hear it was solved! Thanks for replying.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic