• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hibernate error

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys im trying to get a simple hibernate example goin, just a main java class, a class for set & get methods and 2 xml files for mapping and stuff.
But when i compile the program has trouble creating the session and it remains null.
This is the error i get

23-Aug-2006 09:47:03 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.1.3
23-Aug-2006 09:47:03 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
23-Aug-2006 09:47:03 org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
23-Aug-2006 09:47:03 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
23-Aug-2006 09:47:03 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
23-Aug-2006 09:47:03 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
java.lang.NullPointerException
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1411)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
null
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:23)

Im afraid it does not mean much to me and im pretty sure its a configuration error, can any teach me exactly why the error might be occuring or what file could be causing the problem?

mark
 
Mark Hughes
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys newish error


23-Aug-2006 10:05:47 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.1.3
23-Aug-2006 10:05:47 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
23-Aug-2006 10:05:47 org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
23-Aug-2006 10:05:47 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
23-Aug-2006 10:05:47 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
23-Aug-2006 10:05:47 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
23-Aug-2006 10:05:47 org.hibernate.util.XMLHelper$ErrorLogger error
SEVERE: Error parsing XML: /hibernate.cfg.xml(3) The processing instruction target matching "[xX][mM][lL]" is not allowed.
org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1376)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:23)
Caused by: org.dom4j.DocumentException: Error on line 3 of document : The processing instruction target matching "[xX][mM][lL]" is not allowed. Nested exception: The processing instruction target matching "[xX][mM][lL]" is not allowed.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1366)
... 3 more
Could not parse configuration: /hibernate.cfg.xml
 
Mark Hughes
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry guys yet another error!


23-Aug-2006 10:09:50 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.1.3
23-Aug-2006 10:09:50 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
23-Aug-2006 10:09:50 org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
23-Aug-2006 10:09:50 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
23-Aug-2006 10:09:50 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
23-Aug-2006 10:09:50 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
23-Aug-2006 10:09:50 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource: roseindia/tutorial/hibernate/Contact.hbm.xml
org.hibernate.MappingException: Resource: roseindia/tutorial/hibernate/Contact.hbm.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:479)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:23)
Resource: roseindia/tutorial/hibernate/Contact.hbm.xml not found



any idea's
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


INFO: Reading mappings from resource: roseindia/tutorial/hibernate/Contact.hbm.xml
org.hibernate.MappingException: Resource: roseindia/tutorial/hibernate/Contact.hbm.xml not found


Contact.hbm.xml is not in the classpath, so Hibernate can't find it. Check it exists, is on the classpath and is in the package roseindia/tutorial/hibernate.

(Your earlier error look like: 1) hibernate.cfg.xml didn't exist or wasn't on the classpath, & 2) hibernate.cfg.xml wasn't valid XML
[ August 23, 2006: Message edited by: Paul Sturrock ]
 
Mark Hughes
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i had it in a bin folder, that was in my project but not directly in the package,

When i put the contact.hbm.xml in the package folder the error changed again to


23-Aug-2006 10:35:25 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.1.3
23-Aug-2006 10:35:25 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
23-Aug-2006 10:35:25 org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
23-Aug-2006 10:35:25 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
23-Aug-2006 10:35:25 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
23-Aug-2006 10:35:25 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
23-Aug-2006 10:35:25 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource: roseindia/tutorial/hibernate/Contact.hbm.xml
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
at org.hibernate.mapping.Table.<init>(Table.java:33)
at org.hibernate.cfg.Mappings.addTable(Mappings.java:165)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:299)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
at org.hibernate.cfg.Configuration.add(Configuration.java:386)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:23)


so hard to know what these errors mean!
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A NoClassDefFoundError means that a class required by some application code cannot be found. In this case that class is called org.apache.commons.collections.SequencedHashMap which is part of commons collections. So the commons collections jar file must be in your classpath toio.
 
Mark Hughes
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
were getting there, more program errors now so on the right track.

new error

23-Aug-2006 11:01:50 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.1.3
23-Aug-2006 11:01:50 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
23-Aug-2006 11:01:50 org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
23-Aug-2006 11:01:50 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
23-Aug-2006 11:01:50 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
23-Aug-2006 11:01:50 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
23-Aug-2006 11:01:51 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource: roseindia/tutorial/hibernate/Contact.hbm.xml
23-Aug-2006 11:01:51 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: roseindia.tutorial.hibernate.Contact -> cost
23-Aug-2006 11:01:51 org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
org.hibernate.MappingException: Repeated column in mapping for entity: roseindia.tutorial.hibernate.Contact column: Price (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:575)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:597)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:615)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:405)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:984)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1169)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:23)
Repeated column in mapping for entity: roseindia.tutorial.hibernate.Contact column: Price (should be mapped with insert="false" update="false")


Would this be the xml file yea or contact.class file?

Mark
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


org.hibernate.MappingException: Repeated column in mapping for entity: roseindia.tutorial.hibernate.Contact column: Price (should be mapped with insert="false" update="false")


The error message tells you it is in the mapping file. Just fix the mapping so it:
  • Just has one property mapped to the column price
  • Or only has one property mapped to the column price with the attributes insert and update = "true".

  •  
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hey,


    Here is the mapping file contents:



    My database is called test and the table is called cost, with columns Price, Tax and Total. All the tutorial program is doing is updating so i should change <generator class="assigned"/> to update yea and what else did you say so i understand

    Mark
     
    Paul Sturrock
    Bartender
    Posts: 10336
    Hibernate Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    You have a property called Price that is mapped to the price column. You have also mapped this column as the primary key. Remove the property mapping and everything should work.
     
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    ok i removed property


    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

    <hibernate-mapping>
    <class name="roseindia.tutorial.hibernate.Contact" table="cost">
    <id name="Price" type="Varchar" column="Price" >
    <generator class="update"/>
    </id>


    <column name="Price" />
    </property>
    <property name="Tax">
    <column name="Tax"/>
    </property>
    <property name="Total">
    <column name="Total"/>
    </property>
    </class>
    </hibernate-mapping>

    but then got error that it could not find class

    SEVERE: Error parsing XML: XML InputStream(14) The element type "class" must be terminated by the matching end-tag "</class>".
    org.hibernate.MappingException: Could not read mappings from resource: roseindia/tutorial/hibernate/Contact.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:485)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
    at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:23)
    Caused by: org.hibernate.MappingException: Could not parse mapping document in input stream
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:431)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
    ... 7 more
    Caused by: org.dom4j.DocumentException: Error on line 14 of document : The element type "class" must be terminated by the matching end-tag "</class>". Nested exception: The element type "class" must be terminated by the matching end-tag "</class>".
    at org.dom4j.io.SAXReader.read(SAXReader.java:482)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:422)
    ... 8 more
    Could not read mappings from resource: roseindia/tutorial/hibernate/Contact.hbm.xml

    I guess i done it wrong, did i? Sorry i dont quite understand it fully
     
    Paul Sturrock
    Bartender
    Posts: 10336
    Hibernate Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    SEVERE: Error parsing XML: XML InputStream(14) The element type "class" must be terminated by the matching end-tag "</class>".


    Your mapping file is not valid XML. XML must be well formed; all opening elements must be closed. You have only removed part of the price property element. Remove it completely.
     
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Sorry again, ive a good feeling that we are nearly there,

    i changed the file to;

    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

    <hibernate-mapping>
    <class name="roseindia.tutorial.hibernate.Contact" table="cost">
    <id name="Price" type="varchar" column="Price" >
    <generator class="update"/>
    </id>
    <property name="Tax">
    <column name="Tax"/>
    </property>
    <property name="Total">
    <column name="Total"/>
    </property>
    </class>
    </hibernate-mapping>

    which corrected the problem, but the compiler does not understand what
    <id name="Price" type="varchar" column="Price" >

    type ="varchar" is.

    error: Could not determine type for: varchar, for columns: [org.hibernate.mapping.Column(Price)]

    i tryed upper and lower case, then kinda ran out of ideas, does not appear to be an instruction part of hivernate that tells ya what types it understands?
     
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    ok i changed varchar to string and solved prob, so i assume that must match the variables in the class and not the database. and it gave more errors but i think they are just missing classes so ill carry on and leave ya know what the story is
     
    Paul Sturrock
    Bartender
    Posts: 10336
    Hibernate Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    so i assume that must match the variables in the class and not the database


    Yes. It is the responsibility of the Dialect to map between Java types and SQL data types, so you don't need this info in the mapping file.
     
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    oh so i could remove type="string" from the mapping file altogether.

    and oh yea ofcourse i have new errors, ive never in my life gone from one error to another so many times in a tutorial typr prog, then again im really learning alot.

    error:
    org.hibernate.MappingException: could not instantiate id generator
    at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:97)
    at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:182)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
    at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:23)
    Caused by: org.hibernate.MappingException: could not interpret id generator strategy: update
    at org.hibernate.id.IdentifierGeneratorFactory.getIdentifierGeneratorClass(IdentifierGeneratorFactory.java:108)
    at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:91)
    ... 4 more
    could not instantiate id generator

    What ya think?
     
    Paul Sturrock
    Bartender
    Posts: 10336
    Hibernate Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    oh so i could remove type="string" from the mapping file altogether.


    No. You need to include the type of the property, but you should not be including the SQL datatype. After all, one of Hibernate's purposes in life is to abstract away the various vagueries of vendor specific data types. If you had to include the data type in your mapping, you would loose some of that abstraction.


    You will need to give your ID a valid generator class as per the Hibernate documentation. "update" is not a supported primary key generation strategy.
     
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    ah great stuff i understand.

    Ok for the life of me i cant seem to find this .jar to download.
    the error is: Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/Synchronization.

    Do you know what api its from?
     
    Paul Sturrock
    Bartender
    Posts: 10336
    Hibernate Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    That is part of JTA, with forms part of J2EE. Are you using JTA as your transaction mechanism? If so you'll need j2ee.jar in your classpath too.
     
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    to be honest i dont believe i am using that as a transaction mechanism, i only have 2 class files with the intention of updating a database with 3 attributes using the set methods of my class. Very simple stuff i though id have it done hour and half tops, theres alot of configuration to get through i must say.
    Sure ill include the jar and see what happens. Thansk for all your help so far, very good
     
    Ranch Hand
    Posts: 44
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hi Mark,
    The tutorial at the hibernate site is very good.I was able to execute the first example very easily.May be you can take look at this tutorial -

    http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html

    Regarding your jar problem,Synchronization class file is found in jta.jar

    All the required jars for hibernate come bundled in one jar file.This can be downloaded from here

    http://hibernate.org/6.html

    You can download either one of the jar under Hibernate Core package.
    Hope this helps.

    regards,
    kumari
     
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hey Paul and Kumari,

    Thanks for all the input and help, great stuff, i eventually got what i thought all the errors and stuff and it compiled and executed as it was supposed to but im afraid it still contained exceptions and did not update the database.


    error:
    24-Aug-2006 09:39:44 org.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 3.1.3
    24-Aug-2006 09:39:44 org.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    24-Aug-2006 09:39:44 org.hibernate.cfg.Environment <clinit>
    INFO: using CGLIB reflection optimizer
    24-Aug-2006 09:39:44 org.hibernate.cfg.Environment <clinit>
    INFO: using JDK 1.4 java.sql.Timestamp handling
    24-Aug-2006 09:39:44 org.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    24-Aug-2006 09:39:44 org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    24-Aug-2006 09:39:45 org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource: roseindia/tutorial/hibernate/Contact.hbm.xml
    24-Aug-2006 09:39:45 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: roseindia.tutorial.hibernate.Contact -> cost
    24-Aug-2006 09:39:45 org.hibernate.cfg.Configuration doConfigure
    INFO: Configured SessionFactory: null
    24-Aug-2006 09:39:45 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Using Hibernate built-in connection pool (not for production use!)
    24-Aug-2006 09:39:45 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Hibernate connection pool size: 10
    24-Aug-2006 09:39:45 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: autocommit mode: false
    24-Aug-2006 09:39:45 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/test
    24-Aug-2006 09:39:45 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: connection properties: {user=root, password=****}
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: RDBMS: MySQL, version: 4.1.16-nt
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.13 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )
    24-Aug-2006 09:39:45 org.hibernate.dialect.Dialect <init>
    INFO: Using dialect: org.hibernate.dialect.MySQLDialect
    24-Aug-2006 09:39:45 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
    INFO: Using default transaction strategy (direct JDBC transactions)
    24-Aug-2006 09:39:45 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
    INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic flush during beforeCompletion(): disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic session close at end of transaction: disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch size: 15
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch updates for versioned data: disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Scrollable result sets: enabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC3 getGeneratedKeys(): enabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Connection release mode: auto
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Maximum outer join fetch depth: 2
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Default batch fetch size: 1
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Generate SQL with comments: disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Order SQL updates by primary key: disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
    INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    24-Aug-2006 09:39:45 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
    INFO: Using ASTQueryTranslatorFactory
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query language substitutions: {}
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Second-level cache: enabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query cache: disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory createCacheProvider
    INFO: Cache provider: org.hibernate.cache.EhCacheProvider
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Optimize cache for minimal puts: disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Structured second-level cache entries: disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Echoing all SQL to stdout
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Statistics: disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Deleted entity synthetic identifier rollback: disabled
    24-Aug-2006 09:39:45 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Default entity-mode: pojo
    24-Aug-2006 09:39:45 org.hibernate.impl.SessionFactoryImpl <init>
    INFO: building session factory
    24-Aug-2006 09:39:45 net.sf.ehcache.config.ConfigurationFactory parseConfiguration
    WARNING: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/ehcache/ehcache-1.2.2/ehcache-1.2.2.jar!/ehcache-failsafe.xml
    24-Aug-2006 09:39:45 org.hibernate.proxy.CGLIBLazyInitializer getProxyFactory
    SEVERE: CGLIB Enhancement failed: roseindia.tutorial.hibernate.Contact
    java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
    at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)
    at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
    at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
    at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
    at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
    at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
    at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
    at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
    at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
    at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
    at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:216)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
    at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:23)
    24-Aug-2006 09:39:45 org.hibernate.tuple.PojoEntityTuplizer buildProxyFactory
    WARNING: could not create proxy factory for:roseindia.tutorial.hibernate.Contact
    org.hibernate.HibernateException: CGLIB Enhancement failed: roseindia.tutorial.hibernate.Contact
    at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:132)
    at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
    at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
    at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
    at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
    at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
    at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:216)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
    at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:23)
    Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
    at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)
    at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
    at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
    at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
    at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
    ... 12 more
    24-Aug-2006 09:39:45 org.hibernate.impl.SessionFactoryObjectFactory addInstance
    INFO: Not binding factory to JNDI, no JNDI name configured
    24-Aug-2006 09:39:45 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: Running hbm2ddl schema update
    24-Aug-2006 09:39:45 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: fetching database metadata
    24-Aug-2006 09:39:45 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: updating schema
    24-Aug-2006 09:39:46 org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: table found: test.cost
    24-Aug-2006 09:39:46 org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: columns: [total, price, tax]
    24-Aug-2006 09:39:46 org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: foreign keys: []
    24-Aug-2006 09:39:46 org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: indexes: [primary]
    24-Aug-2006 09:39:46 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: schema update complete
    b
    c
    Inserting Record
    Done
    Hibernate: insert into cost (Tax, Total, Price) values (?, ?, ?)


    as you can see its alot of information, i may just go and try the hibernate tutorial. This one seems to be a lost cause, what ya think?

    Mark
     
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    i added some more jars that the hibernate example wanted and got this result,

    a
    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.
    b
    c
    Inserting Record
    Done
    Hibernate: insert into cost (Tax, Total, Price) values (?, ?, ?)


    dont mind the a b c i just put them in earlier to see how far the program was getting.

    Any advice?
     
    Paul Sturrock
    Bartender
    Posts: 10336
    Hibernate Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.


    This warning is telling you you have not configured log4j correctly. See the documentation on the log4j websiteto see what to do.
     
    Mark Hughes
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hey,
    Ok i removed log4j from the project as i dont believe it depends on it to work and im not using it anyway, so one last thing before i give up, my other post of the hugely massive message. What do you make of that, the post directly before the log4j error.

    Sorry again, i know its kinda getting ridiculous now.

    Mark
     
    Ranch Hand
    Posts: 190
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
    log4j:WARN Please initialize the log4j system properly.



    -------------- Ignore everything above this, it has nothing to do with hibernate and will not affect your program execution---------------------


    b
    c
    Inserting Record
    Done
    Hibernate: insert into cost (Tax, Total, Price) values (?, ?, ?)



    Looks like the program worked to me. The insert was a success. I cant see your database and tell if the information was actually commited though.
     
    kumari Jain
    Ranch Hand
    Posts: 44
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The log4j warnings could possibly be removed if

    1.Have a log4j.properties file
    2.Make sure the above properties file is in the class path

    regards,
    kumari
     
    reply
      Bookmark Topic Watch Topic
    • New Topic