• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MPXJ : Jaxb error reading xml file

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, is jaxb.properties on the CLASSPATH?
 
Nija Shah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nija, glad to hear it was solved! Thanks for replying.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic