Hibernate -- object creation error -


i've set , running hibernate 3.6 on eclipse/juno ee.

my first code giving me runtime error on instantiating class configuration of hn. so-- precise,

sessionfactory afactory; configuration conf;  

are fine & running,

but line next below

conf=new configuration(); 

is throwing java.lang.exceptionininitializererror.

the code

sessionfactory afactory = new configuration().configure().buildsessionfactory();  

is near running.

my hibernate.cfg.xml follows:

<?xml version='1.0' encoding='utf-8'?>   <!doctype hibernate-configuration public     "-//hibernate/hibernate configuration dtd 3.0//en"       "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">  <hibernate-configuration> <session-factory>     <property name="connection.driver_class">org.postgresql.driver</property>            <property name="connection.url">jdbc:postgresql://localhost:5432/thisdb</property>       <property name="connection.username">postgres</property>     <property name="connection.password">somepass</property>     <property name="connection.pool_size">1</property>     <property name="dialect">org.hibernate.dialect.postgresqldialect</property>       <property name="cache.provider_class">org.hibernate.cache.nocacheprovider</property>     <property name="show_sql">true</property>     <property name="hbm2ddl.auto">create</property>     <mapping class="dataobjs.someitems"/>   </session-factory> </hibernate-configuration> 

i copied contents of "!doctype" tag project in same pack downloaded-- should fine.

my libraries added project , imported in class.

the code not giving such errors on creation of "non-hibernate" objects.

what missing?

new hn. first code.

//=====================================

edit: adding code & stacktrace:

package somepaket;  import org.hibernate.session; import org.hibernate.sessionfactory; import org.hibernate.cfg.configuration;  import dataobjs.someitems;  public class firstclass{ public static void main(string[] args) {     system.out.println("..........see this.........");      someitems kullanici = new someitems();     itm.setid(1);     itm.settype("aaa");      sessionfactory afactory;     configuration conf=new configuration();;      new configuration();     new configuration().configure().buildsessionfactory(); } } 

the full log on console:

..........see this......... slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. exception in thread "main" java.lang.exceptionininitializererror     @ org.hibernate.cfg.configuration.reset(configuration.java:332)     @ org.hibernate.cfg.configuration.<init>(configuration.java:298)     @ org.hibernate.cfg.configuration.<init>(configuration.java:302)     @ somepaket.firstclass.main(firstclass.java:18) caused by: java.lang.nullpointerexception     @ org.hibernate.util.confighelper.getresourceasstream(confighelper.java:167)     @ org.hibernate.cfg.environment.<clinit>(environment.java:618)     ... 4 more 

//=====================

edit2:

traced in debugger:

loggerfactory.singleimplementationsanitycheck() 

is throwing following @ line 216:

filenotfoundexception(throwable).<init>(string) line: 264.  

you may have include slf4j library application:

slf4j-simple-1.6.2.jar 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -