0 Replies Latest reply on Sep 22, 2009 11:31 PM by Chris Walters

    "ClassNotFoundException" During Hibernate JBOSS Deployment

    Chris Walters Newbie

      I am getting a "ClassNotFoundException" for a "composite-id" element in a hibernate mapping file during deployment of a hibernate app even though the class in question does correctly exist in the GGGoMobile.jar file.

      I am using NetBeans 6.7.1 Hibernate utilities to reverse engineer a MySQL 5 database and generate the mapping files, JBOSS 5.1.0, and Hibernate 3.3.1.

      Application Structure:

      GGGoMobile.ear
       +META-INF
       + gggomobile-hibernate.xml
       + application.xml
       + jboss-app.xml
       +GGGoMobileLib.jar (contains all hibernate mapping files and compiled .class files)
      
      ... other JAR and WAR files
      


      Hibernate Mapping File:
      <?xml version="1.0"?>
      <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
      <!-- Generated Sep 21, 2009 5:32:06 PM by Hibernate Tools 3.2.1.GA -->
      <hibernate-mapping>
       <class name="com.clarksonville.gm.lib.data.GmStoreAdKeyword" table="gm_store_ad_keyword" catalog="gggomobiledb">
       <composite-id name="id" class="com.clarksonville.gm.lib.data.GmStoreAdKeywordId">
       <key-property name="adKeywordId" type="int">
       <column name="ad_keyword_id" />
       </key-property>
       <key-property name="storeAdId" type="int">
       <column name="store_ad_id" />
       </key-property>
       </composite-id>
       <many-to-one name="gmStoreAd" class="com.clarksonville.gm.lib.data.GmStoreAd" update="false" insert="false" fetch="select">
       <column name="store_ad_id" not-null="true" />
       </many-to-one>
       <many-to-one name="gmAdKeyword" class="com.clarksonville.gm.lib.data.GmAdKeyword" update="false" insert="false" fetch="select">
       <column name="ad_keyword_id" not-null="true" />
       </many-to-one>
       <property name="keywordBid" type="java.lang.Float">
       <column name="keyword_bid" precision="12" scale="0" />
       </property>
       </class>
      </hibernate-mapping>
      


      gggomobile-hibernate.xml
      <hibernate-configuration xmlns="urn:jboss:hibernate-deployer:1.0">
       <session-factory name="java:/hibernate/GGGoMobileSessionFactory" bean="jboss.gggomobile:name=GGGoMobileSessionFactory">
       <property name="datasourceName">java:/GGGoMobileDS</property>
       <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
       <depends>jboss:service=Naming</depends>
       <depends>jboss:service=TransactionManager</depends>
       </session-factory>
      </hibernate-configuration>
      


      Error Stack Trace:
      11:41:39,435 ERROR [AbstractKernelController] Error installing to Start: name=jboss.gggomobile:name=GGGoMobileSessionFactory state=Create
      org.hibernate.MappingException: component class not found: com.clarksonville.gm.lib.data.GmStoreAdKeywordId
       at org.hibernate.mapping.Component.getComponentClass(Component.java:127)
       at org.hibernate.tuple.component.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:156)
       at org.hibernate.tuple.component.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:66)
       at org.hibernate.tuple.component.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:61)
       at org.hibernate.tuple.component.ComponentEntityModeToTuplizerMapping.<init>(ComponentEntityModeToTuplizerMapping.java:76)
      
      ...
      
      Caused by: java.lang.ClassNotFoundException: com.clarksonville.gm.lib.data.GmStoreAdKeywordId from BaseClassLoader@6dcfde{VFSClassLoaderPolicy@16a3075{name=vfsfile:/C:/JBoss/jboss-5.1.0.GA/server/default/conf/jboss-service.xml domain=ClassLoaderDomain@16877f8{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@867e89 ...
      
       at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:169)
       at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:123)
       at org.hibernate.mapping.Component.getComponentClass(Component.java:124)
       ... 72 more