-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: ExceptionInInitializerError: Could not find a getter for ...
PostPosted: Mon Sep 08, 2003 12:49 pm 
Newbie

Joined: Mon Sep 08, 2003 12:32 pm
Posts: 10
Hi,
Could somebody tell me what I did wrong here.
This is very basic, nothing fancy.
This happens with Hibernate 2.02 Informix 7.1.
I let Hibernate generate everything, with nullable fields being modified from primitive to objects.

Here is the trace:

--------

java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at java.beans.Beans.instantiate(Beans.java:204)
at java.beans.Beans.instantiate(Beans.java:48)
at org.apache.jsp.MyJsp_jsp._jspService(MyJsp_jsp.java:54)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.RuntimeException: SOME ERROR !!!Could not find a getter for oCode in class com.accovia.generated.Grille
at com.accovia.test.MyPVHib.(MyPVHib.java:71)
... 44 more

--------------------

The mapping file is:

<hibernate-mapping default-cascade="none">
<class name="com.accovia.generated.Grille" table="grille" polymorphism="implicit" mutable="true">
<id column="grille_id" name="id" type="long" unsaved-value="any">
<generator class="native" />
</id>
<property column="lot_id" length="4" name="lotId" type="integer" unique="false" not-null="true" />
<property column="description_grille" length="30" name="descriptionGrille" type="string" unique="false" not-null="true" />
<property column="libelle_prix" length="30" name="libellePrix" type="string" unique="false" not-null="false" />
<property column="ori_code" length="3" name="oriCode" type="string" unique="false" not-null="true" />
<property column="des_code" length="3" name="desCode" type="string" unique="false" not-null="true" />
<property column="o_code" length="1" name="oCode" type="string" unique="false" not-null="true" />
<property column="saison" length="1" name="saison" type="string" unique="false" not-null="false" />
<property column="categ_inv_ref" length="3" name="categInvRef" type="string" unique="false" not-null="true" />
<property column="categ_duree_ref" length="1" name="categDureeRef" type="string" unique="false" not-null="true" />
<property column="base_occ" length="2" name="baseOcc" type="short" unique="false" not-null="true" />
<property column="base_temps" length="2" name="baseTemps" type="short" unique="false" not-null="true" />
<property column="mode_calcul" length="2" name="modeCalcul" type="java.lang.Short" unique="false" not-null="false" />
<property column="template_cancel" length="10" name="templateCancel" type="string" unique="false" not-null="false" />
<property column="code_monetaire" length="3" name="codeMonetaire" type="string" unique="false" not-null="true" />
<property column="code_taxe" length="12" name="codeTaxe" type="double" unique="false" not-null="true" />
<property column="categ_commission" length="2" name="categCommission" type="short" unique="false" not-null="true" />
<property column="jours_depart" length="2" name="joursDepart" type="java.lang.Short" unique="false" not-null="false" />
<property column="regle_arrondi" length="2" name="regleArrondi" type="short" unique="false" not-null="true" />
<property column="longueur_periode" length="4" name="longueurPeriode" type="integer" unique="false" not-null="true" />
<property column="date_de" length="4" name="dateDe" type="date" unique="false" not-null="false" />
<property column="date_a" length="4" name="dateA" type="date" unique="false" not-null="false" />
<property column="resa_de" length="4" name="resaDe" type="date" unique="false" not-null="false" />
<property column="resa_a" length="4" name="resaA" type="date" unique="false" not-null="false" />
<property column="calcul_date" length="4" name="calculDate" type="integer" unique="false" not-null="true" />
<property column="modele_id" length="4" name="modeleId" type="java.lang.Integer" unique="false" not-null="false" />
</class>
</hibernate-mapping>

------------
The setter & getter for the field are:


public class Grille implements Serializable {

/** identifier field */
private long id;
......

private String oCode;

....

public java.lang.String getOCode() {
return this.oCode;
}

public void setOCode(java.lang.String oCode) {
this.oCode = oCode;
}

....

}


thanks in advance.
thanh.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 12:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The name of the property would be "OCode", with an initiali caps, as specified by javabeans standard.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 1:37 pm 
Newbie

Joined: Mon Sep 08, 2003 12:32 pm
Posts: 10
Hi Gavin,

That fixed the problem.
Thanks Gavin.

I have a lingering doubt about this though.
Are you sure this is a javabeans convention ?

I thought that whether you name the property "oCode", or "OCode",
the getter and setter would be getOCode() and setOCode() in both cases.

thanh/


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 1:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, it is using:

java.beans.Introspector.decapitalize()

....I think it is correct....


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 1:59 pm 
Newbie

Joined: Mon Sep 08, 2003 12:32 pm
Posts: 10
Well,
that's true.

Then the mapping file generator is wrong then.

t.

_________________
thanh nguyen/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.