You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by zulhisham abu nawar <ij...@gmail.com> on 2006/02/14 11:18:58 UTC

cocoon&hibernate tutorial

hi..
now i'm in process to get hibernate and cocoon run together...i found
some documentation at wiki. I try to follow cocoon and hibernate
tutorial. I've problem when i try to compile PersistenceFactory.java
and HibernateFactory.java

the errors:
javac PersistenceFactory.java
PersistenceFactory.java:3: package
org.apache.avalon.framework.component does not exist
import org.apache.avalon.framework.component.Component;
                                             ^
PersistenceFactory.java:5: cannot resolve symbol
symbol  : class Component
location: interface org.test.PersistenceFactory
public interface PersistenceFactory extends Component {
                                            ^
PersistenceFactory.java:8: package net.sf.hibernate does not exist
        public net.sf.hibernate.Session createSession();
                               ^
3 errors

>From the errors, it look like avalon package not exist in my
directory. Then i look into /WEB-INF/classes and don't have folder for
avalon. So my question is where the imported avalon classess from
(from lib or /classes/avalon...). Cause no sure what im doing, i try
to extarct avalon-framework-api-4.3.jar and put it in
/classes/org/avalon and so. But i still got the same errors

any ideas??

req:
cocoon 2.1.8
tomcat 5.0.28
hibernate 3.1
avalon-framework-api-4.3.jar

--
::)- mister ijoi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: cocoon&hibernate tutorial

Posted by Johannes Textor <jc...@gmx.de>.
hi abu,

this is more a basic java question since you did not yet get to the
point where the "real" problems arise, but let's see ...
First of all, are you using Hiberrnate 2 or 3 ? Might finally update the
tutorial since I don't know how many people still use Hibernate 2 ...
Next, if your java file references classes from jar files, those jars
need to be in your classpath. (quote from tutorial: "Compile these two
files. I needed the following jars in my classpath:
avalon-framework-api-4.1.5.jar, excalibur-datasource-1.1.1.jar, and
hibernate2.jar.")

If you want to write an app with cocoon and hibernate, you are not going
to get really far if you don't know what the classpath is. So I suggest
you read e.g.
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
or similar and try again.

Regards,
Johannes


zulhisham abu nawar schrieb:

> i'm back ;-)...now i'm using cocoon 2.1.7, hibernate 2.1.6 (same like
> tutorial). I'm still got the errors when i compiled file.java...
>
> Through this tutorial, i should download hibernate and copy some
> files.jar to /WEB-INF/lib. Here should i build hibernate file??Then
> for files.java (PersistenceFactory.java n HibernateFactory.java) i put
> at /WEB-INF/classes/hib. From tutorial i should copy
> avalon-framework-api.jar, excalibur-datasource.jar to WEB-INF/lib
> folder and compile java files..So my problem is the java file cant
> compiled and the errrors:
>
> mac:/usr/opt/tomcat/jakarta-tomcat-5.0.28/webapps/cocoon/WEB-INF/classes/hib
> root# javac PersistenceFactory.java
> PersistenceFactory.java:8: package
> org.apache.avalon.framework.component does not exist
> import org.apache.avalon.framework.component.*;
> ^
> PersistenceFactory.java:10: cannot resolve symbol
> symbol  : class Component
> location: interface hib.PersistenceFactory
> public interface  PersistenceFactory extends Component {
>                                              ^
> PersistenceFactory.java:13: package net.sf.hibernate does not exist
>     public net.sf.hibernate.Session createSession();
>                            ^
> 3 errors
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: cocoon&hibernate tutorial

Posted by zulhisham abu nawar <ij...@gmail.com>.
i'm back ;-)...now i'm using cocoon 2.1.7, hibernate 2.1.6 (same like
tutorial). I'm still got the errors when i compiled file.java...

Through this tutorial, i should download hibernate and copy some
files.jarto /WEB-INF/lib. Here should i build hibernate file??Then for
files.java (PersistenceFactory.java n HibernateFactory.java) i put at
/WEB-INF/classes/hib. From tutorial i should copy avalon-framework-api.jar,
excalibur-datasource.jar to WEB-INF/lib folder and compile java files..So my
problem is the java file cant compiled and the errrors:

mac:/usr/opt/tomcat/jakarta-tomcat-5.0.28/webapps/cocoon/WEB-INF/classes/hib
root# javac PersistenceFactory.java
PersistenceFactory.java:8: package
org.apache.avalon.framework.componentdoes not exist
import org.apache.avalon.framework.component.*;
^
PersistenceFactory.java:10: cannot resolve symbol
symbol  : class Component
location: interface hib.PersistenceFactory
public interface  PersistenceFactory extends Component {
                                             ^
PersistenceFactory.java:13: package net.sf.hibernate does not exist
    public net.sf.hibernate.Session createSession();
                           ^
3 errors

On 2/14/06, Thomas Lutz <ma...@gmx.at> wrote:
>
> sorry for the noise, rereading your post, I think i replied too short.
>
> you have to include the avalon jars in your build path. this is hast to
> be done in your ide and in your build file. so search for configure
> build path in your ide, adapt my build.xml to your ant script, or use
> the classpath argument of the javac to reference to the avalong jar (in
> /WEB-INF/lib, that's right).


actually i'm just using VI in my mac os X

usually you can't just unzip a jar and take one class file out, much too
> much dependencies :-)
>
> hth better :-),
> tom
>
> Thomas Lutz wrote:
> > this is a part of my build file which should fit your needs, too.
> > (it's a bit too much, as i use javaflow, just comment the not needed
> > jars)
> >
> >    <javac srcdir="${src.server.war.dir}"
> > destdir="${build.server.war.ant.dir}" debug="on">
> >            <classpath>
> >                <path refid="build.path"/>
> >                <pathelement
> > location="${lib.dir}/cocoon/avalon-framework-api-4.3.jar"/>
> >                <pathelement
> > location="${lib.dir}/cocoon/avalon-framework-impl-4.3.jar"/>
> >                <pathelement
> > location="${lib.dir}/cocoon/avalon-logkit-2.1.jar"/>
> >                <pathelement
> > location="${lib.dir}/cocoon/excalibur-datasource-2.1.jar"/>
> >                <pathelement
> > location="${lib.dir}/cocoon/excalibur-pool-api-2.1.jar"/>
> >                <pathelement
> > location="${lib.dir}/cocoon/cocoon-javaflow-block.jar"/>
> >                <pathelement
> > location="${lib.dir}/cocoon/cocoon-2.1.8.jar"/>
> >                <pathelement
> > location="${lib.dir}/cocoon/commons-lang-2.1.jar"/>
> >            </classpath>
> >        </javac>
> >
> > hth,
> > tom
> >
> > zulhisham abu nawar wrote:
> >> hi..
> >> now i'm in process to get hibernate and cocoon run together...i found
> >> some documentation at wiki. I try to follow cocoon and hibernate
> >> tutorial. I've problem when i try to compile PersistenceFactory.java
> >> and HibernateFactory.java
> >>
> >> the errors:
> >> javac PersistenceFactory.java
> >> PersistenceFactory.java:3: package
> >> org.apache.avalon.framework.component does not exist
> >> import org.apache.avalon.framework.component.Component;
> >>                                              ^
> >> PersistenceFactory.java:5: cannot resolve symbol
> >> symbol  : class Component
> >> location: interface org.test.PersistenceFactory
> >> public interface PersistenceFactory extends Component {
> >>                                             ^
> >> PersistenceFactory.java:8: package net.sf.hibernate does not exist
> >>         public net.sf.hibernate.Session createSession();
> >>                                ^
> >> 3 errors
> >>
> >> >From the errors, it look like avalon package not exist in my
> >> directory. Then i look into /WEB-INF/classes and don't have folder for
> >> avalon. So my question is where the imported avalon classess from
> >> (from lib or /classes/avalon...). Cause no sure what im doing, i try
> >> to extarct avalon-framework-api-4.3.jar and put it in
> >> /classes/org/avalon and so. But i still got the same errors
> >>
> >> any ideas??
> >>
> >> req:
> >> cocoon 2.1.8
> >> tomcat 5.0.28
> >> hibernate 3.1
> >> avalon-framework-api-4.3.jar
> >>
> >> --
> >> ::)- mister ijoi
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >> For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >>
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


--
::)- mister ijoi

Re: cocoon&hibernate tutorial

Posted by Thomas Lutz <ma...@gmx.at>.
sorry for the noise, rereading your post, I think i replied too short.

you have to include the avalon jars in your build path. this is hast to 
be done in your ide and in your build file. so search for configure 
build path in your ide, adapt my build.xml to your ant script, or use 
the classpath argument of the javac to reference to the avalong jar (in 
/WEB-INF/lib, that's right).
usually you can't just unzip a jar and take one class file out, much too 
much dependencies :-)

hth better :-),
tom

Thomas Lutz wrote:
> this is a part of my build file which should fit your needs, too. 
> (it's a bit too much, as i use javaflow, just comment the not needed 
> jars)
>
>    <javac srcdir="${src.server.war.dir}" 
> destdir="${build.server.war.ant.dir}" debug="on">
>            <classpath>
>                <path refid="build.path"/>
>                <pathelement 
> location="${lib.dir}/cocoon/avalon-framework-api-4.3.jar"/>
>                <pathelement 
> location="${lib.dir}/cocoon/avalon-framework-impl-4.3.jar"/>
>                <pathelement 
> location="${lib.dir}/cocoon/avalon-logkit-2.1.jar"/>
>                <pathelement 
> location="${lib.dir}/cocoon/excalibur-datasource-2.1.jar"/>
>                <pathelement 
> location="${lib.dir}/cocoon/excalibur-pool-api-2.1.jar"/>
>                <pathelement 
> location="${lib.dir}/cocoon/cocoon-javaflow-block.jar"/>
>                <pathelement 
> location="${lib.dir}/cocoon/cocoon-2.1.8.jar"/>
>                <pathelement 
> location="${lib.dir}/cocoon/commons-lang-2.1.jar"/>
>            </classpath>
>        </javac>
>
> hth,
> tom
>
> zulhisham abu nawar wrote:
>> hi..
>> now i'm in process to get hibernate and cocoon run together...i found
>> some documentation at wiki. I try to follow cocoon and hibernate
>> tutorial. I've problem when i try to compile PersistenceFactory.java
>> and HibernateFactory.java
>>
>> the errors:
>> javac PersistenceFactory.java
>> PersistenceFactory.java:3: package
>> org.apache.avalon.framework.component does not exist
>> import org.apache.avalon.framework.component.Component;
>>                                              ^
>> PersistenceFactory.java:5: cannot resolve symbol
>> symbol  : class Component
>> location: interface org.test.PersistenceFactory
>> public interface PersistenceFactory extends Component {
>>                                             ^
>> PersistenceFactory.java:8: package net.sf.hibernate does not exist
>>         public net.sf.hibernate.Session createSession();
>>                                ^
>> 3 errors
>>
>> >From the errors, it look like avalon package not exist in my
>> directory. Then i look into /WEB-INF/classes and don't have folder for
>> avalon. So my question is where the imported avalon classess from
>> (from lib or /classes/avalon...). Cause no sure what im doing, i try
>> to extarct avalon-framework-api-4.3.jar and put it in
>> /classes/org/avalon and so. But i still got the same errors
>>
>> any ideas??
>>
>> req:
>> cocoon 2.1.8
>> tomcat 5.0.28
>> hibernate 3.1
>> avalon-framework-api-4.3.jar
>>
>> -- 
>> ::)- mister ijoi
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
>>   
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: cocoon&hibernate tutorial

Posted by Thomas Lutz <ma...@gmx.at>.
this is a part of my build file which should fit your needs, too. (it's 
a bit too much, as i use javaflow, just comment the not needed jars)

    <javac srcdir="${src.server.war.dir}" 
destdir="${build.server.war.ant.dir}" debug="on">
            <classpath>
                <path refid="build.path"/>
                <pathelement 
location="${lib.dir}/cocoon/avalon-framework-api-4.3.jar"/>
                <pathelement 
location="${lib.dir}/cocoon/avalon-framework-impl-4.3.jar"/>
                <pathelement 
location="${lib.dir}/cocoon/avalon-logkit-2.1.jar"/>
                <pathelement 
location="${lib.dir}/cocoon/excalibur-datasource-2.1.jar"/>
                <pathelement 
location="${lib.dir}/cocoon/excalibur-pool-api-2.1.jar"/>
                <pathelement 
location="${lib.dir}/cocoon/cocoon-javaflow-block.jar"/>
                <pathelement location="${lib.dir}/cocoon/cocoon-2.1.8.jar"/>
                <pathelement 
location="${lib.dir}/cocoon/commons-lang-2.1.jar"/>
            </classpath>
        </javac>

hth,
tom

zulhisham abu nawar wrote:
> hi..
> now i'm in process to get hibernate and cocoon run together...i found
> some documentation at wiki. I try to follow cocoon and hibernate
> tutorial. I've problem when i try to compile PersistenceFactory.java
> and HibernateFactory.java
>
> the errors:
> javac PersistenceFactory.java
> PersistenceFactory.java:3: package
> org.apache.avalon.framework.component does not exist
> import org.apache.avalon.framework.component.Component;
>                                              ^
> PersistenceFactory.java:5: cannot resolve symbol
> symbol  : class Component
> location: interface org.test.PersistenceFactory
> public interface PersistenceFactory extends Component {
>                                             ^
> PersistenceFactory.java:8: package net.sf.hibernate does not exist
>         public net.sf.hibernate.Session createSession();
>                                ^
> 3 errors
>
> >From the errors, it look like avalon package not exist in my
> directory. Then i look into /WEB-INF/classes and don't have folder for
> avalon. So my question is where the imported avalon classess from
> (from lib or /classes/avalon...). Cause no sure what im doing, i try
> to extarct avalon-framework-api-4.3.jar and put it in
> /classes/org/avalon and so. But i still got the same errors
>
> any ideas??
>
> req:
> cocoon 2.1.8
> tomcat 5.0.28
> hibernate 3.1
> avalon-framework-api-4.3.jar
>
> --
> ::)- mister ijoi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: cocoon&hibernate tutorial

Posted by Laurent Perez <ha...@gmail.com>.
> PersistenceFactory.java:8: package net.sf.hibernate does not exist
>         public net.sf.hibernate.Session createSession();

net.sf.* is for hibernate2, if you use hibernate3 it's org.hibernate.*


laurent

--
<a href="http://in-pocket.blogspot.com">http://in-pocket.blogspot.com
- Mobile world, technology and more</a>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org