FYI, in my case making public access modifier to private was not a
appropriate solution since the field has been access directly in several
other places within the same package which would lead to lot of code changes
which we want to avoid.

On Thu, Feb 19, 2009 at 6:57 PM, Lakshman Mukkamalla
<[email protected]>wrote:

> Hi ,
>      I have tried making this field protected/default and either way it
> seems to work. Also have tried adding the @XmlTransient annotation and that
> also worked.
>      The JAXB spec that you have mentioned recommends @XmlTransient
> annotation as the solution but do you see any issues making the field
> protected/default access in cases where one were not able to add the
> annotation for some reason.
>
> Thanks,
> Lakshman.
>
>
> On Thu, Feb 12, 2009 at 4:10 PM, Raymond Feng <[email protected]> wrote:
>
>>  Hi,
>>
>> Tuscany treats POJOs as JAXB objects following the default Java/XML
>> mapping rules defined by JAXB. Your case is described in JAXB 2.1
>> spec (8.2.8 Property/Field Name Collision).
>>
>> A simple change can fix your problem.
>>
>> public class Employee {
>>     private String name = "keetarp"; // Make it private to avoid JAXB
>> complaint about duplicate property
>>
>>     public String getName() {
>>         return name;
>>     }
>>
>>     public void setName(String name) {
>>
>> this.name = name;
>>     }
>> }
>>
>> Or you can use @XmlTransient to resolve the name collision by preventing
>> the mapping of either the public field or the property
>>
>> Thanks,
>> Raymond
>>
>>  *From:* Prateek Temkar <[email protected]>
>> *Sent:* Thursday, February 12, 2009 3:16 PM
>> *To:* [email protected]
>> *Subject:* Exception while generating WSDL
>>
>> Hi All,
>>
>>       I've been working on exposing some POJO as a SOAP service and have
>> been getting the following exception:
>>
>> SEVERE: Exception thrown was: org.osoa.sca.ServiceRuntimeException:
>> com.sun.xml.
>> bind.v2.runtime.IllegalAnnotationsException: 1 counts of
>> IllegalAnnotationExcept
>> ions.
>>
>> This does not happen with plain Axis2 but Tuscany 1.3.2+ does not use
>> Axis2 for java2wsdl if I'm not wrong. I don't see the exception in Tuscany
>> 1.2.
>>
>> Let me explain with a simple example. It is a slight modification to the
>> calculator-ws-webapp example
>>
>> --------------------------------------------------------------------------------------------------------------------------------------------------
>> @Service(AddService.class)
>> public class AddServiceImpl implements AddService {
>>
>>     String name;
>>
>>     public double add(double n1, double n2) {
>>         System.err.println("Adding " + n1 + " to " + n2);
>>         return n1 + n2;
>>     }
>>
>>     public String getName(Employee employee) {
>>         return this.name;
>>     }
>>
>>     public void setName(Employee employee) {
>>         this.name = employee.getName();
>>     }
>>
>> }
>>
>>
>> public class Employee {
>>     public String name = "keetarp";
>>
>>     public String getName() {
>>         return name;
>>     }
>>
>>     public void setName(String name) {
>>         this.name = name;
>>     }
>>
>>
>> }
>>
>>
>> ------------------------------------------------------------------------------------------------------------------------------
>> the problem here is that the field 'name' Employee class is public and so
>> are its getters/setters. I know its not a good coding practice but I cannot
>> change that code to make 'name' private
>>
>> here are the container logs for tuscany 1.4
>>
>>
>> WARNING: Exception while generating WSDL for
>> AddServiceComponent/AddService
>> Feb 12, 2009 12:03:47 PM
>> org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGe
>> nerator
>> SEVERE: Exception thrown was: org.osoa.sca.ServiceRuntimeException:
>> com.sun.xml.
>> bind.v2.runtime.IllegalAnnotationsException: 1 counts of
>> IllegalAnnotationExcept
>> ions
>> Class has two properties of the same name "name"
>>         this problem is related to the following location:
>>                 at public java.lang.String calculator.Employee.getName()
>>                 at calculator.Employee
>>         this problem is related to the following location:
>>                 at public java.lang.String calculator.Employee.name
>>                 at calculator.Employee
>>
>> Feb 12, 2009 12:03:47 PM
>> org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGe
>> nerator
>> WARNING: Exception while generating WSDL for
>> CalculatorServiceComponent/addServi
>> ce
>> Feb 12, 2009 12:03:47 PM
>> org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGe
>> nerator
>> SEVERE: Exception thrown was: org.osoa.sca.ServiceRuntimeException:
>> com.sun.xml.
>> bind.v2.runtime.IllegalAnnotationsException: 1 counts of
>> IllegalAnnotationExcept
>> ions
>> Class has two properties of the same name "name"
>>         this problem is related to the following location:
>>                 at public java.lang.String calculator.Employee.getName()
>>                 at calculator.Employee
>>         this problem is related to the following location:
>>                 at public java.lang.String calculator.Employee.name
>>                 at calculator.Employee
>>
>>
>>
>>
>> Does Tuscany's java2wsdl processing perform this check?
>>
>> thnx,
>> Prateek Temkar
>>
>
>

Reply via email to