-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: java.lang.NoClassDefFoundError: antlr/ANTLRException
PostPosted: Tue Feb 28, 2006 10:33 pm 
Beginner
Beginner

Joined: Mon Feb 27, 2006 11:16 am
Posts: 25
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]


Top
 Profile  
 
 Post subject: Dependencies
PostPosted: Tue Feb 28, 2006 11:45 pm 
Regular
Regular

Joined: Wed Feb 15, 2006 9:09 pm
Posts: 76
Hibernate has a number of dependencies. They're jars that need to be available on the classpath when you run your app. See this: Chapter 1. Introduction to Hibernate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.