Note that there are some explanatory texts on larger screens.

plurals
  1. POConfigured SessionFactory: null
    text
    copied!<p>I have created basic hibernate application. It throw error message.</p> <p><strong>Error is:</strong></p> <pre><code> Oct 18, 2012 3:36:13 PM org.hibernate.cfg.Environment &lt;clinit&gt; INFO: Hibernate 3.2.5 Oct 18, 2012 3:36:13 PM org.hibernate.cfg.Environment &lt;clinit&gt; INFO: hibernate.properties not found Oct 18, 2012 3:36:13 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: Bytecode provider name : cglib Oct 18, 2012 3:36:13 PM org.hibernate.cfg.Environment &lt;clinit&gt; INFO: using JDK 1.4 java.sql.Timestamp handling Oct 18, 2012 3:36:13 PM org.hibernate.cfg.Configuration configure INFO: configuring from resource: /hibernate.cfg.xml Oct 18, 2012 3:36:13 PM org.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml Oct 18, 2012 3:36:13 PM org.hibernate.cfg.Configuration addResource INFO: Reading mappings from resource : com/crmcall/entity/CallUsers.hbm.xml Oct 18, 2012 3:36:13 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues INFO: Mapping class: com.crmcall.entity.CallUsers -&gt; crmcallusers Oct 18, 2012 3:36:13 PM org.hibernate.cfg.Configuration addResource INFO: Reading mappings from resource : com/crmcall/entity/Customers.hbm.xml Oct 18, 2012 3:36:14 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues INFO: Mapping class: com.crmcall.entity.Customers -&gt; crmcustomermaster Oct 18, 2012 3:36:14 PM org.hibernate.cfg.Configuration addResource INFO: Reading mappings from resource : com/crmcall/entity/User.hbm.xml Oct 18, 2012 3:36:14 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues INFO: Mapping class: com.crmcall.entity.User -&gt; crmusers Oct 18, 2012 3:36:14 PM org.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null Initial SessionFactory creation failed.org.hibernate.MappingException: component class not found: string Exception in thread "main" java.lang.ExceptionInInitializerError at com.crmcall.util.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:27) at com.crmcall.dao.UserDAO.&lt;init&gt;(UserDAO.java:23) at com.crmcall.dao.UserDAO.main(UserDAO.java:36) Caused by: org.hibernate.MappingException: component class not found: string at org.hibernate.mapping.Component.getComponentClass(Component.java:104) at org.hibernate.tuple.component.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:133) at org.hibernate.tuple.component.AbstractComponentTuplizer.&lt;init&gt;(AbstractComponentTuplizer.java:43) at org.hibernate.tuple.component.PojoComponentTuplizer.&lt;init&gt;(PojoComponentTuplizer.java:38) at org.hibernate.tuple.component.ComponentEntityModeToTuplizerMapping.&lt;init&gt;(ComponentEntityModeToTuplizerMapping.java:52) at org.hibernate.tuple.component.ComponentMetamodel.&lt;init&gt;(ComponentMetamodel.java:50) at org.hibernate.mapping.Component.buildType(Component.java:152) at org.hibernate.mapping.Component.getType(Component.java:145) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253) at org.hibernate.mapping.RootClass.validate(RootClass.java:193) at org.hibernate.cfg.Configuration.validate(Configuration.java:1102) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287) at com.crmcall.util.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:24) ... 2 more Caused by: java.lang.ClassNotFoundException: string at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100) at org.hibernate.mapping.Component.getComponentClass(Component.java:101) </code></pre> <p>This is my Hibernate.cfg.xml file:</p> <pre><code> &lt;hibernate-configuration&gt; &lt;session-factory&gt; &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt; &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://192.168.1.5:3306/crmtest&lt;/property&gt; &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt; &lt;property name="hibernate.connection.password"&gt;root&lt;/property&gt; &lt;property name="hibernate.hbm2ddl.auto"&gt;create-drop&lt;/property&gt; &lt;property name="show_sql"&gt;true&lt;/property&gt; &lt;property name="format_sql"&gt;true&lt;/property&gt; &lt;!-- Enable Hibernate automatic session context management --&gt; &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt; &lt;!-- Disable the second-level cache --&gt; &lt;property name="cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt; &lt;mapping resource="com/crmcall/entity/CallUsers.hbm.xml"/&gt; &lt;mapping resource="com/crmcall/entity/Customers.hbm.xml"/&gt; &lt;mapping resource="com/crmcall/entity/User.hbm.xml"/&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre> <p>This is my User.hbm.xml</p> <pre><code> &lt;hibernate-mapping&gt; &lt;class name="com.crmcall.entity.User" table="crmusers"&gt; &lt;composite-id name="userPK" &gt; &lt;key-property name="businessUnit" column="BusinessUnit" type="string"/&gt; &lt;key-property name="userID" column="UserID" type="string"/&gt; &lt;/composite-id&gt; &lt;property name="recID" &gt; &lt;column name="RecID"/&gt; &lt;/property&gt; &lt;property name="password"&gt; &lt;column name="Password"/&gt; &lt;/property&gt; &lt;property name="userName"&gt; &lt;column name="UserName"/&gt; &lt;/property&gt; &lt;property name="userType"&gt; &lt;column name="UserType"/&gt; &lt;/property&gt; &lt;property name="userLevel"&gt; &lt;column name="UserLevel"/&gt; &lt;/property&gt; &lt;property name="customerCode"&gt; &lt;column name="CustomerCode"/&gt; &lt;/property&gt; &lt;property name="customerCodeson"&gt; &lt;column name="CustomerCodeson"/&gt; &lt;/property&gt; &lt;property name="locationCode"&gt; &lt;column name="LocationCode"/&gt; &lt;/property&gt; &lt;property name="lastUpdatedBy"&gt; &lt;column name="LastUpdatedBy"/&gt; &lt;/property&gt; &lt;property name="lastUpdatedOn" type="timestamp"&gt; &lt;column name="LastUpdatedOn"/&gt; &lt;/property&gt; &lt;property name="email" type="string"&gt; &lt;column name="Email"/&gt; &lt;/property&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>This is my calling place :</p> <pre><code> public class UserDAO { private Session session = null; public UserDAO() { session = HibernateUtil.currentSession(); } public List&lt;User&gt; getAllUsers() { Transaction tn = session.beginTransaction(); List&lt;User&gt; users = session.createQuery("from crmusers cu order by cu.UserID").list(); System.out.println("==" + users.size()); tn.commit(); return users; } public static void main(String[] args){ UserDAO userDAO = new UserDAO(); userDAO.getAllUsers(); } } </code></pre> <p>This is my project folder structre: <img src="https://i.stack.imgur.com/ozoOc.png" alt="enter image description here"></p> <p>Please tell me what is an issue in my code?</p> <p>Thanks in advance..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload