cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Unable to build service from class with JAXB bindings
Date Thu, 07 Apr 2011 17:33:38 GMT
On Saturday 02 April 2011 7:40:42 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.

This seems to be a bug in JAXB.   If you just do:

      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.

Dan




> 
> Thanks!
> 
> Dan
> 
> javax.xml.ws.WebServiceException: java.lang.IllegalStateException: start
> tag has already been written at
> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:343) at
> org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:239) at
> org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImp
> l.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(NativeMethodAccessorImpl.java:
> 39) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl.java:25) at java.lang.reflect.Method.invoke(Method.java:597)
> 	at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMetho
> d.java:44) at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable
> .java:15) at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.
> java:41) at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.j
> ava:20) at
> org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRun
> ner.java:79) at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.j
> ava:71) at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.j
> ava: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(JUnit4TestSet.java:
> 35) at
> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provi
> der.java:146) at
> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java
> :97) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
> pl.java:25) at java.lang.reflect.Method.invoke(Method.java:597)
> 	at
> org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(P
> roviderFactory.java:103) at $Proxy0.invoke(Unknown Source)
> 	at
> org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireSt
> arter.java:145) at
> org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(Surefi
> reStarter.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:129) at
> $Proxy29.mixed(Unknown Source)
> 	at
> com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeClass(XmlS
> chemaGenerator.java:924) at
> com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSche
> maGenerator.java:668) at
> com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$700(XmlS
> chemaGenerator.java:493) at
> com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchemaGenerator.
> java:475) at
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.generateSchema(JAXBContextImpl
> .java:826) at
> org.apache.cxf.jaxb.JAXBUtils.generateJaxbSchemas(JAXBUtils.java:760) at
> org.apache.cxf.jaxb.JAXBDataBinding.generateJaxbSchemas(JAXBDataBinding.ja
> va:449) at
> org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:376)
> at
> org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBi
> ndings(AbstractServiceFactoryBean.java:86) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFr
> omClass(ReflectionServiceFactoryBean.java:442) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass
> (JaxWsServiceFactoryBean.java:680) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServ
> iceModel(ReflectionServiceFactoryBean.java:505) at
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Reflect
> ionServiceFactoryBean.java:242) at
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFa
> ctoryBean.java:202) at
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(Ab
> stractWSDLBasedEndpointFactory.java:101) at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:14
> 8) at
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.
> java:183) at
> org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:415) at
> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:315) ... 33
> more

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Mime
View raw message