Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Object Relational Mapping and the fly likes  org.hibernate.MappingException: entity class not found: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark " org.hibernate.MappingException: entity class not found:" Watch " org.hibernate.MappingException: entity class not found:" New topic
Author

org.hibernate.MappingException: entity class not found:

Thirupathi Neela
Greenhorn

Joined: Feb 26, 2009
Posts: 13
Hi !

I have created JSP page. When I run the page I get the following exceptions. All files(.java and .hbm.xml) are available inside WEB-INF/classes. Could someone help to solve this issue, please?

Thanks in advance

12:41:51,859 INFO [STDOUT] inside try
12:41:51,859 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
12:41:51,859 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
12:41:51,859 INFO [Configuration] Reading mappings from resource : dynamic/Student.hbm.xml
12:41:51,875 INFO [HbmBinder] Mapping class: dynamic.Student -> STUDENT
12:41:51,875 INFO [Configuration] Reading mappings from resource : dynamic/Course.hbm.xml
12:41:51,875 INFO [HbmBinder] Mapping class: dynamic.Course -> COURSE
12:41:51,875 INFO [Configuration] Reading mappings from resource : dynamic/Examresult.hbm.xml
12:41:51,890 INFO [HbmBinder] Mapping class: dynamic.Examresult -> EXAMRESULT
12:41:51,890 INFO [Configuration] Reading mappings from resource : dynamic/Exam.hbm.xml
12:41:51,890 INFO [HbmBinder] Mapping class: dynamic.Exam -> EXAM
12:41:51,890 INFO [Configuration] Configured SessionFactory:
12:41:51,890 INFO [HbmBinder] Mapping collection: dynamic.Student.examresults -> EXAMRESULT
12:41:51,890 INFO [HbmBinder] Mapping collection: dynamic.Course.exams -> EXAM
12:41:51,890 INFO [HbmBinder] Mapping collection: dynamic.Exam.examresults -> EXAMRESULT
12:41:51,890 INFO [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
12:41:51,890 INFO [DriverManagerConnectionProvider] Hibernate connection pool size: 20
12:41:51,890 INFO [DriverManagerConnectionProvider] autocommit mode: false
12:41:51,890 INFO [DriverManagerConnectionProvider] using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://192.168.1.150:1433;DatabaseName=STUDENT;SelectMethod=cursor
12:41:51,890 INFO [DriverManagerConnectionProvider] connection properties: {user=bbb, password=aaa}
12:41:51,906 INFO [SettingsFactory] RDBMS: Microsoft SQL Server, version: Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Dec 17 2002 14:22:05
Copyright (c) 1988-2003 Microsoft Corporation
Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

12:41:51,906 INFO [SettingsFactory] JDBC driver: SQLServer, version: 2.2.0040
12:41:51,906 INFO [Dialect] Using dialect: org.hibernate.dialect.SQLServerDialect
12:41:51,906 INFO [TransactionFactoryFactory] Using default transaction strategy (direct JDBC transactions)
12:41:51,906 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
12:41:51,906 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
12:41:51,906 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
12:41:51,906 INFO [SettingsFactory] Scrollable result sets: enabled
12:41:51,906 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
12:41:51,906 INFO [SettingsFactory] Connection release mode: auto
12:41:51,906 INFO [SettingsFactory] Default batch fetch size: 1
12:41:51,906 INFO [SettingsFactory] Generate SQL with comments: disabled
12:41:51,906 INFO [SettingsFactory] Order SQL updates by primary key: disabled
12:41:51,906 INFO [SettingsFactory] Order SQL inserts for batching: disabled
12:41:51,906 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
12:41:51,906 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
12:41:51,906 INFO [SettingsFactory] Query language substitutions: {}
12:41:51,906 INFO [SettingsFactory] JPA-QL strict compliance: disabled
12:41:51,906 INFO [SettingsFactory] Second-level cache: enabled
12:41:51,906 INFO [SettingsFactory] Query cache: disabled
12:41:51,906 INFO [SettingsFactory] Cache provider: org.hibernate.cache.NoCacheProvider
12:41:51,906 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
12:41:51,906 INFO [SettingsFactory] Structured second-level cache entries: disabled
12:41:51,906 INFO [SettingsFactory] Statistics: disabled
12:41:51,906 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
12:41:51,906 INFO [SettingsFactory] Default entity-mode: pojo
12:41:51,906 INFO [SettingsFactory] Named query checking : enabled
12:41:51,906 INFO [SessionFactoryImpl] building session factory
12:41:51,921 ERROR [STDERR] org.hibernate.MappingException: entity class not found: dynamic.Exam
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:99)
at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:168)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:123)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.apache.jsp.Course_jsp._jspService(Course_jsp.java:78)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: dynamic.Exam
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:514)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:96)
... 33 more
----------------------------------------------------------------------------------
hibernate.cfg.xml
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="">
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.password">bbb</property>
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://192.168.1.150:1433;DatabaseName=STUDENT;SelectMethod=cursor</property>
<property name="hibernate.connection.username">aaa</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<mapping class="dynamic.Student" resource="dynamic/Student.hbm.xml"/>
<mapping class="dynamic.Course" resource="dynamic/Course.hbm.xml"/>
<mapping class="dynamic.Examresult" resource="dynamic/Examresult.hbm.xml"/>
<mapping class="dynamic.Exam" resource="dynamic/Exam.hbm.xml"/>
</session-factory>
</hibernate-configuration>
-----------------------------------------------------
JSP file
-------------
<%@ page contentType="text/html; charset=utf-8" language="java"
import=" dynamic.*,java.util.Date,
java.util.Iterator,
java.util.List,
org.hibernate.Session,
org.hibernate.SessionFactory,
org.hibernate.cfg.Configuration,
org.hibernate.Query"

%>

<html>
<head>
<title>Students' List</title>
</head>

<body>
<%! List list=null; %>
<%
Session sess=null;
try

{
System.out.println("inside try");
SessionFactory sessionFactory = new Configuration() .configure().buildSessionFactory();
sess =sessionFactory.openSession();
sess=sessionFactory.openSession();
System.out.println("session created");
list=sess.createQuery("from Course").list();
out.print(list);
System.out.println(list);

}
catch(Exception e){e.printStackTrace();}
// finally{sess.flush();sess.close();}
%>

hib
</body>
</html>
-----------------------------------------


Thiru
Rahul Babbar
Ranch Hand

Joined: Jun 28, 2008
Posts: 210
All files(.java and .hbm.xml) are available inside WEB-INF/classes.


I suppose you mean .class files and not .java files.


Rahul Babbar
Thirupathi Neela
Greenhorn

Joined: Feb 26, 2009
Posts: 13


I suppose you mean .class files and not .java files.



Yes. Any suggestions to solve this problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.hibernate.MappingException: entity class not found:
 
Similar Threads
Hibernate newbie - Data sequence
MySQLSyntaxErrorException: Access denied
hibernate Transaction with Jboss(CMT)
Error reading resource: hbm.xml file
How to create a dynamic web project using eclipse IDE?