Thanks Alessio for sharing, Yes, I posted question on metro users mailing list too, and then managed to find my way around this issue - looking better at stacktrace helped, noticed internal jaxws packages before internal jaxb packages. It seems endorsing JAXB is not enough, if Java SE internal JAXWS gets picked first it will also mandate use of Java SE internal JAXB regardless if another JAXB has been endorsed.
Kind regards, Stevo. On Mon, Jul 2, 2012 at 7:30 PM, Alessio Soldano <[email protected]> wrote: > For the records: > > http://www.java.net/forum/topic/glassfish/metro-and-jaxb/yet-another-jaxb-compatability-issue > > On 06/28/2012 05:23 PM, Stevo Slavić wrote: > > Hello Apache CXF community, > > > > I'm running into what seems as some compatibility issues while migrating > a > > legacy application to a new platform - Java SE 7, Java EE 6, JBoss AS > 7.1.1. > > JBoss AS 7.1.1 provides CXF 2.4.6. Using Maven and > cxf-codegen-plugin:2.4.6 > > code gets generated from wsdl file. > > > > wsdl2java was first failing with: > > > > org.apache.xml.dtm.ref.DTMManagerDefault cannot be cast to > > org.apache.xml.dtm.DTMManager > > > > After configuring cxf-codegen-plugin:2.4.6 dependencies to > include/override > > <dependency> > > <groupId>xalan</groupId> > > <artifactId>xalan</artifactId> > > <version>2.7.1.jbossorg-2</version> > > </dependency> > > > > wsdl2java would generate code without exceptions. > > > > Unfortunately now tests which reference generated code fail with: > > > > foo.Bar$JaxbAccessorF_aField cannot be cast to > > com.sun.xml.internal.bind.v2.runtime.reflect.Accessor > > > > Does anyone know what could be the problem here and how to fix it? > > > > Please correct me if wrong, but it seems to me this is caused by some > > compatibility issue, more specifically JAXB versions, one version used to > > generate code and other at (test) runtime. > > I'm using Java SE 7 to run tests (and maven 3.0.4). If I'm not mistaken, > > Java SE 7 embeds JAXB 2.2, and JAXB 2.2 is part of Java EE 6 provided > APIs > > and JBoss 7.1.1 provides appropriate implementation. > > > > I guess internal part in > > com.sun.xml.internal.bind.v2.runtime.reflect.Accessor suggests that > > something is using Java SE internal/embedded JAXB, while something else > is > > using non-internal variant or different incompatible version. > > Not sure who is using what but I assume cxf-codegen-plugin:2.4.6 is using > > non-internal JAXB 2.2. > > I've tried to configure endorsing jaxb-impl, jaxb-api and jaxb-xjc in > both > > maven-compiler-plugin, and maven-surefire-plugin (use > > maven-dependency-plugin to copy these libs in target/endorsed, and then > in > > compiler and tests configure this as endorsed directory) but I'm still > > getting same error. > > > > Any constructive ideas are welcome. Thanks in advance! > > > > Kind regards, > > Stevo Slavić. > > > > > -- > Alessio Soldano > Web Service Lead, JBoss >
