On Sunday 10 April 2011 9:27:38 PM Dan Powell wrote:
> https://issues.apache.org/jira/browse/CXF-3450
As mentioned last week, this is a bug in JAXB. If you just do "pure jaxb"
JAXBContext ctx = JAXBContext.newInstance("ping.types");
SchemaOutputResolver resolver = new SchemaOutputResolver() {
public Result createOutput(String namespaceUri,
String suggestedFileName) throws IOException {
StreamResult r = new StreamResult(new ByteArrayOutputStream());
r.setSystemId(suggestedFileName);
return r;
};
};
ctx.generateSchema(resolver);
That fails with the same error and has nothing to do with CXF. Thus, it
something in JAXB.
You can work around this by specifying the wsdlLocation for the wsdl or
specify the schemalocations for the schemas. That way, CXF won't need to
generate the schemas from the JAXB beans.
Dan
>
> Thank you!
>
> Dan
>
> On Apr 10, 2011, at 7:14 PM, Benson Margulies wrote:
> > You can attach a test case to a JIRA, and someone is likely to attack.
> >
> > On Sun, Apr 10, 2011 at 6:24 PM, Dan Powell <[email protected]> wrote:
> >> Is there any additional information I could proceed to help debug this?
> >> I'm not sure where to start digging into the way this reflection works,
> >> but would happily take any pointers to resolve this issue anyone may
> >> have.
> >>
> >> Dan
> >>
> >> On Apr 2, 2011, at 7:40 PM, Dan Powell wrote:
> >>> When using JAXB bindings, specifically "generateMixedExtensions" I am
> >>> unable to build a service from a class. I get the following exception
> >>> when I publish the endpoint. A stripped down test case is attached.
> >>> If I specify the wsdlLocation annotation, things work fine, so it is a
> >>> difference between how
> >>> ReflectionServiceFactoryBean.buildServiceFromClass and
> >>> .buildServiceFromWSDL work.
> >>>
> >>> Thanks!
> >>>
> >>> Dan
> >>>
> >>> javax.xml.ws.WebServiceException: java.lang.IllegalStateException:
> >>> start tag has already been written
> >>>
> >>> at
> >>> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:34
> >>> 3) at
> >>> org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:239)
> >>> at
> >>> org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(P
> >>> roviderImpl.java:144) at
> >>> javax.xml.ws.Endpoint.publish(Endpoint.java:170)
> >>> at ServerTest.server(ServerTest.java:5)
> >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>> at
> >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor
> >>> Impl.java:39) at
> >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod
> >>> AccessorImpl.java:25) at
> >>> java.lang.reflect.Method.invoke(Method.java:597)
> >>> at
> >>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Fram
> >>> eworkMethod.java:44) at
> >>> org.junit.internal.runners.model.ReflectiveCallable.run(Reflecti
> >>> veCallable.java:15) at
> >>> org.junit.runners.model.FrameworkMethod.invokeExplosively(Framew
> >>> orkMethod.java:41) at
> >>> org.junit.internal.runners.statements.InvokeMethod.evaluate(Invo
> >>> keMethod.java:20) at
> >>> org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUni
> >>> t4ClassRunner.java:79) at
> >>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cla
> >>> ssRunner.java:71) at
> >>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Cla
> >>> ssRunner.java:49) at
> >>> org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at
> >>> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> >>> at
> >>> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191
> >>> ) at
> >>> org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> >>> at
> >>> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> >>> at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at
> >>> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4Tes
> >>> tSet.java:35) at
> >>> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(J
> >>> Unit4Provider.java:146) at
> >>> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Pro
> >>> vider.java:97) at
> >>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor
> >>> Impl.java:39) at
> >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod
> >>> AccessorImpl.java:25) at
> >>> java.lang.reflect.Method.invoke(Method.java:597)
> >>> at
> >>> org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProx
> >>> y.invoke(ProviderFactory.java:103) at $Proxy0.invoke(Unknown
> >>> Source)
> >>> at
> >>> org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(
> >>> SurefireStarter.java:145) at
> >>> org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProc
> >>> ess(SurefireStarter.java:87) at
> >>> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.
> >>> java:69)
> >>>
> >>> Caused by: java.lang.IllegalStateException: start tag has already been
> >>> written
> >>>
> >>> at
> >>> com.sun.xml.txw2.ContainerElement.checkStartTag(ContainerElement
> >>> .java:160) at
> >>> com.sun.xml.txw2.ContainerElement.addAttribute(ContainerElement.
> >>> java:149) at
> >>> com.sun.xml.txw2.ContainerElement.invoke(ContainerElement.java:1
> >>> 29) at $Proxy29.mixed(Unknown Source)
> >>> at
> >>> com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.write
> >>> Class(XmlSchemaGenerator.java:924) at
> >>> com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.write
> >>> To(XmlSchemaGenerator.java:668) at
> >>> com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.acces
> >>> s$700(XmlSchemaGenerator.java:493) at
> >>> com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchema
> >>> Generator.java:475) at
> >>> com.sun.xml.bind.v2.runtime.JAXBContextImpl.generateSchema(JAXBC
> >>> ontextImpl.java:826) at
> >>> org.apache.cxf.jaxb.JAXBUtils.generateJaxbSchemas(JAXBUtils.java
> >>> :760) at
> >>> org.apache.cxf.jaxb.JAXBDataBinding.generateJaxbSchemas(JAXBData
> >>> Binding.java:449) at
> >>> org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.j
> >>> ava:376) at
> >>> org.apache.cxf.service.factory.AbstractServiceFactoryBean.initia
> >>> lizeDataBindings(AbstractServiceFactoryBean.java:86) at
> >>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buil
> >>> dServiceFromClass(ReflectionServiceFactoryBean.java:442) at
> >>> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServic
> >>> eFromClass(JaxWsServiceFactoryBean.java:680) at
> >>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.init
> >>> ializeServiceModel(ReflectionServiceFactoryBean.java:505) at
> >>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.crea
> >>> te(ReflectionServiceFactoryBean.java:242) at
> >>> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxW
> >>> sServiceFactoryBean.java:202) at
> >>> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createE
> >>> ndpoint(AbstractWSDLBasedEndpointFactory.java:101) at
> >>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBe
> >>> an.java:148) at
> >>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFa
> >>> ctoryBean.java:183) at
> >>> org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:41
> >>> 5) at
> >>> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:31
> >>> 5) ... 33 more
> >>>
> >>> <jaxb-bindings-test.tar.gz>
--
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com