java - Need help to run a hibernate project -
i new hibernate, , struggling hours make project run. didn't write code, want start it. don't know begin explainin. first post picture structure of project
i didn't import project, created new 1 , copied code. have included jars hibernate
. using postgresql
, initial project using sqlserver
. have modified hibernate.cfg.xml
, book.hbm.xml
files, think post these files here, bunch of errors:
**strong text**exception in thread "awt-eventqueue-0" org.hibernate.hibernateexception: not parse configuration: /hibernate.cfg.xml @ org.hibernate.cfg.configuration.doconfigure(configuration.java:1491) @ org.hibernate.cfg.configuration.configure(configuration.java:1425) @ org.hibernate.cfg.configuration.configure(configuration.java:1411) @ service.bookservice.<init>(bookservice.java:16) @ controller.bookmanager.<init>(bookmanager.java:18) @ views.library.<init>(library.java:24) @ start.createandshowgui(start.java:15) @ start$1.run(start.java:29) @ java.awt.event.invocationevent.dispatch(invocationevent.java:311) @ java.awt.eventqueue.dispatcheventimpl(eventqueue.java:744) @ java.awt.eventqueue.access$400(eventqueue.java:97) @ java.awt.eventqueue$3.run(eventqueue.java:697) @ java.awt.eventqueue$3.run(eventqueue.java:691) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:75) @ java.awt.eventqueue.dispatchevent(eventqueue.java:714) @ java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:201) @ java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:116) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:105) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:101) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:93) @ java.awt.eventdispatchthread.run(eventdispatchthread.java:82) caused by: org.dom4j.documentexception: connection reset nested exception: connection reset @ org.dom4j.io.saxreader.read(saxreader.java:484) @ org.hibernate.cfg.configuration.doconfigure(configuration.java:1481) ... 21 more
initial hibernate.cfg.xml
file:
<?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration system "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.dialect"> org.hibernate.dialect.mysqldialect </property> <property name="hibernate.connection.driver_class"> com.mysql.jdbc.driver </property> <!-- assume test database name --> <property name="hibernate.connection.url"> jdbc:mysql://localhost/lab1_aop </property> <property name="hibernate.connection.username"> root </property> <property name="hibernate.connection.password"> root </property> <!-- list of xml mapping files --> <mapping resource="book.hbm.xml"/> </session-factory> </hibernate-configuration>
my hibernate.cfg.xml
file:
<?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="hibernate.dialect">org.hibernate.dialect.postgresqldialect</property> <property name="hibernate.connection.driver_class">org.postgresql.driver</property> <property name="hibernate.connection.username">postgres</property> <property name="hibernate.connection.password">passw</property> <property name="hibernate.connection.url">jdbc:postgresql://localhost:5434/lab1_aop</property> <mapping resource="book.hbm.xml"/> </session-factory> </hibernate-configuration>
in book.hbm.xml
file didn't change anything:
<?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd//en" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="model.book" table="books"> <meta attribute="class-description"> class contains book details. </meta> <id name="id" type="int" column="id"> <generator class="native"/> </id> <property name="name" column="name" type="string"/> <property name="borrowed" column="borrowed" type="boolean"/> </class> </hibernate-mapping>
can me please? can provide more of code if nedded. thank in advance!
try replacing:
<?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration system "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
with
<?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">
in hibernate.cfg.xml
Comments
Post a Comment