You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by John S <cu...@angelsbaseball.com> on 2003/04/30 04:11:15 UTC

log4j, tapestry and hibernate

  I'm running into the following exception:

org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JCategoryLog does not
implement Log

  when writing a page in Tapestry that uses Hibernate 2.0.  Anyone encounter this before?  I'm new to Tapestry and Hibernate so I wouldn't be surprised if I'm not doing things right.  Btw, is finishLoad the right place to init a list for a foreach component?
  Thanks,

        John


AdminTop.page:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
  "-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
  "http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">;

<page-specification class="AdminTop">

  <bean name="c" class="Country"/>

  <component id="foreachCountry" type="Foreach">
    <binding name="source" expression="countryList"/>
    <binding name="value" expression="country"/>
  </component>

  <component id="insertLoopName" type="Insert">
    <binding name="value" expression="country.name"/>
  </component>

  <component id="insertLoopAbbr" type="Insert">
    <binding name="value" expression="country.abbr"/>
  </component>

</page-specification>



AdminTop.java:
public class AdminTop extends BasePage
{
  public Country country = null ;
  public Iterator countryList = null ;
  public int first = 0 ;

  public void finishLoad(IRequestCycle cycle,
                         IPageLoader loader,
                         ComponentSpecification specification)
  {
    try {
      Configuration config = new Configuration() ;
      config.addClass(Country.class) ;
      SessionFactory sf = config.buildSessionFactory() ;
      Session session = sf.openSession() ;

      List countries = session.find("from country in class Country") ;
      countryList = countries.iterator() ;
    } catch (Exception e) {
      e.printStackTrace() ;
    }
    super.finishLoad(cycle, loader, specification) ;
  }

  public Iterator getCountryList()
  {
    return countryList ;
  }

  public Country getCountry()
  {
    return country ;
  }
}




Re: log4j, tapestry and hibernate

Posted by Eric Everman <ev...@precedadesign.com>.
I'm guessing here, but I think your problem sounds like a classloader 
issue.  Is it possible that CommonsLogging and/or Log4J are in both the 
Tomcat/commons/lib directory and in you WEB-INF/lib directory and/or marked 
as part of an include project under Eclipse?  I would ensure these 
libraries are included one time only, and that they are both included in 
the same way.

As for where to load from the db, please post this as a different question 
- I am *definitely* not the correct person to answer this at the moment.

Eric Everman

At 4/29/2003, you wrote:
>   I'm running into the following exception:
>
>org.apache.commons.logging.LogConfigurationException:
>org.apache.commons.logging.LogConfigurationException: Class
>org.apache.commons.logging.impl.Log4JCategoryLog does not
>implement Log
>
>   when writing a page in Tapestry that uses Hibernate 2.0.  Anyone 
> encounter this before?  I'm new to Tapestry and Hibernate so I wouldn't 
> be surprised if I'm not doing things right.  Btw, is finishLoad the right 
> place to init a list for a foreach component?
>   Thanks,
>
>         John
>
>
>AdminTop.page:
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE page-specification PUBLIC
>   "-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
>   "http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">;
>
><page-specification class="AdminTop">
>
>   <bean name="c" class="Country"/>
>
>   <component id="foreachCountry" type="Foreach">
>     <binding name="source" expression="countryList"/>
>     <binding name="value" expression="country"/>
>   </component>
>
>   <component id="insertLoopName" type="Insert">
>     <binding name="value" expression="country.name"/>
>   </component>
>
>   <component id="insertLoopAbbr" type="Insert">
>     <binding name="value" expression="country.abbr"/>
>   </component>
>
></page-specification>
>
>
>
>AdminTop.java:
>public class AdminTop extends BasePage
>{
>   public Country country = null ;
>   public Iterator countryList = null ;
>   public int first = 0 ;
>
>   public void finishLoad(IRequestCycle cycle,
>                          IPageLoader loader,
>                          ComponentSpecification specification)
>   {
>     try {
>       Configuration config = new Configuration() ;
>       config.addClass(Country.class) ;
>       SessionFactory sf = config.buildSessionFactory() ;
>       Session session = sf.openSession() ;
>
>       List countries = session.find("from country in class Country") ;
>       countryList = countries.iterator() ;
>     } catch (Exception e) {
>       e.printStackTrace() ;
>     }
>     super.finishLoad(cycle, loader, specification) ;
>   }
>
>   public Iterator getCountryList()
>   {
>     return countryList ;
>   }
>
>   public Country getCountry()
>   {
>     return country ;
>   }
>}
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org