Hello-
The following is the error code at the prompt. The version of the software used is given at the end alongwith the code snippet.
-------------------------------
C:\hibernate-2.1>java -cp "lib/ant-1.5.3.jar;lib/ant-optional-1.5.3.jar;lib/juni
t-3.8.1.jar;lib/xerces-2.4.0.jar;C:\bea\jdk131/lib/tools.jar" org.apache.tools.a
nt.Main -Ddriver.jar=lib\mysql.jar empdet
Buildfile: build.xml
A nonfatal internal JIT (3.00.078(x)) error 'chgTarg: Conditional' has occurred
in :
'org/apache/tools/ant/Project.fireMessageLoggedEvent (Lorg/apache/tools/ant/Bu
ildEvent;Ljava/lang/String;I)V': Interpreting method.
Please report this error in detail to
http://java.sun.com/cgi-bin/bugreport.cg
i
A nonfatal internal JIT (3.00.078(x)) error 'chgTarg: Conditional' has occurred
in :
'org/apache/tools/ant/Project.addCreatedTask (Ljava/lang/String;Lorg/apache/to
ols/ant/Task;)V': Interpreting method.
Please report this error in detail to
http://java.sun.com/cgi-bin/bugreport.cg
i
[taskdef] Could not load definitions from resource clovertasks. It could not b
e found.
empdet:
[echo] remember to place your JDBC driver in the lib directory
java.lang.IllegalMonitorStateException: current thread not owner
at org.apache.tools.ant.taskdefs.StreamPumper.run(Compiled Code)
at java.lang.Thread.run(Thread.java:479)
java.lang.IllegalMonitorStateException: current thread not owner
at org.apache.tools.ant.taskdefs.StreamPumper.run(Compiled Code)
at java.lang.Thread.run(Thread.java:479)
BUILD FAILED
file:C:/hibernate-2.1/build.xml:554: Java returned: 1
Total time: 3 seconds
--------------------
version information
---------------
mysql version:2.5
tomcat version:4
hibernate version: 2.1
------------------
java code
-----------------
package net.sf.hibernate.examples.quickstart;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
import net.sf.hibernate.examples.quickstart.Cat
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (HibernateException ex) {
throw new RuntimeException("Exception building SessionFactory: " + ex.getMessage());
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession() throws HibernateException {
Session s = (Session) session.get();
// Open a new Session, if this Thread has none yet
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
public static void closeSession() throws HibernateException {
Session s = (Session) session.get();
session.set(null);
if (s != null)
s.close();
}
public static void main(String args[])throws HibernateException {
Session session1 = HibernateUtil.currentSession();
Transaction tx1= session1.beginTransaction();
Cat princess = new Cat();
princess.setName("Princess");
princess.setSex('F');
princess.setWeight(7.4f);
session1.save(princess);
tx1.commit();
HibernateUtil.closeSession();
}
}
---------------------
Please provide pointers to the solutions.
regards,
Amitabh.