File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes MappingException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "MappingException" Watch "MappingException" New topic


Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
I have the following snippet of code from hibernate-config.xml file and

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"


<!-- a SessionFactory instance listed as /jndi/name -->
<property name="hibernate.show_sql">false</property>
<!-- properties -->
<property name="hibernate.connection.datasource">jdbc/cplg</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>

<mapping resource="Account.hbm.xml"/>

<mapping resource="SymomCplgLookup.hbm.xml"/>
<mapping resource="UserRole.hbm.xml"/>
<mapping resource="UserGovtEduRef.hbm.xml"/>



And in my UserGovtEduRef.hbm.xml this is the code
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"

<hibernate-mapping default-cascade="all" default-lazy="false">

<class name="" table="QG_BUYING_PROGRAM_MAP">
<id name="bpmId" type="long" >
<generator class="native"/>
<property name="isGovtCountry" column="GOV_COUNTRY"/>
<property name="isEduCountry" column="EDU_COUNTRY"/>

<query name="lookupGovtPrograms">
select distinct gov_country from UserGovtEduRefBO where edu_country ='Y' and country_id= ?

<query name="lookupEduPrograms">
select distinct edu_country from UserGovtEduRefBO where gov_country = 'Y' and country_id = ?


The Object class UserGovtEduRefBO is created in the jar file and is always found

But when I start my application server It throws me following stacktrace
[7/25/06 13:11:26:133 PDT] 0000003b Configuration E TRAS0014I: The following exception was logged org.hibernate.MappingException: class not found while looking for property: isGovtCountry

After this also follwing stacktrace crie for same missing UserGovtEduRefBO.class

Since I am new to Hibernate I am not sure what missing pieces I need to assemble ot make it work

If any one has come across same scenario and has solution then please help me also

Thanks in advance


SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
The app server's classloaders can't find the class anywhere in it's classpath.

Is class name spelled correctly in the mapping file? Assuming the class is deployed in a jar, is the jar in the application's or the app server's classpath? Are the permissions correct on the jar?
I agree. Here's the link:
subject: MappingException
It's not a secret anymore!