[prev in list] [next in list] [prev in thread] [next in thread] 

List:       castor-dev
Subject:    [castor-dev] help requested about exception: object  is not constructable -- it does not contain a d
From:       "Sagi Schlisser" <sagis () idit ! co ! il>
Date:       2003-06-26 15:25:30
[Download RAW message or body]

Hello,
 
I created java classes out of a schema, the schema included a simple
element with enumeration:
 
<xsd:element name="FE_STRPARM">
  <xsd:annotation>
   <xsd:documentation>Stuurparameter kennisregelset</xsd:documentation>
  </xsd:annotation>
  <xsd:simpleType>
   <xsd:restriction base="xsd:string">
    <xsd:enumeration value="STDRD"/>
   </xsd:restriction>
  </xsd:simpleType>
 </xsd:element>
 
I got for it a class with a Type extension: FE_STRPARMType which has
private c'tor and no public c'tor.
for each value in the enumeration (in this example he has one) it
creates a static member which calls the private c'tor with the good
data:
 
 
      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/
 
    /**
     * The STDRD type
     */
    public static final int STDRD_TYPE = 0;
 
    /**
     * The instance of the STDRD type
     */
    public static final FE_STRPARMType STDRD = new
FE_STRPARMType(STDRD_TYPE, "STDRD");

      //----------------/
     //- Constructors -/
    //----------------/
 
    private FE_STRPARMType(int type, java.lang.String value) {
        super();
        this.type = type;
        this.stringValue = value;
    } //--
com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType(int,
java.lang.String)

now I created a mapping xml which looked ok:
 
 <class
cst:name="com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType
">
        <description>Default mapping for class
com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType</descript
ion>
        <map-to cst:xml="FE_STRPARMType"/>
    </class>
 
<class cst:name="com.idit.PD.ABZIntegration.svmmQuestionVO.FE">
        <description>Default mapping for class
com.idit.PD.ABZIntegration.svmmQuestionVO.FE</description>
        <map-to cst:xml="FE"/>
        <field cst:name="FE_PEILDAT" cst:type="java.lang.String"
cst:required="true">
            <bind-xml name="FE_PEILDAT" node="element"/>
        </field>
        <field cst:name="FE_STRPARM"
cst:type="com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType
" cst:required="true">
            <bind-xml name="FE_STRPARM" node="element"/>
        </field>
    </class>
 
when I try to run the folowing code:
 
            Mapping map = new Mapping();
            map.loadMapping(ABZConstants.MAPPING_FILE_NAME);
            map.setAllowRedefinitions(false);
            FileWriter out = new FileWriter(ABZConstants.OUT_FILE_NAME);
            Marshaller marshal = new Marshaller(out);
            marshal.setMarshalExtendedType(true);
            marshal.setMapping(map);
 
I get :
 
org.exolab.castor.mapping.MappingException: The Java class
com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType is not
constructable -- it does not contain a default public constructor
 at
org.exolab.castor.mapping.loader.ClassDescriptorImpl.<init>(ClassDescrip
torImpl.java:152)
 at
org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingL
oader.java:502)
 at
org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoader
.java:192)
 at
org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoader
.java:233)
 at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:291)
 at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:246)
 at org.exolab.castor.xml.Marshaller.setMapping(Marshaller.java:512)
 at com.idit.PD.ABZIntegration.ABZManager.checkABZ(ABZManager.java:212)
 at com.idit.PD.ABZIntegration.ABZManager.main(ABZManager.java:319)
 
since untill this point I used castor all the way I can't understand why
I get this exception.
 
can anyone help please.
 
10X
sagi schliesser

[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003><STRONG>Hello,</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003><STRONG></STRONG></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003><STRONG>I created 
java classes out of a schema, the schema included a simple element with 
enumeration:</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003><STRONG></STRONG></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003>&lt;xsd:element 
name="FE_STRPARM"&gt;<BR>&nbsp;&nbsp;&lt;xsd:annotation&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsd:documentation&gt;Stuurparameter \
 kennisregelset&lt;/xsd:documentation&gt;<BR>&nbsp;&nbsp;&lt;/xsd:annotation&gt;<BR>&nbsp;&nbsp;&lt;xsd:simpleType&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsd:restriction \
 base="xsd:string"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsd:enumeration 
value="STDRD"/&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;/xsd:restriction&gt;<BR>&nbsp;&nbsp;&lt;/xsd:simpleType&gt;<BR>&nbsp;&lt;/xsd:element&gt;</SPAN></FONT></DIV>
 <DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003><STRONG>I got for it 
a class with a Type extension: FE_STRPARMType which has private c'tor and no 
public c'tor.</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003><STRONG>for each 
value in the enumeration (in this example he has one) it creates a 
static&nbsp;member which calls the private c'tor with the good 
data:</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//--------------------------/<BR>&nbsp;&nbsp;&nbsp;&nbsp; //- Class/Member 
Variables -/<BR>&nbsp;&nbsp;&nbsp; 
//--------------------------/</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003>&nbsp;&nbsp;&nbsp; 
/**<BR>&nbsp;&nbsp;&nbsp;&nbsp; * The STDRD type<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
*/<BR>&nbsp;&nbsp;&nbsp; public static final int STDRD_TYPE = 
0;</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003>&nbsp;&nbsp;&nbsp; 
/**<BR>&nbsp;&nbsp;&nbsp;&nbsp; * The instance of the STDRD 
type<BR>&nbsp;&nbsp;&nbsp;&nbsp; */<BR>&nbsp;&nbsp;&nbsp; public static final 
FE_STRPARMType STDRD = new FE_STRPARMType(STDRD_TYPE, 
"STDRD");<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
//----------------/<BR>&nbsp;&nbsp;&nbsp;&nbsp; //- Constructors 
-/<BR>&nbsp;&nbsp;&nbsp; //----------------/</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003>&nbsp;&nbsp;&nbsp; 
private FE_STRPARMType(int type, java.lang.String value) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
super();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.type = 
type;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.stringValue = 
value;<BR>&nbsp;&nbsp;&nbsp; } //-- 
com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType(int, 
java.lang.String)<BR></DIV></SPAN></FONT>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003><STRONG>now I 
created a mapping xml which looked ok:</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003><STRONG></STRONG></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003>&nbsp;&lt;class 
cst:name="com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 &lt;description&gt;Default mapping for class 
com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType&lt;/description&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 &lt;map-to cst:xml="FE_STRPARMType"/&gt;<BR>&nbsp;&nbsp;&nbsp; 
&lt;/class&gt;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003>&lt;class 
cst:name="com.idit.PD.ABZIntegration.svmmQuestionVO.FE"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 &lt;description&gt;Default mapping for class 
com.idit.PD.ABZIntegration.svmmQuestionVO.FE&lt;/description&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 &lt;map-to cst:xml="FE"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;field cst:name="FE_PEILDAT" cst:type="java.lang.String" 
cst:required="true"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 &lt;bind-xml name="FE_PEILDAT" 
node="element"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;/field&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;field 
cst:name="FE_STRPARM" 
cst:type="com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType" 
cst:required="true"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 &lt;bind-xml name="FE_STRPARM" 
node="element"/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;/field&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/class&gt;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003><STRONG>when I try 
to run the folowing code:</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 Mapping map = new 
Mapping();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
map.loadMapping(ABZConstants.MAPPING_FILE_NAME);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 map.setAllowRedefinitions(false);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 FileWriter out = new 
FileWriter(ABZConstants.OUT_FILE_NAME);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 Marshaller marshal = new 
Marshaller(out);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 marshal.setMarshalExtendedType(true);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 marshal.setMapping(map);<BR>&nbsp;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003><STRONG>I get 
> </STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003>org.exolab.castor.mapping.MappingException: The Java 
class com.idit.PD.ABZIntegration.svmmQuestionVO.types.FE_STRPARMType is not 
constructable -- it does not contain a default public constructor<BR>&nbsp;at 
org.exolab.castor.mapping.loader.ClassDescriptorImpl.&lt;init&gt;(ClassDescriptorImpl.java:152)<BR>&nbsp;at \
 org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingLoader.java:502)<BR>&nbsp;at \
 org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoader.java:192)<BR>&nbsp;at \
 org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoader.java:233)<BR>&nbsp;at \
 org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:291)<BR>&nbsp;at 
org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:246)<BR>&nbsp;at 
org.exolab.castor.xml.Marshaller.setMapping(Marshaller.java:512)<BR>&nbsp;at 
com.idit.PD.ABZIntegration.ABZManager.checkABZ(ABZManager.java:212)<BR>&nbsp;at 
com.idit.PD.ABZIntegration.ABZManager.main(ABZManager.java:319)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003><STRONG>since untill 
this point I used castor all the way I can't understand why I get this 
exception.</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003><STRONG></STRONG></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003><STRONG>can anyone 
help please.</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003><STRONG></STRONG></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=871223012-26062003><STRONG>10X</STRONG></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=871223012-26062003><STRONG>sagi 
schliesser</STRONG></SPAN></FONT></DIV></BODY></HTML>



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
minimalist@exolab.org with a subject of:
        unsubscribe castor-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic