Aha, so the class signature works. I use the String signature: JAXBContext ctx = JAXBContext.newInstance("com.example.jaxb.mypkg");
Actually I just noticed that you don't need any data classes to demonstrate the problem. Just call JAXBContext.newInstance("foo"). A working JAXB should give this error: JAXBException: "foo" doesnt contain ObjectFactory.class or jaxb.index instead of NoSuchMethodError. -- Björn Danielsson Cuspy Code AB Romain Manni-Bucau <rmannibu...@gmail.com> wrote: > just tried a just build trunk and this code works: > > final JAXBContext ctx = JAXBContext.newInstance(XmlThing.class); > final StringWriter writer = new StringWriter(); > ctx.createMarshaller().marshal(new XmlThing("foo"), writer); > > anything to reproduce your issue? > > - Romain > > > 2012/5/3 Bjorn Danielsson <bjorn-apa...@lists.cuspycode.com> > >> Hi, >> >> I get the following error when I try to use JAXB in my webapp: >> >> java.lang.NoSuchMethodError: >> javax.xml.bind.ContextFinder.find(Ljava/lang/String;Ljava/lang/ClassLoader;Ljava/util/Map;)Ljavax/xml/bind/JAXBContext; >> >> I noticed that TomEE uses an endorsed version 2.2 of JAXB, >> with the ContextFinder class excluded, as mentioned here: >> >> https://issues.apache.org/jira/browse/TOMEE-145 >> >> But the JVM version of JAXB does not have any ContextFinder.find() >> method with the signature in my error message, so something is >> obviously broken. I also checked the latest release (2.2.5) of >> JAXB-RI, and there is no such signature there either. >> >> When I replaced the endorsed jaxb-api.jar and jaxb-impl.jar with >> the corresponding jars from JAXB-RI 2.2.5 the error went away, >> and as far as I can see that did not break anything else. >> >> Version info: >> >> apache-tomee-plus-1.0.0-beta-3-SNAPSHOT (from May 3) >> jdk1.6.0_27 (which I think contains JAXB-RI version 2.1.10) >> >> -- >> Björn Danielsson >> Cuspy Code AB >>