You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by MARTELLI Julien <jm...@softwaymedical.fr> on 2011/02/07 11:18:22 UTC

IllegalStateException - start tag has already been written

Hi everyone,

To develop a Web Service client I generate the classes from the WSDL file using the cxf-codegen-plugin.
This generation works fine, to customize it I use a xjc binding file :

<?xml version="1.0" encoding="UTF-8"?>
<bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" extensionBindingPrefixes="xjc">
                <globalBindings generateMixedExtensions="true">
                               <serializable />
                </globalBindings>
</bindings>


But when I build the PortType in my client code I get the following exception :

IllegalStateException  start tag has already been written


I found this post (http://osdir.com/ml/users-servicemix.apache.org/2010-08/msg00077.html) that looks like the same issue but there is no solution...

I use cxf 2.2.10.

Do you guys have any clue ?

Thanks,
j.

RE: IllegalStateException - start tag has already been written

Posted by MARTELLI Julien <jm...@softwaymedical.fr>.
Based on this JIRA: 
http://servicemix.396122.n5.nabble.com/jira-Created-SMXCOMP-790-IllegalStateException-Deploying-CXF-SE-Service-Unit-with-JAX-WS-Binding-Fils-td2644172.html

I tried to add jaxb-xjc 2.1.3 and jaxb-impl 2.1.3 as dependencies for the cxf-codegen-plugin and it actually worked... I am able to deploy the service....

Any clue?

-----Message d'origine-----
De : MARTELLI Julien [mailto:jmartelli@softwaymedical.fr] 
Envoyé : mardi 8 février 2011 14:52
À : users@cxf.apache.org
Objet : RE: IllegalStateException - start tag has already been written

Opening a JIRA for this is a good idea but the problem is that I have plenty of generated classes (the jar is >2000k) and I cannot reproduce the problem with another WSDL and schema...

It's somehow very specific to the WSDL and schemas I use.

What do you think? Do you think I can send my example anyway?

-----Message d'origine-----
De : Daniel Kulp [mailto:dkulp@apache.org] 
Envoyé : lundi 7 février 2011 18:16
À : users@cxf.apache.org
Cc : MARTELLI Julien
Objet : Re: IllegalStateException - start tag has already been written

On Monday 07 February 2011 11:57:37 am MARTELLI Julien wrote:
> I tried to marshall one of these JAXB generated beans and it worked...
> The issue does not look to be on the JAXB side.
> 
> 
> Maybe there is a difference in the libs used when generating the classes
> and the ones used when creating the Service?
> 
> Another solution would be to have wsdl2java generate beans with "content"
> instead of using this mixedExtension that seems to be the issue....
> 
> Any idea?

The only suggestion I would have is to create a small test case and attach to 
a JIRA.   If it's working with pure JAXB, in theory, it should work with CXF 
as well.   I'm really not sure what is going on.  :-(

Well, that and test with 2.3.2 instead.   It might already be fixed.

Dan


> 
> 
> -----Message d'origine-----
> De : Daniel Kulp [mailto:dkulp@apache.org]
> Envoyé : lundi 7 février 2011 17:33
> À : users@cxf.apache.org
> Cc : MARTELLI Julien
> Objet : Re: IllegalStateException - start tag has already been written
> 
> On Monday 07 February 2011 5:37:33 am MARTELLI Julien wrote:
> > I just tried something, and there is something new.
> > 
> > I changed my binding file, I deleted the generateMixedExtensions option.
> > This involves having my classes generated without any XmlMixed
> > annotation. It works, my client is correctly deployed.
> > 
> > But this not solve my problem because I need to have this extension
> > activated in order to add some data to my XML when calling the service.
> > 
> > Any clue?
> 
> If you just take the generated JAXB beans, create a context and marshaller,
> and then call marshal with an XMLStreamReader (also try just an
> outputstream), does the problem also manifest itself?   If so, it would
> definitely be a JAXB issue and a bug would need to be logged there.
> 
> Dan
> 
> > -----Message d'origine-----
> > De : MARTELLI Julien [mailto:jmartelli@softwaymedical.fr]
> > Envoyé : lundi 7 février 2011 11:18
> > À : users@cxf.apache.org
> > Objet : IllegalStateException - start tag has already been written
> > 
> > Hi everyone,
> > 
> > To develop a Web Service client I generate the classes from the WSDL file
> > using the cxf-codegen-plugin. This generation works fine, to customize it
> > I use a xjc binding file :
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> > extensionBindingPrefixes="xjc"> <globalBindings
> > generateMixedExtensions="true">
> > 
> >                                <serializable />
> >                 
> >                 </globalBindings>
> > 
> > </bindings>
> > 
> > 
> > But when I build the PortType in my client code I get the following
> > exception :
> > 
> > IllegalStateException  start tag has already been written
> > 
> > 
> > I found this post
> > (http://osdir.com/ml/users-servicemix.apache.org/2010-08/msg00077.html)
> > that looks like the same issue but there is no solution...
> > 
> > I use cxf 2.2.10.
> > 
> > Do you guys have any clue ?
> > 
> > Thanks,
> > j.

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

RE: IllegalStateException - start tag has already been written

Posted by MARTELLI Julien <jm...@softwaymedical.fr>.
Opening a JIRA for this is a good idea but the problem is that I have plenty of generated classes (the jar is >2000k) and I cannot reproduce the problem with another WSDL and schema...

It's somehow very specific to the WSDL and schemas I use.

What do you think? Do you think I can send my example anyway?

-----Message d'origine-----
De : Daniel Kulp [mailto:dkulp@apache.org] 
Envoyé : lundi 7 février 2011 18:16
À : users@cxf.apache.org
Cc : MARTELLI Julien
Objet : Re: IllegalStateException - start tag has already been written

On Monday 07 February 2011 11:57:37 am MARTELLI Julien wrote:
> I tried to marshall one of these JAXB generated beans and it worked...
> The issue does not look to be on the JAXB side.
> 
> 
> Maybe there is a difference in the libs used when generating the classes
> and the ones used when creating the Service?
> 
> Another solution would be to have wsdl2java generate beans with "content"
> instead of using this mixedExtension that seems to be the issue....
> 
> Any idea?

The only suggestion I would have is to create a small test case and attach to 
a JIRA.   If it's working with pure JAXB, in theory, it should work with CXF 
as well.   I'm really not sure what is going on.  :-(

Well, that and test with 2.3.2 instead.   It might already be fixed.

Dan


> 
> 
> -----Message d'origine-----
> De : Daniel Kulp [mailto:dkulp@apache.org]
> Envoyé : lundi 7 février 2011 17:33
> À : users@cxf.apache.org
> Cc : MARTELLI Julien
> Objet : Re: IllegalStateException - start tag has already been written
> 
> On Monday 07 February 2011 5:37:33 am MARTELLI Julien wrote:
> > I just tried something, and there is something new.
> > 
> > I changed my binding file, I deleted the generateMixedExtensions option.
> > This involves having my classes generated without any XmlMixed
> > annotation. It works, my client is correctly deployed.
> > 
> > But this not solve my problem because I need to have this extension
> > activated in order to add some data to my XML when calling the service.
> > 
> > Any clue?
> 
> If you just take the generated JAXB beans, create a context and marshaller,
> and then call marshal with an XMLStreamReader (also try just an
> outputstream), does the problem also manifest itself?   If so, it would
> definitely be a JAXB issue and a bug would need to be logged there.
> 
> Dan
> 
> > -----Message d'origine-----
> > De : MARTELLI Julien [mailto:jmartelli@softwaymedical.fr]
> > Envoyé : lundi 7 février 2011 11:18
> > À : users@cxf.apache.org
> > Objet : IllegalStateException - start tag has already been written
> > 
> > Hi everyone,
> > 
> > To develop a Web Service client I generate the classes from the WSDL file
> > using the cxf-codegen-plugin. This generation works fine, to customize it
> > I use a xjc binding file :
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> > extensionBindingPrefixes="xjc"> <globalBindings
> > generateMixedExtensions="true">
> > 
> >                                <serializable />
> >                 
> >                 </globalBindings>
> > 
> > </bindings>
> > 
> > 
> > But when I build the PortType in my client code I get the following
> > exception :
> > 
> > IllegalStateException  start tag has already been written
> > 
> > 
> > I found this post
> > (http://osdir.com/ml/users-servicemix.apache.org/2010-08/msg00077.html)
> > that looks like the same issue but there is no solution...
> > 
> > I use cxf 2.2.10.
> > 
> > Do you guys have any clue ?
> > 
> > Thanks,
> > j.

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

Re: IllegalStateException - start tag has already been written

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 07 February 2011 11:57:37 am MARTELLI Julien wrote:
> I tried to marshall one of these JAXB generated beans and it worked...
> The issue does not look to be on the JAXB side.
> 
> 
> Maybe there is a difference in the libs used when generating the classes
> and the ones used when creating the Service?
> 
> Another solution would be to have wsdl2java generate beans with "content"
> instead of using this mixedExtension that seems to be the issue....
> 
> Any idea?

The only suggestion I would have is to create a small test case and attach to 
a JIRA.   If it's working with pure JAXB, in theory, it should work with CXF 
as well.   I'm really not sure what is going on.  :-(

Well, that and test with 2.3.2 instead.   It might already be fixed.

Dan


> 
> 
> -----Message d'origine-----
> De : Daniel Kulp [mailto:dkulp@apache.org]
> Envoyé : lundi 7 février 2011 17:33
> À : users@cxf.apache.org
> Cc : MARTELLI Julien
> Objet : Re: IllegalStateException - start tag has already been written
> 
> On Monday 07 February 2011 5:37:33 am MARTELLI Julien wrote:
> > I just tried something, and there is something new.
> > 
> > I changed my binding file, I deleted the generateMixedExtensions option.
> > This involves having my classes generated without any XmlMixed
> > annotation. It works, my client is correctly deployed.
> > 
> > But this not solve my problem because I need to have this extension
> > activated in order to add some data to my XML when calling the service.
> > 
> > Any clue?
> 
> If you just take the generated JAXB beans, create a context and marshaller,
> and then call marshal with an XMLStreamReader (also try just an
> outputstream), does the problem also manifest itself?   If so, it would
> definitely be a JAXB issue and a bug would need to be logged there.
> 
> Dan
> 
> > -----Message d'origine-----
> > De : MARTELLI Julien [mailto:jmartelli@softwaymedical.fr]
> > Envoyé : lundi 7 février 2011 11:18
> > À : users@cxf.apache.org
> > Objet : IllegalStateException - start tag has already been written
> > 
> > Hi everyone,
> > 
> > To develop a Web Service client I generate the classes from the WSDL file
> > using the cxf-codegen-plugin. This generation works fine, to customize it
> > I use a xjc binding file :
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> > extensionBindingPrefixes="xjc"> <globalBindings
> > generateMixedExtensions="true">
> > 
> >                                <serializable />
> >                 
> >                 </globalBindings>
> > 
> > </bindings>
> > 
> > 
> > But when I build the PortType in my client code I get the following
> > exception :
> > 
> > IllegalStateException  start tag has already been written
> > 
> > 
> > I found this post
> > (http://osdir.com/ml/users-servicemix.apache.org/2010-08/msg00077.html)
> > that looks like the same issue but there is no solution...
> > 
> > I use cxf 2.2.10.
> > 
> > Do you guys have any clue ?
> > 
> > Thanks,
> > j.

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

RE: IllegalStateException - start tag has already been written

Posted by MARTELLI Julien <jm...@softwaymedical.fr>.
I tried to marshall one of these JAXB generated beans and it worked...
The issue does not look to be on the JAXB side.


Maybe there is a difference in the libs used when generating the classes and the ones used when creating the Service?

Another solution would be to have wsdl2java generate beans with "content" instead of using this mixedExtension that seems to be the issue....

Any idea?


-----Message d'origine-----
De : Daniel Kulp [mailto:dkulp@apache.org] 
Envoyé : lundi 7 février 2011 17:33
À : users@cxf.apache.org
Cc : MARTELLI Julien
Objet : Re: IllegalStateException - start tag has already been written

On Monday 07 February 2011 5:37:33 am MARTELLI Julien wrote:
> I just tried something, and there is something new.
> 
> I changed my binding file, I deleted the generateMixedExtensions option.
> This involves having my classes generated without any XmlMixed annotation.
> It works, my client is correctly deployed.
> 
> But this not solve my problem because I need to have this extension
> activated in order to add some data to my XML when calling the service.
> 
> Any clue?

If you just take the generated JAXB beans, create a context and marshaller, 
and then call marshal with an XMLStreamReader (also try just an outputstream), 
does the problem also manifest itself?   If so, it would definitely be a JAXB 
issue and a bug would need to be logged there.

Dan


> 
> 
> -----Message d'origine-----
> De : MARTELLI Julien [mailto:jmartelli@softwaymedical.fr]
> Envoyé : lundi 7 février 2011 11:18
> À : users@cxf.apache.org
> Objet : IllegalStateException - start tag has already been written
> 
> Hi everyone,
> 
> To develop a Web Service client I generate the classes from the WSDL file
> using the cxf-codegen-plugin. This generation works fine, to customize it
> I use a xjc binding file :
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> extensionBindingPrefixes="xjc"> <globalBindings
> generateMixedExtensions="true">
>                                <serializable />
>                 </globalBindings>
> </bindings>
> 
> 
> But when I build the PortType in my client code I get the following
> exception :
> 
> IllegalStateException  start tag has already been written
> 
> 
> I found this post
> (http://osdir.com/ml/users-servicemix.apache.org/2010-08/msg00077.html)
> that looks like the same issue but there is no solution...
> 
> I use cxf 2.2.10.
> 
> Do you guys have any clue ?
> 
> Thanks,
> j.

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

Re: IllegalStateException - start tag has already been written

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 07 February 2011 5:37:33 am MARTELLI Julien wrote:
> I just tried something, and there is something new.
> 
> I changed my binding file, I deleted the generateMixedExtensions option.
> This involves having my classes generated without any XmlMixed annotation.
> It works, my client is correctly deployed.
> 
> But this not solve my problem because I need to have this extension
> activated in order to add some data to my XML when calling the service.
> 
> Any clue?

If you just take the generated JAXB beans, create a context and marshaller, 
and then call marshal with an XMLStreamReader (also try just an outputstream), 
does the problem also manifest itself?   If so, it would definitely be a JAXB 
issue and a bug would need to be logged there.

Dan


> 
> 
> -----Message d'origine-----
> De : MARTELLI Julien [mailto:jmartelli@softwaymedical.fr]
> Envoyé : lundi 7 février 2011 11:18
> À : users@cxf.apache.org
> Objet : IllegalStateException - start tag has already been written
> 
> Hi everyone,
> 
> To develop a Web Service client I generate the classes from the WSDL file
> using the cxf-codegen-plugin. This generation works fine, to customize it
> I use a xjc binding file :
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> extensionBindingPrefixes="xjc"> <globalBindings
> generateMixedExtensions="true">
>                                <serializable />
>                 </globalBindings>
> </bindings>
> 
> 
> But when I build the PortType in my client code I get the following
> exception :
> 
> IllegalStateException  start tag has already been written
> 
> 
> I found this post
> (http://osdir.com/ml/users-servicemix.apache.org/2010-08/msg00077.html)
> that looks like the same issue but there is no solution...
> 
> I use cxf 2.2.10.
> 
> Do you guys have any clue ?
> 
> Thanks,
> j.

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

RE: IllegalStateException - start tag has already been written

Posted by MARTELLI Julien <jm...@softwaymedical.fr>.
I just tried something, and there is something new.

I changed my binding file, I deleted the generateMixedExtensions option.
This involves having my classes generated without any XmlMixed annotation.
It works, my client is correctly deployed.

But this not solve my problem because I need to have this extension activated in order to add some data to my XML when calling the service.

Any clue?


-----Message d'origine-----
De : MARTELLI Julien [mailto:jmartelli@softwaymedical.fr] 
Envoyé : lundi 7 février 2011 11:18
À : users@cxf.apache.org
Objet : IllegalStateException - start tag has already been written

Hi everyone,

To develop a Web Service client I generate the classes from the WSDL file using the cxf-codegen-plugin.
This generation works fine, to customize it I use a xjc binding file :

<?xml version="1.0" encoding="UTF-8"?>
<bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" extensionBindingPrefixes="xjc">
                <globalBindings generateMixedExtensions="true">
                               <serializable />
                </globalBindings>
</bindings>


But when I build the PortType in my client code I get the following exception :

IllegalStateException  start tag has already been written


I found this post (http://osdir.com/ml/users-servicemix.apache.org/2010-08/msg00077.html) that looks like the same issue but there is no solution...

I use cxf 2.2.10.

Do you guys have any clue ?

Thanks,
j.