-->
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.  [ 7 posts ] 
Author Message
 Post subject: compiler problem
PostPosted: Thu Feb 21, 2008 8:02 am 
Newbie

Joined: Thu Feb 21, 2008 7:43 am
Posts: 3
Location: Skopje macedonia
Hallo everybody,

Hibernate version 3.2.6
Eclipse Europa 3.3.1
Java 1.5.0
Apache Ant 1.7.0

I'm new in hibernate and I'm trying to start from hibernate tutorial and to make first example in documentation, but at 1.2.6. Loading and storing objects from hibernate documentation I have problem:

[javac] Compiling 2 source files to D:\MyProjects\HibernateTest\bin
[javac] D:\MyProjects\HibernateTest\src\util\HibernateUtil.java:3: package org.hibernate does not exist
[javac] import org.hibernate.*;
[javac] ^
[javac] D:\MyProjects\HibernateTest\src\util\HibernateUtil.java:4: package org.hibernate.cfg does not exist
[javac] import org.hibernate.cfg.*;
[javac] ^
[javac] D:\MyProjects\HibernateTest\src\util\HibernateUtil.java:8: cannot find symbol
[javac] symbol : class SessionFactory
[javac] location: class util.HibernateUtil
[javac] private static final SessionFactory sessionFactory;
[javac] ^
[javac] D:\MyProjects\HibernateTest\src\util\HibernateUtil.java:26: cannot find symbol
[javac] symbol : class SessionFactory
[javac] location: class util.HibernateUtil
[javac] public static SessionFactory getSessionFactory() {
[javac] ^
[javac] D:\MyProjects\HibernateTest\src\util\HibernateUtil.java:14: cannot find symbol
[javac] symbol : class Configuration
[javac] location: class util.HibernateUtil
[javac] sessionFactory = new Configuration().configure().buildSessionFactory();
[javac] ^
[javac] 5 errors

BUILD FAILED
D:\MyProjects\HibernateTest\build.xml:45: Compile failed; see the compiler error output for details.



Please help me.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 9:15 am 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
Did you add the hibernate3.jar and other dependent libraries from hibernate download to your classpath?


Top
 Profile  
 
 Post subject: re
PostPosted: Thu Feb 21, 2008 9:38 am 
Newbie

Joined: Thu Feb 21, 2008 7:43 am
Posts: 3
Location: Skopje macedonia
Yes all of 9 basic libraryes I put in classpath:

antlr.jar
cglib.jar
asm.jar
asm-attrs.jars
commons-collections.jar
commons-logging.jar
hibernate3.jar
jta.jar
dom4j.jar
log4j.jar


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 10:06 am 
Newbie

Joined: Thu Feb 21, 2008 8:39 am
Posts: 15
Could you show us the build.xml?


Top
 Profile  
 
 Post subject: re
PostPosted: Thu Feb 21, 2008 10:07 am 
Newbie

Joined: Thu Feb 21, 2008 7:43 am
Posts: 3
Location: Skopje macedonia
<project name="Testhibernate" default="compile">

<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/bin"/>
<property name="librarydir" value="${basedir}"/>

<path id="libraries">
<fileset dir="${librarydir}">
<include name="*.jar"/>
</fileset>
</path>

<target name="clean">
<delete dir="${targetdir}"/>
<mkdir dir="${targetdir}"/>
</target>

<target name="compile" depends="clean, copy-resources">
<javac srcdir="${sourcedir}"
destdir="${targetdir}"
classpathref="libraries"/>
</target>

<target name="copy-resources">
<copy todir="${targetdir}">
<fileset dir="${sourcedir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>

<target name="run" depends="compile">
<java fork="true" classname="events.EventManager" classpathref="libraries">
<classpath path="${targetdir}"/>
<arg value="${action}"/>
</java>
</target>


</project>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 10:35 am 
Newbie

Joined: Thu Feb 21, 2008 8:39 am
Posts: 15
I have never used the classpathref but looks good(i take note). what i do in my ant projects is use classpath inside the javac task like

<!-- compile sources -->
<javac srcdir="${servlet.src}"
destdir="${servlet.dist}"
debug="on" target="1.5"
fork="yes"
executable="${.....}"
>
<classpath>
<fileset dir="${servlet.general_lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${project.root}/dist/dal.jar"/>
<pathelement path="${project.root}/mas/dist/gatewayAgent.jar"/>
<pathelement path="${project.root}/mas/dist/jadeOntology.jar"/>
<pathelement path="${project.root}/mas/dist/agentGenerator.jar"/>
</classpath>
</javac>

and works.

But is better your use of classpathref, you could try to run ant with -d option (debug mode) and add to your ant task debug and debuglevel take a look at the ant manual:

http://ant.apache.org/manual/CoreTasks/javac.html

You could also check with <echo>${targetdir}</echo> if your references are correct, some times this is the key.

i hope it helps.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 10:37 am 
Newbie

Joined: Thu Feb 21, 2008 8:39 am
Posts: 15
i have never used the classpathref but looks good(i take note). what i do in my ant projects is use classpath inside the javac task like

<!-- compile sources -->
<javac srcdir="${servlet.src}"
destdir="${servlet.dist}"
debug="on" target="1.5"
fork="yes"
executable="${.....}"
>
<classpath>
<fileset dir="${servlet.general_lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${project.root}/dist/dal.jar"/>
<pathelement path="${project.root}/mas/dist/gatewayAgent.jar"/>
<pathelement path="${project.root}/mas/dist/jadeOntology.jar"/>
<pathelement path="${project.root}/mas/dist/agentGenerator.jar"/>
</classpath>
</javac>

and works.

But is better your use of classpathref, you could try to run ant with -d option (debug mode) and add to your ant task debug and debuglevel take a look at the ant manual:

http://ant.apache.org/manual/CoreTasks/javac.html

With these options ant will output to the console all the debug (usefull) information, check if you are loading all of the libraries you need.

You could also check with <echo>${targetdir}</echo> if your references are correct, some times this is the key.

i hope it helps.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.