Note that there are some explanatory texts on larger screens.

plurals
  1. POClassCastException when casting JAXBElement to DynamicEntity
    primarykey
    data
    text
    <p>I followed <a href="http://wiki.eclipse.org/EclipseLink/Examples/MOXy/Dynamic/JAXBContextFromXMLSchema" rel="nofollow">this</a> and <a href="http://wiki.eclipse.org/EclipseLink/Examples/MOXy/Dynamic/XmlToDynamicEntity" rel="nofollow">this</a> examples, and it worked fine. Then I changed the xml and xsd file for another that imports 3 other xsd and I keep getting this:</p> <pre><code> java.lang.ClassCastException: javax.xml.bind.JAXBElement cannot be cast to org.eclipse.persistence.dynamic.DynamicEntity </code></pre> <p>I implemented the EntityResolver and checked the locations of all xml files, set the noCorrectnessCheck property to true, but can't make this work.</p> <p>Here is the first XSD:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;schema targetNamespace="http://mycompany.com/pmac/servico-saldo-req" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:pmac-saldo="http://mycompany.com/pmac/servico-saldo-req" xmlns:pmac-entrada="http://mycompany.com/pmac/modo-entrada-siper" xmlns:pmac-header="http://mycompany.com/pmac/header" xmlns:pmac-neg="http://mycompany.com/pmac/pmac-negocial"&gt; &lt;import schemaLocation="modo-entrada-siper.xsd" namespace="http:/mycompany.com/pmac/modo-entrada-siper"&gt; &lt;/import&gt; &lt;import schemaLocation="header-pmac.xsd" namespace="http://mycompany.com/pmac/header"&gt; &lt;/import&gt; &lt;import schemaLocation="pmac-negocial.xsd" namespace="http://mycompany.com/pmac/pmac-negocial"&gt;&lt;/import&gt; &lt;complexType name="servico"&gt; &lt;sequence&gt; &lt;element name="header" type="pmac-header:header-pmac" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="modo-entrada" type="pmac-entrada:entrada-siper" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="negocial" type="pmac-neg:consulta-saldo" minOccurs="1" maxOccurs="1"&gt;&lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;element name="servico-canal" type="pmac-saldo:servico"&gt;&lt;/element&gt; &lt;/schema&gt; </code></pre> <p>Here is the first import:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;schema targetNamespace="http://mycompany.com/pmac/modo-entrada-siper" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:pmac-entrada="http://mycompany.com/pmac/modo-entrada-siper"&gt; &lt;complexType name="entrada-siper"&gt; &lt;sequence&gt; &lt;element name="codigo-modo" type="int" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="opcao" type="int" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="cpf" type="string" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="token" type="pmac-entrada:token-siper" minOccurs="1" maxOccurs="1"&gt;&lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;complexType name="token-siper"&gt; &lt;sequence&gt; &lt;element name="acao" type="int" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="sessao" type="string" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="endereco-ip" type="string" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="token-sessao" type="string" minOccurs="1" maxOccurs="1"&gt;&lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/schema&gt; </code></pre> <p>The second import:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;schema targetNamespace="http://mycompany.com/pmac/header" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:pmac-header="http://mycompany.com/pmac/header"&gt; &lt;complexType name="header-pmac"&gt; &lt;sequence&gt; &lt;element name="versao" type="int" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="codigo-canal" type="int" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="codigo-servico" type="int" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="nsu-canal" type="int" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="data-solicitacao" type="date" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="hora-solicitacao" type="time" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="data-contabil" type="date" minOccurs="0" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="hora-contabil" type="time" minOccurs="0" maxOccurs="1"&gt;&lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/schema&gt; </code></pre> <p>And the third import:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;schema targetNamespace="http://mycompany.com/pmac/pmac-negocial" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:pmac-neg="http://mycompany.com/pmac/pmac-negocial"&gt; &lt;complexType name="conta"&gt; &lt;sequence&gt; &lt;element name="agencia-conta" minOccurs="1" maxOccurs="1"&gt; &lt;simpleType&gt; &lt;restriction base="int"&gt; &lt;pattern value="[0-9]{4}"&gt;&lt;/pattern&gt; &lt;/restriction&gt; &lt;/simpleType&gt; &lt;/element&gt; &lt;element name="operacao-conta" minOccurs="1" maxOccurs="1"&gt; &lt;simpleType&gt; &lt;restriction base="int"&gt; &lt;pattern value="[0-9]{3}"&gt;&lt;/pattern&gt; &lt;/restriction&gt; &lt;/simpleType&gt; &lt;/element&gt; &lt;element name="numero-conta" maxOccurs="1" minOccurs="1"&gt; &lt;simpleType&gt; &lt;restriction base="int"&gt; &lt;pattern value="[0-9]{8}"&gt;&lt;/pattern&gt; &lt;/restriction&gt; &lt;/simpleType&gt; &lt;/element&gt; &lt;element name="dv-conta" minOccurs="1" maxOccurs="1"&gt; &lt;simpleType&gt; &lt;restriction base="int"&gt; &lt;pattern value="[0-9]{1}"&gt;&lt;/pattern&gt; &lt;/restriction&gt; &lt;/simpleType&gt; &lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;complexType name="consulta-saldo"&gt; &lt;sequence&gt; &lt;element name="conta-sidec" type="pmac-neg:conta" minOccurs="1" maxOccurs="1"&gt; &lt;/element&gt; &lt;element name="tipo-saldo" type="string" minOccurs="1" maxOccurs="1"&gt;&lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/schema&gt; </code></pre> <p>Here is the XML:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;pmac-saldo:servico-canal xmlns:pmac-entrada="http://mycompany.com/pmac/modo-entrada-siper" xmlns:pmac-header="http://mycompany.com/pmac/header" xmlns:pmac-neg="http://mycompany.com/pmac/pmac-negocial" xmlns:pmac-saldo="http://mycompany.com/pmac/servico-saldo-req" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mycompany.com/pmac/servico-saldo-req ../schema/servico-saldo-req.xsd "&gt; &lt;pmac-saldo:header&gt; &lt;pmac-header:versao&gt;1&lt;/pmac-header:versao&gt; &lt;pmac-header:codigo-canal&gt;3&lt;/pmac-header:codigo-canal&gt; &lt;pmac-header:codigo-servico&gt;000001&lt;/pmac-header:codigo-servico&gt; &lt;pmac-header:nsu-canal&gt;1&lt;/pmac-header:nsu-canal&gt; &lt;pmac-header:data-solicitacao&gt;2013-07-05&lt;/pmac-header:data-solicitacao&gt; &lt;pmac-header:hora-solicitacao&gt;18:00:00&lt;/pmac-header:hora-solicitacao&gt; &lt;pmac-header:data-contabil&gt;2013-07-18&lt;/pmac-header:data-contabil&gt; &lt;pmac-header:hora-contabil&gt;10:00:00&lt;/pmac-header:hora-contabil&gt; &lt;/pmac-saldo:header&gt; &lt;pmac-saldo:modo-entrada&gt; &lt;pmac-entrada:codigo-modo&gt;1&lt;/pmac-entrada:codigo-modo&gt; &lt;pmac-entrada:opcao&gt;0&lt;/pmac-entrada:opcao&gt; &lt;pmac-entrada:cpf&gt;03432252200&lt;/pmac-entrada:cpf&gt; &lt;pmac-entrada:token&gt; &lt;pmac-entrada:acao&gt;1&lt;/pmac-entrada:acao&gt; &lt;pmac-entrada:sessao&gt;3c95ce29b0d4d6c00b467a3871aac&lt;/pmac-entrada:sessao&gt; &lt;pmac-entrada:endereco-ip&gt;127.0.0.1&lt;/pmac-entrada:endereco-ip&gt; &lt;pmac-entrada:token-sessao&gt;WHUxpCMkyuF7xCXUJJt6tgFupGHXzg6HfX92rz4UBIK6AbvIcXH93sg7rNid&lt;/pmac-entrada:token-sessao&gt; &lt;/pmac-entrada:token&gt; &lt;/pmac-saldo:modo-entrada&gt; &lt;pmac-saldo:negocial&gt; &lt;pmac-neg:conta-sidec&gt; &lt;pmac-neg:agencia-conta&gt;1679&lt;/pmac-neg:agencia-conta&gt; &lt;pmac-neg:operacao-conta&gt;001&lt;/pmac-neg:operacao-conta&gt; &lt;pmac-neg:numero-conta&gt;00000155&lt;/pmac-neg:numero-conta&gt; &lt;pmac-neg:dv-conta&gt;8&lt;/pmac-neg:dv-conta&gt; &lt;/pmac-neg:conta-sidec&gt; &lt;pmac-neg:tipo-saldo&gt;disponivel&lt;/pmac-neg:tipo-saldo&gt; &lt;/pmac-saldo:negocial&gt; &lt;/pmac-saldo:servico-canal&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload