This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MappingException

 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following snippet of code from hibernate-config.xml file and
UserGovtEduRef.hbm.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory
name="hibernate/SessionFactory">
<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"/>


</session-factory>



</hibernate-configuration>




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"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

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

<class name="com.symantec.qg.bo.UserGovtEduRefBO" table="QG_BUYING_PROGRAM_MAP">
<id name="bpmId" type="long" >
<generator class="native"/>
</id>
<property name="isGovtCountry" column="GOV_COUNTRY"/>
<property name="isEduCountry" column="EDU_COUNTRY"/>
</class>

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

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

</hibernate-mapping>

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 com.symantec.qg.bo.GovtEduProgBO 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



:roll:
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic