You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Valeri Gavrilovets <va...@mail.ru> on 2004/11/11 19:37:01 UTC

[betwixt] ClassCastException

Hi everyone,
i have some problem by parsing of such xml:
--------------------
<?xml version="1.0" encoding="UTF-8"?>
<Order xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
  xsi:noNamespaceSchemaLocation='tibco_order.xsd'>
  <Request>
    <ISIN>DE0005140008</ISIN>
    <ProductType>2</ProductType>
    <Amount>200</Amount>
    <OrderId>1234</OrderId>
    <OrderType>BUY</OrderType>
    <ChannelId>1</ChannelId>
    <SalesId>0123456789</SalesId>
  </Request>
</Order>
----------------------

The class Order:
----------------------
public class Order {
   private Request  request;
   private Price    price;
   private Response response;
   private String   errorCode;
   private String   errorText;
...
}
------------------
public class Request {
   private String     ISIN;
   private Integer    productType;
   private BigDecimal amount;
   private String     orderId;
   private String     orderType;
   private Integer    channelId;
   private String     salesId;
...
}
----------------------
configuration:
-------------------
         IntrospectionConfiguration config = _beanReader.getXMLIntrospector().getConfiguration();
         config.setElementNameMapper(new CapitalizeNameMapper());

         // register bean classes
         _beanReader.registerBeanClass(Order.class);
         _beanReader.registerBeanClass(Request.class);
         _beanReader.registerBeanClass(Price.class);
         _beanReader.registerBeanClass(Response.class);
------------------

I get this exception and i have no clue what it tells about =(

[DEBUG] Digester - -  Fire end() for org.apache.commons.betwixt.io.BeanRuleSet$ActionMappingRule@16546ef
[ERROR] Digester - -End event threw exception <java.lang.ClassCastException>java.lang.ClassCastException
        at org.apache.commons.betwixt.io.read.ReadContext.getCurrentElement(ReadContext.java:224)
        at org.apache.commons.betwixt.io.read.BeanBindAction.update(BeanBindAction.java:164)
        at org.apache.commons.betwixt.io.read.BeanBindAction.end(BeanBindAction.java:154)
        at org.apache.commons.betwixt.io.BeanRuleSet$ActionMappingRule.end(BeanRuleSet.java:316)
        at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
        at weblogic.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:585)
        at weblogic.apache.xerces.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:710)
        at weblogic.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java:898)
        at weblogic.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:644)
        at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1008)
        at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
        at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
        at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
        at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
        at weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
        at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
        at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:152)
        at org.apache.commons.digester.Digester.parse(Digester.java:1586)
        at com.dart.simulator.tibco.TibcoBeanReader.parse(TibcoBeanReader.java:101)





---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [betwixt] ClassCastException

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
i think that this is a know bug with the latest release. please update  
to CVS HEAD (or a recent nightly) and retry.

- robert

On 11 Nov 2004, at 18:37, Valeri Gavrilovets wrote:

> Hi everyone,
> i have some problem by parsing of such xml:
> --------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <Order xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
>   xsi:noNamespaceSchemaLocation='tibco_order.xsd'>
>   <Request>
>     <ISIN>DE0005140008</ISIN>
>     <ProductType>2</ProductType>
>     <Amount>200</Amount>
>     <OrderId>1234</OrderId>
>     <OrderType>BUY</OrderType>
>     <ChannelId>1</ChannelId>
>     <SalesId>0123456789</SalesId>
>   </Request>
> </Order>
> ----------------------
>
> The class Order:
> ----------------------
> public class Order {
>    private Request  request;
>    private Price    price;
>    private Response response;
>    private String   errorCode;
>    private String   errorText;
> ...
> }
> ------------------
> public class Request {
>    private String     ISIN;
>    private Integer    productType;
>    private BigDecimal amount;
>    private String     orderId;
>    private String     orderType;
>    private Integer    channelId;
>    private String     salesId;
> ...
> }
> ----------------------
> configuration:
> -------------------
>          IntrospectionConfiguration config =  
> _beanReader.getXMLIntrospector().getConfiguration();
>          config.setElementNameMapper(new CapitalizeNameMapper());
>
>          // register bean classes
>          _beanReader.registerBeanClass(Order.class);
>          _beanReader.registerBeanClass(Request.class);
>          _beanReader.registerBeanClass(Price.class);
>          _beanReader.registerBeanClass(Response.class);
> ------------------
>
> I get this exception and i have no clue what it tells about =(
>
> [DEBUG] Digester - -  Fire end() for  
> org.apache.commons.betwixt.io.BeanRuleSet$ActionMappingRule@16546ef
> [ERROR] Digester - -End event threw exception  
> <java.lang.ClassCastException>java.lang.ClassCastException
>         at  
> org.apache.commons.betwixt.io.read.ReadContext.getCurrentElement(ReadCo 
> ntext.java:224)
>         at  
> org.apache.commons.betwixt.io.read.BeanBindAction.update(BeanBindAction 
> .java:164)
>         at  
> org.apache.commons.betwixt.io.read.BeanBindAction.end(BeanBindAction.ja 
> va:154)
>         at  
> org.apache.commons.betwixt.io.BeanRuleSet$ActionMappingRule.end(BeanRul 
> eSet.java:316)
>         at  
> org.apache.commons.digester.Digester.endElement(Digester.java:1058)
>         at  
> weblogic.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAX 
> Parser.java:585)
>         at  
> weblogic.apache.xerces.impl.xs.XMLSchemaValidator.endElement(XMLSchemaV 
> alidator.java:710)
>         at  
> weblogic.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLName 
> spaceBinder.java:898)
>         at  
> weblogic.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceB 
> inder.java:644)
>         at  
> weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndEleme 
> nt(XMLDocumentFragmentScannerImpl.java:1008)
>         at  
> weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentCont 
> entDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
>         at  
> weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument 
> (XMLDocumentFragmentScannerImpl.java:329)
>         at  
> weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration. 
> java:525)
>         at  
> weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration. 
> java:581)
>         at  
> weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
>         at  
> weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParse 
> r.java:1175)
>         at  
> weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
>         at  
> weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:152)
>         at  
> org.apache.commons.digester.Digester.parse(Digester.java:1586)
>         at  
> com.dart.simulator.tibco.TibcoBeanReader.parse(TibcoBeanReader.java: 
> 101)
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [betwixt] ClassCastException

Posted by Valeri Gavrilovets <va...@mail.ru>.
this code 
---------------------- 
      BeanReader beanReader = new BeanReader();
      
      try {
         Object obj = beanReader.parse(file://path-to-xml);

         System.out.println("Object: " + obj);
      } catch (Exception exp) {
         System.out.println("Ignored: " + exp);
        // Here ClassException is catched
      }

      Object obj = beanReader.parse(file://path-to-xml);

      System.out.println("Object: " + obj);
-----------------------
produces by me following output

Ignored: java.lang.ClassCastException
Object: [Request: [ISIN: DE0005140008, ProductType: 2, Amount: 200, OrderId: 1234, OrderType: BUY, ChannelId: 1, SalesId: 0123456789], Price: null, Response: null, ErrorCode: null, ErrorText: null]

funny 8-/ 




-----Original Message-----
From: Valeri  Gavrilovets <va...@mail.ru>
To: commons-user@jakarta.apache.org
Date: Thu, 11 Nov 2004 21:37:01 +0300
Subject: [betwixt] ClassCastException

> 
> Hi everyone,
> i have some problem by parsing of such xml:
> --------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <Order xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
>   xsi:noNamespaceSchemaLocation='tibco_order.xsd'>
>   <Request>
>     <ISIN>DE0005140008</ISIN>
>     <ProductType>2</ProductType>
>     <Amount>200</Amount>
>     <OrderId>1234</OrderId>
>     <OrderType>BUY</OrderType>
>     <ChannelId>1</ChannelId>
>     <SalesId>0123456789</SalesId>
>   </Request>
> </Order>
> ----------------------
> 
> The class Order:
> ----------------------
> public class Order {
>    private Request  request;
>    private Price    price;
>    private Response response;
>    private String   errorCode;
>    private String   errorText;
> ...
> }
> ------------------
> public class Request {
>    private String     ISIN;
>    private Integer    productType;
>    private BigDecimal amount;
>    private String     orderId;
>    private String     orderType;
>    private Integer    channelId;
>    private String     salesId;
> ...
> }
> ----------------------
> configuration:
> -------------------
>          IntrospectionConfiguration config = _beanReader.getXMLIntrospector().getConfiguration();
>          config.setElementNameMapper(new CapitalizeNameMapper());
> 
>          // register bean classes
>          _beanReader.registerBeanClass(Order.class);
>          _beanReader.registerBeanClass(Request.class);
>          _beanReader.registerBeanClass(Price.class);
>          _beanReader.registerBeanClass(Response.class);
> ------------------
> 
> I get this exception and i have no clue what it tells about =(
> 
> [DEBUG] Digester - -  Fire end() for org.apache.commons.betwixt.io.BeanRuleSet$ActionMappingRule@16546ef
> [ERROR] Digester - -End event threw exception <java.lang.ClassCastException>java.lang.ClassCastException
>         at org.apache.commons.betwixt.io.read.ReadContext.getCurrentElement(ReadContext.java:224)
>         at org.apache.commons.betwixt.io.read.BeanBindAction.update(BeanBindAction.java:164)
>         at org.apache.commons.betwixt.io.read.BeanBindAction.end(BeanBindAction.java:154)
>         at org.apache.commons.betwixt.io.BeanRuleSet$ActionMappingRule.end(BeanRuleSet.java:316)
>         at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
>         at weblogic.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:585)
>         at weblogic.apache.xerces.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:710)
>         at weblogic.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java:898)
>         at weblogic.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:644)
>         at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1008)
>         at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
>         at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
>         at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
>         at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
>         at weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
>         at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
>         at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
>         at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:152)
>         at org.apache.commons.digester.Digester.parse(Digester.java:1586)
>         at com.dart.simulator.tibco.TibcoBeanReader.parse(TibcoBeanReader.java:101)
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


http://Mail.Ru - лучшая почта с неограниченным объемом почтового ящика!

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org