You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Karl Heinz <bj...@gmx.de> on 2007/05/29 16:31:55 UTC

problems with jaxme and axis2

Hi there,

I am trying to use jaxme as databinding with axis2. When I call the tool wsdl2java I get the following exception:

Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.IllegalStateException: The class com.example.somwhere.xsd.Message has already been created.
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:256)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: The class com.example.somwhere.xsd.Message has already been created.
        at org.apache.axis2.wsdl.codegen.extension.JaxMeExtension.engage(JaxMeExtension.java:158)
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:209)
        ... 2 more
Caused by: java.lang.IllegalStateException: The class com.example.somwhere.xsd.Message has already been created.
        at org.apache.ws.jaxme.js.JavaSourceFactory.newJavaSource(JavaSourceFactory.java:129)
        at org.apache.ws.jaxme.generator.sg.impl.JAXBObjectSG.getXMLInterface(JAXBObjectSG.java:197)
        at org.apache.ws.jaxme.generator.sg.impl.ObjectSGImpl.getXMLInterface(ObjectSGImpl.java:40)
        at org.apache.ws.jaxme.generator.sg.impl.JAXBObjectSG.generate(JAXBObjectSG.java:278)
        at org.apache.ws.jaxme.generator.sg.impl.ObjectSGImpl.generate(ObjectSGImpl.java:56)
        at org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaSG.generate(JAXBSchemaSG.java:228)
        at org.apache.ws.jaxme.generator.sg.impl.SchemaSGImpl.generate(SchemaSGImpl.java:67)
        at org.apache.ws.jaxme.generator.impl.GeneratorImpl.generate(GeneratorImpl.java:148)
        at org.apache.axis2.wsdl.codegen.extension.JaxMeExtension.engage(JaxMeExtension.java:126)

I found out, that a similar bug has been detected about a year ago. 

see http://issues.apache.org/jira/browse/AXIS2-534

My wsdl file looks as follows:

<wsdl:definitions
	xmlns:axis2="http://example.com/somwhere"
	xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
	xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
	xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
	xmlns:ns="http://example.com/somwhere/xsd"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	targetNamespace="http://example.com/somwhere">
	<wsdl:types>
		<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
			attributeFormDefault="qualified" elementFormDefault="qualified"
			targetNamespace="http://example.com/somwhere/xsd">
			<xs:element name="store">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="param0" nillable="true"
							type="ns:Message" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="Message" type="ns:Message" />
			<xs:complexType name="Message">
				<xs:sequence>
					<xs:element maxOccurs="unbounded" name="l1List"
						nillable="true" type="ns:Param1" />
					<xs:element maxOccurs="unbounded" name="l3List"
						nillable="true" type="ns:Param2" />
				</xs:sequence>
			</xs:complexType>
			<xs:element name="Param1" type="ns:Param1" />
			<xs:complexType name="Param1">
				<xs:sequence>
					<xs:element name="Element1" nillable="true"
						type="xs:long" />
				</xs:sequence>
			</xs:complexType>

			<xs:element name="Param2" type="ns:Param2" />
			<xs:complexType name="Param2">
				<xs:sequence>
					<xs:element name="Element2" nillable="true"
						type="xs:string" />
				</xs:sequence>
			</xs:complexType>
			<xs:element name="storeResponse">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="return" nillable="true"
							type="xs:boolean" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="validate">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="param0" nillable="true"
							type="ns:Message" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="validateResponse">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="return" nillable="true"
							type="xs:boolean" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="getVersionResponse">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="return" nillable="true"
							type="xs:string" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:schema>
	</wsdl:types>
	<wsdl:message name="storeMessage">
		<wsdl:part name="part1" element="ns:store" />
	</wsdl:message>
	<wsdl:message name="storeResponseMessage">
		<wsdl:part name="part1" element="ns:storeResponse" />
	</wsdl:message>
	<wsdl:message name="validateMessage">
		<wsdl:part name="part1" element="ns:validate" />
	</wsdl:message>
	<wsdl:message name="validateResponseMessage">
		<wsdl:part name="part1" element="ns:validateResponse" />
	</wsdl:message>
	<wsdl:message name="getVersionMessage" />
	<wsdl:message name="getVersionResponseMessage">
		<wsdl:part name="part1" element="ns:getVersionResponse" />
	</wsdl:message>
	<wsdl:portType name="efm_1_0PortType">
		<wsdl:operation name="store">
			<wsdl:input
				xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
				wsaw:Action="urn:store" message="axis2:storeMessage" />
			<wsdl:output
				xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
				message="axis2:storeResponseMessage" wsaw:Action="urn:store" />
		</wsdl:operation>
		<wsdl:operation name="validate">
			<wsdl:input
				xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
				wsaw:Action="urn:validate" message="axis2:validateMessage" />
			<wsdl:output
				xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
				message="axis2:validateResponseMessage" wsaw:Action="urn:validate" />
		</wsdl:operation>
		<wsdl:operation name="getVersion">
			<wsdl:input
				xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
				wsaw:Action="urn:getVersion" message="axis2:getVersionMessage" />
			<wsdl:output
				xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
				message="axis2:getVersionResponseMessage"
				wsaw:Action="urn:getVersion" />
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="efm_1_0SOAP11Binding"
		type="axis2:efm_1_0PortType">
		<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
			style="document" />
		<wsdl:operation name="store">
			<soap:operation soapAction="urn:store" style="document" />
			<wsdl:input>
				<soap:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
		<wsdl:operation name="validate">
			<soap:operation soapAction="urn:validate" style="document" />
			<wsdl:input>
				<soap:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
		<wsdl:operation name="getVersion">
			<soap:operation soapAction="urn:getVersion"
				style="document" />
			<wsdl:input>
				<soap:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:binding name="efm_1_0SOAP12Binding"
		type="axis2:efm_1_0PortType">
		<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
			style="document" />
		<wsdl:operation name="store">
			<soap12:operation soapAction="urn:store" style="document" />
			<wsdl:input>
				<soap12:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap12:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
		<wsdl:operation name="validate">
			<soap12:operation soapAction="urn:validate"
				style="document" />
			<wsdl:input>
				<soap12:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap12:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
		<wsdl:operation name="getVersion">
			<soap12:operation soapAction="urn:getVersion"
				style="document" />
			<wsdl:input>
				<soap12:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap12:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="efm_1_0">
		<wsdl:port name="efm_1_0SOAP11port"
			binding="axis2:efm_1_0SOAP11Binding">
			<soap:address
				location="http://localhost:8080/axis2/services/efm_1_0" />
		</wsdl:port>
		<wsdl:port name="efm_1_0SOAP12port"
			binding="axis2:efm_1_0SOAP12Binding">
			<soap12:address
				location="http://localhost:8080/axis2/services/efm_1_0" />
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>

Could someone help me with that issue?

Thanks..

Bjoern
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: problems with jaxme and axis2

Posted by Jochen Wiedmann <jo...@gmail.com>.
Hi, Karl-Heinz,

first of all, please be so kind to subscribe to the jaxme-dev mailing
list, before posting. Otherwise, I have to approve any mail from you
manually, which takes time. Apart from that, you risk that I decide
wrong, because your mail is just one within a bunch of spam mails,
which I reject.

On 5/29/07, Karl Heinz <bj...@gmx.de> wrote:

> I found out, that a similar bug has been detected about a year ago.
>
> see http://issues.apache.org/jira/browse/AXIS2-534

Right, the problem is just like described there:

>                         <xs:element name="Message" type="ns:Message" />
>                         <xs:complexType name="Message">

You have an element and a complexType, which are both named "Message".
In other words, the generator would like to create two different
classes, both named "Message", which he rejects.

Either rename the element or the type (don't use the name
"MessageType", btw, which is a similar gotcha), or use a custom
binding element like jxb:class to rename either of the generated
classes. See

    http://java.sun.com/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html#wp148576

for renaming classes.


Jochen


-- 
Women have the ability to wind you round their little finger.
Daughters can use all of the fingers together.

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org