| To Whom It May Concern:
 I am using  hibernate3.jar, Tomcat 5.5, Microsoft SQL 2000. I got the error
 java.lang.NoClassDefFoundError: antlr/ANTLRException
 when I ran the following code:
 
 package com.oreilly.hh;
 
 import org.hibernate.cfg.*;
 import org.hibernate.*;
 
 
 import java.sql.Time;
 import java.util.Date;
 
 /**
 * Create sample data, letting Hibernate persist it for us.
 */
 public class CreateTest {
 
 public static void main(String args[]) throws Exception {
 // Create a configuration based on the properties file we've put
 // in the standard place.
 Configuration config = new Configuration();
 
 // Tell it about the classes we want mapped, taking advantage of
 // the way we've named their mapping documents.
 config.addClass(Track.class);
 
 // Get the session factory we can use for persistence
 SessionFactory sessionFactory = config.buildSessionFactory();
 
 // Ask for a session using the JDBC information we've configured
 Session session = sessionFactory.openSession();
 Transaction tx = null;
 try {
 // Create some data and persist it
 tx = session.beginTransaction();
 
 Track track = new Track("Russian Trance",
 "vol2/album610/track02.mp3",
 Time.valueOf("00:03:30"), new Date(),
 (short)0);
 session.save(track);
 
 track = new Track("Video Killed the Radio Star",
 "vol2/album611/track12.mp3",
 Time.valueOf("00:03:49"), new Date(),
 (short)0);
 session.save(track);
 
 
 track = new Track("Gravity's Angel",
 "vol2/album175/track03.mp3",
 Time.valueOf("00:06:06"), new Date(),
 (short)0);
 session.save(track);
 
 // We're done; make our changes permanent
 tx.commit();
 
 } catch (Exception e) {
 if (tx != null) {
 // Something went wrong; discard all partial changes
 tx.rollback();
 }
 throw e;
 } finally {
 // No matter what, close the session
 session.close();
 }
 
 // Clean up after ourselves
 sessionFactory.close();
 }
 }
 
 
 I was trying to convert hibernate 2 java code to hibernate 3.
 
 Here is my hibernate.properties file:
 hibernate.dialect=org.hibernate.dialect.SQLServerDialect
 hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
 hibernate.connection.url=jdbc:jtds:sqlserver://al:1433/Albert
 hibernate.connection.username=sa
 hibernate.connection.password=mychau1
 
 Can anybody please give me a hint why I am getting the above error.
 
 Thank You.
 
 Yours,
 
 Desperate.
 
 [code][/code]
 
 
 |