-->
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.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: My code works standalone and not on jboss
PostPosted: Sun Jul 10, 2005 1:53 pm 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
Hello,
I have following problem I first describe it and then I give you my application code (it is long).

I have a small bookmark manager with bookmarks in a many to many relations with categories.

With unit tests I create and persist some categories then a bookmark with a java Set of categories and I persist it. Then I list all bookmarks and all categories. All OK.

Now I deploy the tapestry application on jboss (tried 3 and 4) using postgresql 8 jdbc driver.

I save some categories. I save a bookmark and then problems start:

- hibernate gives me a classcast reading the "id" of a category
- OR it random fails on hibernate pretty print (printing a category)
- OR it gives some synchronization problem on category.

It seems very strange to me. Please tell me which parts of my code I should post.

Thank in advance for your reply!

Mario


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 7:00 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
I can post my code but it is very ugly because I am trying all tricks. I do not understand that standalone it works perfectly and under jboss not.


Top
 Profile  
 
 Post subject: Ok I send you the code: it is ugly.
PostPosted: Wed Aug 10, 2005 5:44 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
Code:



***** HIBERNATE.CFG.XML

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
   "-//Hibernate/Hibernate Configuration DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>

   <session-factory>

      <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
      <property name="connection.driver_class">org.postgresql.Driver</property>
      <property name="connection.username">postgres</property>
      <property name="connection.password">postgres</property>
      <property name="connection.url">jdbc:postgresql://10.0.0.10:5432/MarioBookmarks</property>
        <property name="show_sql">true</property>
      <property name="max_fetch_depth">1</property>
      <property name="use_query_cache">true</property>
      <property name="use_second_level_cache">true</property>
      <property name="query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
      <!--mapping resource="mio/hibernate/Bookcat.hbm.xml" /-->
      <mapping resource="mio/hibernate/Categorie.hbm.xml" />
      <mapping resource="mio/hibernate/Bookmark.hbm.xml" />

   </session-factory>
</hibernate-configuration>










***** CATEGORIE.HBM.XML
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class
    name="mio.hibernate.Categorie"
    table="categorie"
>

    <id
       name="id"
        column="id"
        type="java.lang.Integer"
    >
    <!--generator class="assigned" ></generator-->
        <generator class="sequence">
            <param name="sequence">categorie_seq</param>
        </generator>
    </id>
    <property
        name="categoria"
        type="java.lang.String"
        column="categoria"
        unique="true"
        length="30"
       
    />
   </class>
</hibernate-mapping>














****** BOOKMARKS.HBM.XML



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class
    name="mio.hibernate.Bookmark"
    table="bookmarks"
>

    <id
        name="id"
        type="java.lang.Integer"
        column="id"
    >
        <generator class="sequence">
            <param name="sequence">bookmarks_seq</param>
        </generator>
    </id>

    <property
        name="descrizione"
        type="java.lang.String"
        column="Descrizione"
        not-null="true"
        length="50"
    />
    <property
        name="url"
        type="java.lang.String"
        column="URL"
        not-null="true"
        length="50"
    />
    <property
        name="data"
        type="java.sql.Timestamp"
        column="Data"
        not-null="true"
        length="4"
    />

    <!-- Associations -->
 
    <set
        name="categorie"
        table="bookcat"
        cascade="none"
    >
        <key column="bookmark_id"  />
       
        <many-to-many
           column="categorie_id"
            class="mio.hibernate.Categorie"
           
        />
       
    </set>

</class>
</hibernate-mapping>
















***** BUSINESSLOGIC.JAVA

package mio;

import java.io.Serializable;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import mio.hibernate.Bookmark;
import mio.hibernate.Categorie;

import org.apache.log4j.Level;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
/**
*
*
* @author $Author: giammarc $
* @version $Id: BusinessLogic.java,v 1.1 2005/06/25 18:11:40 giammarc Exp $ 
*/
public class BusinessLogic implements Serializable {
   private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(BusinessLogic.class);

    private static SessionFactory sessionFactory;
   
//    static {
//        try {
//            // Create the SessionFactory
//            sessionFactory = new Configuration().configure().buildSessionFactory();
//        } catch (HibernateException ex) {
//            throw new RuntimeException("Configuration problem: " + ex.getMessage(), ex);
//        }
//    }
    private Connection conn;
    private  Session session;
    private Transaction tx;
   
    public BusinessLogic()  {
         try {
              // Create the SessionFactory
              sessionFactory = new Configuration().configure().buildSessionFactory();
          } catch (HibernateException ex) {
              throw new RuntimeException("------------------------Configuration problem: " + ex.getMessage(), ex);
          }
        session=currentSession();
    }
   
   
     
    public static void main(String[] args) throws HibernateException {
       logger.setLevel(Level.DEBUG);
        BusinessLogic bl= new BusinessLogic();
        bl.test(bl);
       
    }



   public  void test(BusinessLogic bl) {
      //Categorie c1= new Categorie();
        //Categorie c2= new Categorie();
        Bookmark b= new Bookmark();
        //c1.setCategoria("CatCiao1");
        //c2.setCategoria("CatCiao5");
       
        //Set s= new HashSet();
        //s.add(c1);
        //s.add(c2);
        System.out.println(bl.getCategorieAsArray().getClass());
        System.out.println(bl.getCategorieAsArray()[0]);
        System.out.println(bl.getCategorieAsArray().getClass());
        System.out.println(bl.getCategorieAsArray()[0]);

        bl.bt();
        b.setData(new Date());
        b.setUrl("ciaociao");
        b.setDescrizione("cia222ociaociaodesc");
        String temp[]={"uno3b","d3ue","t3re","anto3"};
        b.setCategorie(bl.insertCategorie(temp));
        //bl.insertCategoria(c1);
        //bl.insertCategoria(c2);
        bl.insertBookmark(b);
        bl.et();
        System.out.println(b.getId());
        System.out.println(bl.getBookmarks(null,null,null));
        System.out.println(bl.getCategorieAsArray().getClass());
        System.out.println(bl.getCategorieAsArray()[0]);
        bl.closeSession();
   }
   
   
/**
     * @param b
* @throws HibernateException
     */
    public synchronized void insertBookmark(Bookmark b) throws HibernateException {
        session.save(b);
    }


//    public void apriTutto() throws ClassNotFoundException, SQLException {
//        Class.forName("org.postgresql.Driver");
//        String url = "jdbc:postgresql://10.0.0.10/MarioBookmarks?user=postgres&password=postgres";
//        conn = DriverManager.getConnection(url);
//       
//    }
    public synchronized  Session currentSession() throws HibernateException {
       
        // Open a new Session, if this Thread has none yet
        if (session == null) {
            session = sessionFactory.openSession();
        }
        return session;
    }

    public synchronized  void closeSession() throws HibernateException {
        if (session != null)
            session.close();
    }
   
    public synchronized void bt() {
        tx= session.beginTransaction();
       
    }
   
    public synchronized void et() {
       session.flush();
        tx.commit();
    }
   
    public synchronized void insertCategoria(Categorie c) throws HibernateException {
        Query query = session.createQuery("select c from Categorie as c where c.categoria = :descr");
        query.setString("descr", c.getCategoria());
       
        Categorie c2= (Categorie) query.uniqueResult();
        if (c2!=null) c.setId(c2.getId());
        session.saveOrUpdate(c);
    }
   
    public synchronized Set insertCategorie(String cs[]) throws HibernateException {
        Set res= new HashSet();
        for (int i = 0; i < cs.length; i++) {
           logger.debug(cs[i]);
            if (cs[i]!=null) {
                Query query = session.createQuery("select c from Categorie as c where c.categoria = :descr");
                query.setString("descr", cs[i]);
                Categorie c2= (Categorie) query.uniqueResult();
                if (c2!=null) {
                   session.saveOrUpdate(c2);
                   res.add(c2);
                }
               
                else {
                    Categorie c3=new Categorie();
                    c3.setCategoria(cs[i]);
                    session.saveOrUpdate(c3);
                    res.add(c3);
                }
            }
        }
        return res;
    }

    public synchronized List getBookmarks(List categorie, Date da, Date a) {
        String filters="";
        if (categorie!=null && categorie.isEmpty()==false) filters+=" b.categorie.categoria.id " +
              "in (select c.id from Categorie as c where c.categoria in (:categorie))";
        if (da!=null) {
            if (!filters.equals("")) filters+=" AND ";
            filters+=" b.data >= :da";
        }
        if (a!=null) {
            if (!filters.equals("")) filters+=" AND ";
            filters+=" b.data <= :a";
        }
        if (!filters.equals("")) filters="where "+filters;
        Query q= currentSession().createQuery("select distinct b from Bookmark as b , Categorie as c "+filters);
        if (categorie!=null && categorie.isEmpty()==false) q.setParameterList("categorie",categorie);
        if (da!=null) q.setDate("da",da);
        if (a!=null) q.setDate("a",a);
        List result= q.list();
        if (result!=null) return result;
        else return new ArrayList();
    }
   
    public synchronized String [] getCategorieAsArray() {
        List cats= getCategorie();
        String[] result=null;
        if (cats!=null) {
            result =new String[cats.size()];
            int i=0;
            for (Iterator iter = cats.iterator(); iter.hasNext();) {
                Categorie element = (Categorie) iter.next();
                result[i++]=element.getCategoria();
            }
        }
        return result;
    }
   
    public synchronized List getCategorie() {
       session.flush();
        Query q= session.createQuery("from Categorie cats");
        List temp=q.list();
        return temp;
    }
   
}













****** HOME.JAVA

package mio;


import java.util.Date;
import java.util.List;
import java.util.Set;

import mio.hibernate.Bookmark;
import org.hibernate.HibernateException;
import org.hibernate.Query;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.form.StringPropertySelectionModel;
import org.apache.tapestry.html.BasePage;

/**
*
*
* @author $Author: giammarc $
* @version $Id: Home.java,v 1.1 2005/06/25 18:11:40 giammarc Exp $ 
*/
public abstract class Home extends BasePage {
   private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Home.class);

    public abstract String getUrl();
    public abstract String getDescrizione();
    public abstract String getCategorie();
    public abstract List getCategorieScelte();
    private BusinessLogic bl;
    private IPropertySelectionModel listaCategorie;
   
    public Home()  {
//       if (bl==null) bl= new BusinessLogic();
//       logger.debug("++++++++++++++++++++++++++++++"+getEngine());
//       logger.debug(getVisit());
//       logger.debug(getGlobal());
    }
   
    public void formSubmit(IRequestCycle cycle) {
       logger.debug("++++++++++++++++++++++++++++++"+getEngine());
       logger.debug(getVisit());
       logger.debug(getGlobal());
       bl=(BusinessLogic) getGlobal();
       bl.test(bl);
//        String[] temp= {"uno","due"};
//        String catTemp=getCategorie();
//        String[] categorie=null;
//       
//        if (catTemp!=null) categorie=catTemp.split(" ");
//        Bookmark bm= new Bookmark();
//       
//        bl.bt();
//        bm.setData(new Date());
//        bm.setUrl(getUrl());
//        bm.setDescrizione(getDescrizione());
//
//       
//        Set s=bl.insertCategorie((String [])getCategorieScelte().toArray(temp));
//        if (categorie!=null  && !categorie.equals("")) s.add(bl.insertCategorie(categorie));
//        bm.setCategorie(s);
//        logger.debug("@@@@@@@@@@@@@@@@@@@@@@@@"+s);
//        bl.insertBookmark(bm);
//
//        bl.et();
//        bl.closeSession();
    }
   
   
   
    public IPropertySelectionModel getListaCategorie() {
       bl=(BusinessLogic) getGlobal();

        String[] temp= {"no","no"};     
        String[] cat=bl.getCategorieAsArray();
        if (cat!=null) return new StringPropertySelectionModel(cat);
        else return new StringPropertySelectionModel(temp);
    }
   
   
 
}










****** RESULTLIST.JAVA

package mio;

import java.util.Date;
import java.util.List;
import java.util.Set;

import mio.hibernate.Bookmark;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.form.StringPropertySelectionModel;
import org.apache.tapestry.html.BasePage;
import org.hibernate.HibernateException;

/**
*
*
* @author $Author: giammarc $
* @version $Id: ResultList.java,v 1.1 2005/06/25 18:11:40 giammarc Exp $ 
*/
public abstract class ResultList extends BasePage {
    private BusinessLogic bl;
    public abstract List getCategorieScelte();
    public abstract Date getDa();
    public abstract Date getA();

    //    public abstract String getUrl();
    //    public abstract String getDescrizione();
    //    public abstract String getCategorie();
    //    public void formSubmit(IRequestCycle cycle) throws HibernateException{
    //        BusinessLogic bl= new BusinessLogic();
    //        String categorie[]= getCategorie().split(" ");
    //        Bookmark bm= new Bookmark();
    //       
    //        bl.bt();
    //        Set s=bl.insertCategorie(categorie);
    //        bm.setCategorie(s);
    //        bm.setData(new Date());
    //        bm.setUrl(getUrl());
    //        bm.setDescrizione(getDescrizione());
    //        bl.insertBookmark(bm);
    //    }
    public List getBookmarks() {
       bl= (BusinessLogic) getGlobal();
        return bl.getBookmarks(getCategorieScelte(),getDa(),getA());
    }
    public void formSubmit(IRequestCycle cycle) throws HibernateException{
       
    }
   
   
   
    public IPropertySelectionModel getListaCategorie() {
       bl= (BusinessLogic) getGlobal();

        String[] temp= {"no","no"};     
        String[] cat=bl.getCategorieAsArray();
        if (cat!=null) return new StringPropertySelectionModel(cat);
        else return new StringPropertySelectionModel(temp);
    }
   
}



Top
 Profile  
 
 Post subject: Ok I send you the code: it is ugly.
PostPosted: Wed Aug 10, 2005 5:46 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
Code:



***** HIBERNATE.CFG.XML

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
   "-//Hibernate/Hibernate Configuration DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>

   <session-factory>

      <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
      <property name="connection.driver_class">org.postgresql.Driver</property>
      <property name="connection.username">postgres</property>
      <property name="connection.password">postgres</property>
      <property name="connection.url">jdbc:postgresql://10.0.0.10:5432/MarioBookmarks</property>
        <property name="show_sql">true</property>
      <property name="max_fetch_depth">1</property>
      <property name="use_query_cache">true</property>
      <property name="use_second_level_cache">true</property>
      <property name="query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
      <!--mapping resource="mio/hibernate/Bookcat.hbm.xml" /-->
      <mapping resource="mio/hibernate/Categorie.hbm.xml" />
      <mapping resource="mio/hibernate/Bookmark.hbm.xml" />

   </session-factory>
</hibernate-configuration>










***** CATEGORIE.HBM.XML
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class
    name="mio.hibernate.Categorie"
    table="categorie"
>

    <id
       name="id"
        column="id"
        type="java.lang.Integer"
    >
    <!--generator class="assigned" ></generator-->
        <generator class="sequence">
            <param name="sequence">categorie_seq</param>
        </generator>
    </id>
    <property
        name="categoria"
        type="java.lang.String"
        column="categoria"
        unique="true"
        length="30"
       
    />
   </class>
</hibernate-mapping>














****** BOOKMARKS.HBM.XML



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
   
<hibernate-mapping>
<!--
    Created by the Middlegen Hibernate plugin 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->

<class
    name="mio.hibernate.Bookmark"
    table="bookmarks"
>

    <id
        name="id"
        type="java.lang.Integer"
        column="id"
    >
        <generator class="sequence">
            <param name="sequence">bookmarks_seq</param>
        </generator>
    </id>

    <property
        name="descrizione"
        type="java.lang.String"
        column="Descrizione"
        not-null="true"
        length="50"
    />
    <property
        name="url"
        type="java.lang.String"
        column="URL"
        not-null="true"
        length="50"
    />
    <property
        name="data"
        type="java.sql.Timestamp"
        column="Data"
        not-null="true"
        length="4"
    />

    <!-- Associations -->
 
    <set
        name="categorie"
        table="bookcat"
        cascade="none"
    >
        <key column="bookmark_id"  />
       
        <many-to-many
           column="categorie_id"
            class="mio.hibernate.Categorie"
           
        />
       
    </set>

</class>
</hibernate-mapping>
















***** BUSINESSLOGIC.JAVA

package mio;

import java.io.Serializable;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import mio.hibernate.Bookmark;
import mio.hibernate.Categorie;

import org.apache.log4j.Level;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
/**
*
*
* @author $Author: giammarc $
* @version $Id: BusinessLogic.java,v 1.1 2005/06/25 18:11:40 giammarc Exp $ 
*/
public class BusinessLogic implements Serializable {
   private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(BusinessLogic.class);

    private static SessionFactory sessionFactory;
   
//    static {
//        try {
//            // Create the SessionFactory
//            sessionFactory = new Configuration().configure().buildSessionFactory();
//        } catch (HibernateException ex) {
//            throw new RuntimeException("Configuration problem: " + ex.getMessage(), ex);
//        }
//    }
    private Connection conn;
    private  Session session;
    private Transaction tx;
   
    public BusinessLogic()  {
         try {
              // Create the SessionFactory
              sessionFactory = new Configuration().configure().buildSessionFactory();
          } catch (HibernateException ex) {
              throw new RuntimeException("------------------------Configuration problem: " + ex.getMessage(), ex);
          }
        session=currentSession();
    }
   
   
     
    public static void main(String[] args) throws HibernateException {
       logger.setLevel(Level.DEBUG);
        BusinessLogic bl= new BusinessLogic();
        bl.test(bl);
       
    }



   public  void test(BusinessLogic bl) {
      //Categorie c1= new Categorie();
        //Categorie c2= new Categorie();
        Bookmark b= new Bookmark();
        //c1.setCategoria("CatCiao1");
        //c2.setCategoria("CatCiao5");
       
        //Set s= new HashSet();
        //s.add(c1);
        //s.add(c2);
        System.out.println(bl.getCategorieAsArray().getClass());
        System.out.println(bl.getCategorieAsArray()[0]);
        System.out.println(bl.getCategorieAsArray().getClass());
        System.out.println(bl.getCategorieAsArray()[0]);

        bl.bt();
        b.setData(new Date());
        b.setUrl("ciaociao");
        b.setDescrizione("cia222ociaociaodesc");
        String temp[]={"uno3b","d3ue","t3re","anto3"};
        b.setCategorie(bl.insertCategorie(temp));
        //bl.insertCategoria(c1);
        //bl.insertCategoria(c2);
        bl.insertBookmark(b);
        bl.et();
        System.out.println(b.getId());
        System.out.println(bl.getBookmarks(null,null,null));
        System.out.println(bl.getCategorieAsArray().getClass());
        System.out.println(bl.getCategorieAsArray()[0]);
        bl.closeSession();
   }
   
   
/**
     * @param b
* @throws HibernateException
     */
    public synchronized void insertBookmark(Bookmark b) throws HibernateException {
        session.save(b);
    }


//    public void apriTutto() throws ClassNotFoundException, SQLException {
//        Class.forName("org.postgresql.Driver");
//        String url = "jdbc:postgresql://10.0.0.10/MarioBookmarks?user=postgres&password=postgres";
//        conn = DriverManager.getConnection(url);
//       
//    }
    public synchronized  Session currentSession() throws HibernateException {
       
        // Open a new Session, if this Thread has none yet
        if (session == null) {
            session = sessionFactory.openSession();
        }
        return session;
    }

    public synchronized  void closeSession() throws HibernateException {
        if (session != null)
            session.close();
    }
   
    public synchronized void bt() {
        tx= session.beginTransaction();
       
    }
   
    public synchronized void et() {
       session.flush();
        tx.commit();
    }
   
    public synchronized void insertCategoria(Categorie c) throws HibernateException {
        Query query = session.createQuery("select c from Categorie as c where c.categoria = :descr");
        query.setString("descr", c.getCategoria());
       
        Categorie c2= (Categorie) query.uniqueResult();
        if (c2!=null) c.setId(c2.getId());
        session.saveOrUpdate(c);
    }
   
    public synchronized Set insertCategorie(String cs[]) throws HibernateException {
        Set res= new HashSet();
        for (int i = 0; i < cs.length; i++) {
           logger.debug(cs[i]);
            if (cs[i]!=null) {
                Query query = session.createQuery("select c from Categorie as c where c.categoria = :descr");
                query.setString("descr", cs[i]);
                Categorie c2= (Categorie) query.uniqueResult();
                if (c2!=null) {
                   session.saveOrUpdate(c2);
                   res.add(c2);
                }
               
                else {
                    Categorie c3=new Categorie();
                    c3.setCategoria(cs[i]);
                    session.saveOrUpdate(c3);
                    res.add(c3);
                }
            }
        }
        return res;
    }

    public synchronized List getBookmarks(List categorie, Date da, Date a) {
        String filters="";
        if (categorie!=null && categorie.isEmpty()==false) filters+=" b.categorie.categoria.id " +
              "in (select c.id from Categorie as c where c.categoria in (:categorie))";
        if (da!=null) {
            if (!filters.equals("")) filters+=" AND ";
            filters+=" b.data >= :da";
        }
        if (a!=null) {
            if (!filters.equals("")) filters+=" AND ";
            filters+=" b.data <= :a";
        }
        if (!filters.equals("")) filters="where "+filters;
        Query q= currentSession().createQuery("select distinct b from Bookmark as b , Categorie as c "+filters);
        if (categorie!=null && categorie.isEmpty()==false) q.setParameterList("categorie",categorie);
        if (da!=null) q.setDate("da",da);
        if (a!=null) q.setDate("a",a);
        List result= q.list();
        if (result!=null) return result;
        else return new ArrayList();
    }
   
    public synchronized String [] getCategorieAsArray() {
        List cats= getCategorie();
        String[] result=null;
        if (cats!=null) {
            result =new String[cats.size()];
            int i=0;
            for (Iterator iter = cats.iterator(); iter.hasNext();) {
                Categorie element = (Categorie) iter.next();
                result[i++]=element.getCategoria();
            }
        }
        return result;
    }
   
    public synchronized List getCategorie() {
       session.flush();
        Query q= session.createQuery("from Categorie cats");
        List temp=q.list();
        return temp;
    }
   
}













****** HOME.JAVA

package mio;


import java.util.Date;
import java.util.List;
import java.util.Set;

import mio.hibernate.Bookmark;
import org.hibernate.HibernateException;
import org.hibernate.Query;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.form.StringPropertySelectionModel;
import org.apache.tapestry.html.BasePage;

/**
*
*
* @author $Author: giammarc $
* @version $Id: Home.java,v 1.1 2005/06/25 18:11:40 giammarc Exp $ 
*/
public abstract class Home extends BasePage {
   private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Home.class);

    public abstract String getUrl();
    public abstract String getDescrizione();
    public abstract String getCategorie();
    public abstract List getCategorieScelte();
    private BusinessLogic bl;
    private IPropertySelectionModel listaCategorie;
   
    public Home()  {
//       if (bl==null) bl= new BusinessLogic();
//       logger.debug("++++++++++++++++++++++++++++++"+getEngine());
//       logger.debug(getVisit());
//       logger.debug(getGlobal());
    }
   
    public void formSubmit(IRequestCycle cycle) {
       logger.debug("++++++++++++++++++++++++++++++"+getEngine());
       logger.debug(getVisit());
       logger.debug(getGlobal());
       bl=(BusinessLogic) getGlobal();
       bl.test(bl);
//        String[] temp= {"uno","due"};
//        String catTemp=getCategorie();
//        String[] categorie=null;
//       
//        if (catTemp!=null) categorie=catTemp.split(" ");
//        Bookmark bm= new Bookmark();
//       
//        bl.bt();
//        bm.setData(new Date());
//        bm.setUrl(getUrl());
//        bm.setDescrizione(getDescrizione());
//
//       
//        Set s=bl.insertCategorie((String [])getCategorieScelte().toArray(temp));
//        if (categorie!=null  && !categorie.equals("")) s.add(bl.insertCategorie(categorie));
//        bm.setCategorie(s);
//        logger.debug("@@@@@@@@@@@@@@@@@@@@@@@@"+s);
//        bl.insertBookmark(bm);
//
//        bl.et();
//        bl.closeSession();
    }
   
   
   
    public IPropertySelectionModel getListaCategorie() {
       bl=(BusinessLogic) getGlobal();

        String[] temp= {"no","no"};     
        String[] cat=bl.getCategorieAsArray();
        if (cat!=null) return new StringPropertySelectionModel(cat);
        else return new StringPropertySelectionModel(temp);
    }
   
   
 
}










****** RESULTLIST.JAVA

package mio;

import java.util.Date;
import java.util.List;
import java.util.Set;

import mio.hibernate.Bookmark;

import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.form.StringPropertySelectionModel;
import org.apache.tapestry.html.BasePage;
import org.hibernate.HibernateException;

/**
*
*
* @author $Author: giammarc $
* @version $Id: ResultList.java,v 1.1 2005/06/25 18:11:40 giammarc Exp $ 
*/
public abstract class ResultList extends BasePage {
    private BusinessLogic bl;
    public abstract List getCategorieScelte();
    public abstract Date getDa();
    public abstract Date getA();

    //    public abstract String getUrl();
    //    public abstract String getDescrizione();
    //    public abstract String getCategorie();
    //    public void formSubmit(IRequestCycle cycle) throws HibernateException{
    //        BusinessLogic bl= new BusinessLogic();
    //        String categorie[]= getCategorie().split(" ");
    //        Bookmark bm= new Bookmark();
    //       
    //        bl.bt();
    //        Set s=bl.insertCategorie(categorie);
    //        bm.setCategorie(s);
    //        bm.setData(new Date());
    //        bm.setUrl(getUrl());
    //        bm.setDescrizione(getDescrizione());
    //        bl.insertBookmark(bm);
    //    }
    public List getBookmarks() {
       bl= (BusinessLogic) getGlobal();
        return bl.getBookmarks(getCategorieScelte(),getDa(),getA());
    }
    public void formSubmit(IRequestCycle cycle) throws HibernateException{
       
    }
   
   
   
    public IPropertySelectionModel getListaCategorie() {
       bl= (BusinessLogic) getGlobal();

        String[] temp= {"no","no"};     
        String[] cat=bl.getCategorieAsArray();
        if (cat!=null) return new StringPropertySelectionModel(cat);
        else return new StringPropertySelectionModel(temp);
    }
   
}



Top
 Profile  
 
 Post subject: This is a typical jboss error log
PostPosted: Thu Aug 25, 2005 4:05 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
Code:

09:54:58,826 INFO  [STDOUT] Hibernate: select categorie0_.id as id, categorie0_.categoria as categoria0_ from categorie categorie0_
09:54:58,922 DEBUG [Home] ++++++++++++++++++++++++++++++org.apache.tapestry.engine.BaseEngine@577bbc[name=MarioBookmarks,dirty=false,locale=it,stateful=true,visit=<null>,activePageNames=[ResultList]]
09:54:58,922 DEBUG [Home] {}
09:54:58,922 DEBUG [Home] mio.BusinessLogic@17caf50
09:54:58,926 DEBUG [BusinessLogic]
09:54:58,926 DEBUG [BusinessLogic] due
09:54:59,021 INFO  [STDOUT] Hibernate: select categorie0_.id as id, categorie0_.categoria as categoria0_ from categorie categorie0_ where (categorie0_.categoria=? )
09:54:59,203 INFO  [STDOUT] Hibernate: select nextval ('categorie_seq')
09:54:59,410 DEBUG [BusinessLogic] tre
09:54:59,437 INFO  [STDOUT] Hibernate: insert into categorie (categoria, id) values (?, ?)
09:54:59,478 INFO  [STDOUT] Hibernate: select categorie0_.id as id, categorie0_.categoria as categoria0_ from categorie categorie0_ where (categorie0_.categoria=? )
09:54:59,480 INFO  [STDOUT] Hibernate: select nextval ('categorie_seq')
09:54:59,482 DEBUG [Home] @@@@@@@@@@@@@@@@@@@@@@@@[[mio.hibernate.Categorie@18c4558[id=5]], mio.hibernate.Categorie@de2483[id=4]]
09:54:59,482 INFO  [STDOUT] Hibernate: select nextval ('bookmarks_seq')
09:54:59,559 INFO  [STDOUT] Hibernate: insert into categorie (categoria, id) values (?, ?)
09:54:59,563 INFO  [STDOUT] Hibernate: insert into bookmarks (Descrizione, URL, Data, id) values (?, ?, ?, ?)
09:54:59,613 INFO  [STDOUT] Hibernate: insert into bookcat (bookmark_id, categorie_id) values (?, ?)
09:54:59,613 ERROR [BasicPropertyAccessor] IllegalArgumentException in class: mio.hibernate.Categorie, getter method of property: id
09:54:59,671 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of mio.hibernate.Categorie.id
        at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:119)
        at org.hibernate.tuple.AbstractTuplizer.getIdentifier(AbstractTuplizer.java:103)
        at org.hibernate.persister.entity.BasicEntityPersister.getIdentifier(BasicEntityPersister.java:2944)
        at org.hibernate.persister.entity.BasicEntityPersister.isTransient(BasicEntityPersister.java:2705)
        at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
        at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:215)
        at org.hibernate.type.EntityType.getIdentifier(EntityType.java:99)
        at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:63)
        at org.hibernate.persister.collection.AbstractCollectionPersister.writeElement(AbstractCollectionPersister.java:652)
        at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:914)
        at org.hibernate.action.CollectionRecreateAction.execute(CollectionRecreateAction.java:23)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
        at mio.BusinessLogic.et(BusinessLogic.java:139)
        at mio.Home.formSubmit(Home.java:70)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.tapestry.listener.ListenerMap.invokeTargetMethod(ListenerMap.java:257)
        at org.apache.tapestry.listener.ListenerMap.access$100(ListenerMap.java:46)
        at org.apache.tapestry.listener.ListenerMap$SyntheticListener.invoke(ListenerMap.java:97)
        at org.apache.tapestry.listener.ListenerMap$SyntheticListener.actionTriggered(ListenerMap.java:102)
        at org.apache.tapestry.form.Form.renderComponent(Form.java:423)
        at org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
        at org.apache.tapestry.form.Form.rewind(Form.java:568)
        at org.apache.tapestry.engine.RequestCycle.rewindForm(RequestCycle.java:432)
        at org.apache.tapestry.form.Form.trigger(Form.java:582)
        at org.apache.tapestry.engine.DirectService.service(DirectService.java:169)
        at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:889)
        at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198)
        at org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:158)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:105)
        ... 68 more





Top
 Profile  
 
 Post subject: I have just tried with Resin
PostPosted: Fri Aug 26, 2005 5:32 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
I have tried it with resin and it not works.

I give you a sample of an error (taken from tapestry page because I do not know resin logs):


Code:
Unable to invoke method formSubmit on mio.Home$Enhance_0@16752c9[Home]: java.util.HashSet

java.lang.ClassCastException
java.util.HashSet
Stack Trace:

    * org.hibernate.type.EntityType.toLoggableString(EntityType.java:145)
    * org.hibernate.type.CollectionType.toLoggableString(CollectionType.java:147)
    * org.hibernate.pretty.Printer.toString(Printer.java:53)
    * org.hibernate.pretty.Printer.toString(Printer.java:90)
    * org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:91)
    * org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
    * org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
    * mio.BusinessLogic.et(BusinessLogic.java:139)
    * mio.Home.formSubmit(Home.java:70)
    * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    * sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    * sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    * java.lang.reflect.Method.invoke(Method.java:585)
    * org.apache.tapestry.listener.ListenerMap.invokeTargetMethod(ListenerMap.java:257)
    * org.apache.tapestry.listener.ListenerMap.access$100(ListenerMap.java:46)
    * org.apache.tapestry.listener.ListenerMap$SyntheticListener.invoke(ListenerMap.java:97)
    * org.apache.tapestry.listener.ListenerMap$SyntheticListener.actionTriggered(ListenerMap.java:102)
    * org.apache.tapestry.form.Form.renderComponent(Form.java:423)
    * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
    * org.apache.tapestry.form.Form.rewind(Form.java:568)
    * org.apache.tapestry.engine.RequestCycle.rewindForm(RequestCycle.java:432)
    * org.apache.tapestry.form.Form.trigger(Form.java:582)
    * org.apache.tapestry.engine.DirectService.service(DirectService.java:169)
    * org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:889)
    * org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198)
    * org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:327)
    * javax.servlet.http.HttpServlet.service(HttpServlet.java:154)
    * javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
    * com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
    * com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
    * com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208)
    * com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
    * com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
    * com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
    * com.caucho.util.ThreadPool.run(ThreadPool.java:423)
    * java.lang.Thread.run(Thread.java:595)




[/code]


Top
 Profile  
 
 Post subject: Summary
PostPosted: Fri Aug 26, 2005 5:39 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
Basically is an hibernate problem or a postgresql 8.0 jdbc driver problem. The following code works standalone but not work when non the application server:

Code:

public  void test(BusinessLogic bl) {
      //Categorie c1= new Categorie();
        //Categorie c2= new Categorie();
        Bookmark b= new Bookmark();
        //c1.setCategoria("CatCiao1");
        //c2.setCategoria("CatCiao5");
       
        //Set s= new HashSet();
        //s.add(c1);
        //s.add(c2);
        System.out.println(bl.getCategorieAsArray().getClass());
        System.out.println(bl.getCategorieAsArray()[0]);
        System.out.println(bl.getCategorieAsArray().getClass());
        System.out.println(bl.getCategorieAsArray()[0]);

        bl.bt();
        b.setData(new Date());
        b.setUrl("ciaociao");
        b.setDescrizione("cia222ociaociaodesc");
        String temp[]={"uno3b","d3ue","t3re","anto3"};
        b.setCategorie(bl.insertCategorie(temp));
        //bl.insertCategoria(c1);
        //bl.insertCategoria(c2);
        bl.insertBookmark(b);
        bl.et();
        System.out.println(b.getId());
        System.out.println(bl.getBookmarks(null,null,null));
        System.out.println(bl.getCategorieAsArray().getClass());
        System.out.println(bl.getCategorieAsArray()[0]);
        bl.closeSession();
   }




Please help me! An hint is more than enough.[/code]


Top
 Profile  
 
 Post subject: Why nobody replies me?
PostPosted: Tue Aug 30, 2005 10:51 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
I suppose that is a real bug because nobody has a solution. So I will file it but to hibernate or postgres developers?


Top
 Profile  
 
 Post subject: I have changed to mysql but the BUG persists.
PostPosted: Tue Sep 13, 2005 8:54 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
I have tried to port the db to mysql but I have a similar error:

Code:

java.lang.ClassCastException
java.util.HashSet
Stack Trace:

    * org.hibernate.type.EntityType.toLoggableString(EntityType.java:145)
    * org.hibernate.type.CollectionType.toLoggableString(CollectionType.java:147)
    * org.hibernate.pretty.Printer.toString(Printer.java:53)
    * org.hibernate.pretty.Printer.toString(Printer.java:90)
    * org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:91)
    * org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
    * org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
    * mio.BusinessLogic.et(BusinessLogic.java:141)
    * mio.Home.formSubmit(Home.java:70)
    * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    * sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    * sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    * java.lang.reflect.Method.invoke(Method.java:324)
    * org.apache.tapestry.listener.ListenerMap.invokeTargetMethod(ListenerMap.java:257)
    * org.apache.tapestry.listener.ListenerMap.access$100(ListenerMap.java:46)
    * org.apache.tapestry.listener.ListenerMap$SyntheticListener.invoke(ListenerMap.java:97)
    * org.apache.tapestry.listener.ListenerMap$SyntheticListener.actionTriggered(ListenerMap.java:102)
    * org.apache.tapestry.form.Form.renderComponent(Form.java:423)
    * org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857)
    * org.apache.tapestry.form.Form.rewind(Form.java:568)
    * org.apache.tapestry.engine.RequestCycle.rewindForm(RequestCycle.java:432)
    * org.apache.tapestry.form.Form.trigger(Form.java:582)
    * org.apache.tapestry.engine.DirectService.service(DirectService.java:169)
    * org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:889)
    * org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198)
    * org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:327)
    * javax.servlet.http.HttpServlet.service(HttpServlet.java:154)
    * javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
    * com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
    * com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
    * com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208)
    * com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
    * com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
    * com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
    * com.caucho.util.ThreadPool.run(ThreadPool.java:423)
    * java.lang.Thread.run(Thread.java:534)







At this point it is clear it is a bug. Why on earth nobody gives me a little hint?


Top
 Profile  
 
 Post subject: Ensure that you only have one version of your classes
PostPosted: Tue Sep 13, 2005 10:07 am 
Newbie

Joined: Tue May 18, 2004 8:55 am
Posts: 3
Make sure that you only have one version of your mapped classes on your classpath.
I had some hidden away in a war file. They don't get enhanced and thus break when you use jsp's etc.


HTH
Thys


Top
 Profile  
 
 Post subject: Thanks but...
PostPosted: Thu Sep 15, 2005 10:11 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
I have checked for more than one version of mapped classes. I have also disabled cglib reflection optimizer. Unfortunately it does not work.

Thank you very very much for your interest!


Top
 Profile  
 
 Post subject: New error!
PostPosted: Fri Sep 16, 2005 7:50 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
I have tried to temporary remove the many to many mapping from xml. Now I get this error:

Code:
org.hibernate.HibernateException
Not able to obtain connection
messages:    [Ljava.lang.String;@1017ca1
throwableCount:    1
throwables:    [Ljava.lang.Throwable;@9d5793
Stack Trace:

    * org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:113)
    * org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88)
    * org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162)
    * org.hibernate.loader.Loader.doQuery(Loader.java:390)
    * org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
    * org.hibernate.loader.Loader.doList(Loader.java:1593)
    * org.hibernate.loader.Loader.list(Loader.java:1577)
    * org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:890)
    * org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
    * org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)



"Obviously" if I put again the mapping it can connect again.[/quote][/i]


Top
 Profile  
 
 Post subject: Reorganized libs.
PostPosted: Wed Sep 21, 2005 5:21 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
Today I have reorganized completely the jar set from scratch.

I followed accurately instructions on hibernate site (jdbc driver on global path).

Nothing has changed!!!

Is it a bug or not?


Top
 Profile  
 
 Post subject: Reorganized libs.
PostPosted: Wed Sep 21, 2005 5:23 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
Today I have reorganized completely the jar set from scratch.

I followed accurately instructions on hibernate site (jdbc driver on global path).

Nothing has changed!!!

Is it a bug or not?


Top
 Profile  
 
 Post subject: Another try another failure
PostPosted: Mon Oct 17, 2005 5:38 am 
Newbie

Joined: Sun Jul 10, 2005 1:12 pm
Posts: 16
Today I have tried to open the connection manually and pass it to hibernate but it does not work.

Is it possible that nobody has an idea?

Why standalone it runs and on jboss it does not run???


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

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.