You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Alejandro (JIRA)" <ji...@apache.org> on 2008/09/08 19:37:44 UTC

[jira] Created: (CXF-1788) Problem with Calendar

Problem with Calendar
---------------------

                 Key: CXF-1788
                 URL: https://issues.apache.org/jira/browse/CXF-1788
             Project: CXF
          Issue Type: Bug
          Components: Aegis Databinding
    Affects Versions: 2.1.2
         Environment: JDK 5, JDK 6, WIndows Vista.
            Reporter: Alejandro 


Hi, I'm migrating a XFIRE ws application to CXF. Because I need to
keep alive the compatibility with XFIRE I use Aegis as DataBinding.
I've solve a problems but now I cna't solve the problem with the
Calendar datatype, some of my classes uses java.util.Date or
java.util.Calendar. When the binding tried to make the bindings I've
get this error:

javax.xml.ws.WebServiceException: java.lang.ClassCastException:
org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
org.apache.cxf.aegis.type.basic.BeanType
       at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:267)
.......
Caused by: java.lang.ClassCastException:
org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
org.apache.cxf.aegis.type.basic.BeanType
       at org.apache.cxf.aegis.type.basic.BeanType.getSuperType(BeanType.java:670)
       at org.apache.cxf.aegis.type.basic.BeanType.writeSchema(BeanType.java:417)
       at org.apache.cxf.aegis.databinding.AegisDatabinding.createSchemas(AegisDatabinding.java:478)
       at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:323)


In XFire I've create a CustomMapping to solve this problem, but in CXF
I don't find any example about that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1788) Problem with Calendar

Posted by "Alejandro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alejandro  updated CXF-1788:
----------------------------

    Attachment: XFireCustomMapping.java

Hi, I think that I found the problem. 

I've created a method with this signuture: "GregorianCalendar prueba(String mensaje)", when I'm trying to deploy the ws with this method I get the error but if I use "Calendar prueba(String mensaje)" works fine.

In Xfire I find that the WSDL define this:
<xsd:element minOccurs="0" name="fechaVigenciaDesde" nillable="true" type="ns10:GregorianCalendar" /> 

And then I have the class:
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://util.java">
- <xsd:complexType name="GregorianCalendar">
- <xsd:sequence>
  <xsd:element minOccurs="0" name="firstDayOfWeek" type="xsd:int" /> 
  <xsd:element minOccurs="0" name="gregorianChange" type="xsd:dateTime" /> 
  <xsd:element minOccurs="0" name="lenient" type="xsd:boolean" /> 
  <xsd:element minOccurs="0" name="minimalDaysInFirstWeek" type="xsd:int" /> 
  <xsd:element minOccurs="0" name="time" type="xsd:dateTime" /> 
  <xsd:element minOccurs="0" name="timeInMillis" type="xsd:long" /> 
  <xsd:element minOccurs="0" name="timeZone" nillable="true" type="ns10:TimeZone" /> 
  </xsd:sequence>
  </xsd:complexType>
- <xsd:complexType abstract="true" name="TimeZone">
- <xsd:sequence>
  <xsd:element minOccurs="0" name="DSTSavings" type="xsd:int" /> 
  <xsd:element minOccurs="0" name="ID" nillable="true" type="xsd:string" /> 
  <xsd:element minOccurs="0" name="displayName" nillable="true" type="xsd:string" /> 
  <xsd:element minOccurs="0" name="rawOffset" type="xsd:int" /> 
  </xsd:sequence>
  </xsd:complexType>
  </xsd:schema>

I need to do the same in CXF, I attach the class that I use in XFire

Regards
Alejandro

> Problem with Calendar
> ---------------------
>
>                 Key: CXF-1788
>                 URL: https://issues.apache.org/jira/browse/CXF-1788
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.1.2
>         Environment: JDK 5, JDK 6, WIndows Vista.
>            Reporter: Alejandro 
>         Attachments: XFireCustomMapping.java
>
>
> Hi, I'm migrating a XFIRE ws application to CXF. Because I need to
> keep alive the compatibility with XFIRE I use Aegis as DataBinding.
> I've solve a problems but now I cna't solve the problem with the
> Calendar datatype, some of my classes uses java.util.Date or
> java.util.Calendar. When the binding tried to make the bindings I've
> get this error:
> javax.xml.ws.WebServiceException: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:267)
> .......
> Caused by: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.aegis.type.basic.BeanType.getSuperType(BeanType.java:670)
>        at org.apache.cxf.aegis.type.basic.BeanType.writeSchema(BeanType.java:417)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.createSchemas(AegisDatabinding.java:478)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:323)
> In XFire I've create a CustomMapping to solve this problem, but in CXF
> I don't find any example about that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1788) Problem with Calendar

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp updated CXF-1788:
-----------------------------

    Fix Version/s:     (was: 2.2)
                   2.1.3

> Problem with Calendar
> ---------------------
>
>                 Key: CXF-1788
>                 URL: https://issues.apache.org/jira/browse/CXF-1788
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.1.2
>         Environment: JDK 5, JDK 6, WIndows Vista.
>            Reporter: Alejandro 
>             Fix For: 2.1.3
>
>         Attachments: XFireCustomMapping.java
>
>
> Hi, I'm migrating a XFIRE ws application to CXF. Because I need to
> keep alive the compatibility with XFIRE I use Aegis as DataBinding.
> I've solve a problems but now I cna't solve the problem with the
> Calendar datatype, some of my classes uses java.util.Date or
> java.util.Calendar. When the binding tried to make the bindings I've
> get this error:
> javax.xml.ws.WebServiceException: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:267)
> .......
> Caused by: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.aegis.type.basic.BeanType.getSuperType(BeanType.java:670)
>        at org.apache.cxf.aegis.type.basic.BeanType.writeSchema(BeanType.java:417)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.createSchemas(AegisDatabinding.java:478)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:323)
> In XFire I've create a CustomMapping to solve this problem, but in CXF
> I don't find any example about that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1788) Problem with Calendar

Posted by "Alejandro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633233#action_12633233 ] 

Alejandro  commented on CXF-1788:
---------------------------------

That's great I prefer use a DefaultMapping instead of a CustomMapping.

> Problem with Calendar
> ---------------------
>
>                 Key: CXF-1788
>                 URL: https://issues.apache.org/jira/browse/CXF-1788
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.1.2
>         Environment: JDK 5, JDK 6, WIndows Vista.
>            Reporter: Alejandro 
>             Fix For: 2.1.3
>
>         Attachments: XFireCustomMapping.java
>
>
> Hi, I'm migrating a XFIRE ws application to CXF. Because I need to
> keep alive the compatibility with XFIRE I use Aegis as DataBinding.
> I've solve a problems but now I cna't solve the problem with the
> Calendar datatype, some of my classes uses java.util.Date or
> java.util.Calendar. When the binding tried to make the bindings I've
> get this error:
> javax.xml.ws.WebServiceException: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:267)
> .......
> Caused by: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.aegis.type.basic.BeanType.getSuperType(BeanType.java:670)
>        at org.apache.cxf.aegis.type.basic.BeanType.writeSchema(BeanType.java:417)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.createSchemas(AegisDatabinding.java:478)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:323)
> In XFire I've create a CustomMapping to solve this problem, but in CXF
> I don't find any example about that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (CXF-1788) Problem with Calendar

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang closed CXF-1788.
-----------------------------


> Problem with Calendar
> ---------------------
>
>                 Key: CXF-1788
>                 URL: https://issues.apache.org/jira/browse/CXF-1788
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.1.2
>         Environment: JDK 5, JDK 6, WIndows Vista.
>            Reporter: Alejandro 
>             Fix For: 2.1.3
>
>         Attachments: XFireCustomMapping.java
>
>
> Hi, I'm migrating a XFIRE ws application to CXF. Because I need to
> keep alive the compatibility with XFIRE I use Aegis as DataBinding.
> I've solve a problems but now I cna't solve the problem with the
> Calendar datatype, some of my classes uses java.util.Date or
> java.util.Calendar. When the binding tried to make the bindings I've
> get this error:
> javax.xml.ws.WebServiceException: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:267)
> .......
> Caused by: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.aegis.type.basic.BeanType.getSuperType(BeanType.java:670)
>        at org.apache.cxf.aegis.type.basic.BeanType.writeSchema(BeanType.java:417)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.createSchemas(AegisDatabinding.java:478)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:323)
> In XFire I've create a CustomMapping to solve this problem, but in CXF
> I don't find any example about that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1788) Problem with Calendar

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630828#action_12630828 ] 

Benson Margulies commented on CXF-1788:
---------------------------------------

Here's a question to start with. The default type mapping environment for Aegis includes mappings for all of the stock XML schema calendar types to a local implementation of the XMLGregorianCalendar type. I don't suppose you could use this?

 registerIfAvailable(tm, defaultNillable, "javax.xml.datatype.Duration", XMLSchemaQNames.XSD_DURATION,
                            "org.apache.cxf.aegis.type.java5.DurationType");
        registerIfAvailable(tm, defaultNillable, "javax.xml.datatype.XMLGregorianCalendar",
                            XMLSchemaQNames.XSD_DATE,
                            "org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType");
        registerIfAvailable(tm, defaultNillable, "javax.xml.datatype.XMLGregorianCalendar",
                            XMLSchemaQNames.XSD_TIME,
                            "org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType");
        registerIfAvailable(tm, defaultNillable, "javax.xml.datatype.XMLGregorianCalendar",
                            XMLSchemaQNames.XSD_G_DAY,
                            "org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType");
        registerIfAvailable(tm, defaultNillable, "javax.xml.datatype.XMLGregorianCalendar",
                            XMLSchemaQNames.XSD_G_MONTH,
                            "org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType");
        registerIfAvailable(tm, defaultNillable, "javax.xml.datatype.XMLGregorianCalendar",
                            XMLSchemaQNames.XSD_G_MONTH_DAY,
                            "org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType");
        registerIfAvailable(tm, defaultNillable, "javax.xml.datatype.XMLGregorianCalendar",
                            XMLSchemaQNames.XSD_G_YEAR,
                            "org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType");
        registerIfAvailable(tm, defaultNillable, "javax.xml.datatype.XMLGregorianCalendar",
                            XMLSchemaQNames.XSD_G_YEAR_MONTH,
                            "org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType");
        registerIfAvailable(tm, defaultNillable, "javax.xml.datatype.XMLGregorianCalendar",
                            XMLSchemaQNames.XSD_DATETIME,
                            "org.apache.cxf.aegis.type.java5.XMLGregorianCalendarType");

> Problem with Calendar
> ---------------------
>
>                 Key: CXF-1788
>                 URL: https://issues.apache.org/jira/browse/CXF-1788
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.1.2
>         Environment: JDK 5, JDK 6, WIndows Vista.
>            Reporter: Alejandro 
>         Attachments: XFireCustomMapping.java
>
>
> Hi, I'm migrating a XFIRE ws application to CXF. Because I need to
> keep alive the compatibility with XFIRE I use Aegis as DataBinding.
> I've solve a problems but now I cna't solve the problem with the
> Calendar datatype, some of my classes uses java.util.Date or
> java.util.Calendar. When the binding tried to make the bindings I've
> get this error:
> javax.xml.ws.WebServiceException: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:267)
> .......
> Caused by: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.aegis.type.basic.BeanType.getSuperType(BeanType.java:670)
>        at org.apache.cxf.aegis.type.basic.BeanType.writeSchema(BeanType.java:417)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.createSchemas(AegisDatabinding.java:478)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:323)
> In XFire I've create a CustomMapping to solve this problem, but in CXF
> I don't find any example about that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1788) Problem with Calendar

Posted by "Benson Margulies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1788?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benson Margulies resolved CXF-1788.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2

I've committed a repair.

Here's what you hit.

CXF already provides mappings for both Calendar and GregorianCalendar. When you replaced the mapping for GregorianCalendar, you hit a bug: a BeanType mapping of a class that inherits from a non-BeanType class ran into trouble.

Similiar pickles would result from mapping a class that inherited from, say, Integer.

See rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/custom/CustomMappingTest.java for the code that I set up to test this in a CXF context.

I continue to suspect that you'd be happiest just using the default mapping instead of forcing CXF to treat Calendar as a bean.


> Problem with Calendar
> ---------------------
>
>                 Key: CXF-1788
>                 URL: https://issues.apache.org/jira/browse/CXF-1788
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.1.2
>         Environment: JDK 5, JDK 6, WIndows Vista.
>            Reporter: Alejandro 
>             Fix For: 2.2
>
>         Attachments: XFireCustomMapping.java
>
>
> Hi, I'm migrating a XFIRE ws application to CXF. Because I need to
> keep alive the compatibility with XFIRE I use Aegis as DataBinding.
> I've solve a problems but now I cna't solve the problem with the
> Calendar datatype, some of my classes uses java.util.Date or
> java.util.Calendar. When the binding tried to make the bindings I've
> get this error:
> javax.xml.ws.WebServiceException: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:267)
> .......
> Caused by: java.lang.ClassCastException:
> org.apache.cxf.aegis.type.basic.CalendarType cannot be cast to
> org.apache.cxf.aegis.type.basic.BeanType
>        at org.apache.cxf.aegis.type.basic.BeanType.getSuperType(BeanType.java:670)
>        at org.apache.cxf.aegis.type.basic.BeanType.writeSchema(BeanType.java:417)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.createSchemas(AegisDatabinding.java:478)
>        at org.apache.cxf.aegis.databinding.AegisDatabinding.initialize(AegisDatabinding.java:323)
> In XFire I've create a CustomMapping to solve this problem, but in CXF
> I don't find any example about that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.