unsubscribe

2009-11-10 Thread Eric Isley
unsubscribe


Re: Axis2 And Hibernate

2009-10-30 Thread Eric Isley
Hi,

I had a similar issue recently while trying to configure and use
iBatis with an Axis2 web service.  I posted a similar thread but never
got any responses.  From what I understand it's not finding your
hibernate configuration because of the way the classloading is
happening inside the web service.  If you add the following line to
your services.xml file under the service node it should work:

parameter name=ServiceTCCLcomposite/parameter

You can read about this at: http://wso2.org/blog/dims/1131

Once I did that my iBatis config files could be loaded but then I lost
the JNDI datasource that I had set up and I decided that I would
rather have connection pooling from the Tomcat server than use iBatis.
 I wish there was a way to easily include .properties files and .xml
files onto the classpath from inside the .aar automatically so it
didn't just ignore them.  Once you set that parameter see if you can
use a datasource lookup.

Good luck!


On Thu, Oct 29, 2009 at 6:40 AM, dpeinador dampe2...@yahoo.es wrote:

 Hello all,

 I continue trying to fix the mis configuration. I have isolated the Web
 service, First I have create a dummy Echo Web service, and when this Web
 service has been working. I hav added the hibernate classes.

 This is the Echo Class (Echo,java):

 package com.autentia.ws.servidor;

 import com.db.PoiManager;
 import java.util.List;

 public class Echo {
        public String hello(String nombre) {
                PoiManager pm = new PoiManager();
                List l = pm.listPois();
                return Hola  + nombre + . Numero de POIs:  + l.size();
        }
 }

 And the Poi classes:

 PoiManager.java:

 package com.db;

 import java.util.List;
 import org.hibernate.HibernateException;
 import org.hibernate.SessionFactory;
 import org.hibernate.Transaction;
 import org.hibernate.cfg.Configuration;
 import org.hibernate.classic.Session;

 public class PoiManager {
        private SessionFactory sessionFactory;

        public PoiManager() {
                try {
                        System.out.println(Inicalizando Hibernate);
                        sessionFactory = new 
 Configuration().configure().buildSessionFactory();
                        System.out.println(terminado la inicializacion de 
 Hibernate);
                } catch (HibernateException e) {
                        e.printStackTrace();
                }
        }

        public List listPois() {
                try {
                        Session session = sessionFactory.openSession();
                        Transaction tx = session.beginTransaction();
                        List result = session.find(from poi);
                        tx.commit();
                        session.close();
                        return result;
                } catch (HibernateException e) {
                        throw new RuntimeException(e.getMessage());
                }
        }
 }

 Poi.java:
 public class Poi {
        private Long idItem;
        private String descripcion;

        public Long getIdItem() {
                return idItem;
        }
        public void setIdItem(Long idItem) {
                this.idItem = idItem;
        }
        public String getDescripcion() {
                return descripcion;
        }
        public void setDescripcion(String descripcion) {
                this.descripcion = descripcion;
        }

 }

 This is my Poi.hbm.xml file:
 ?xml version=1.0?
 !DOCTYPE hibernate-mapping PUBLIC
 -//hibernate/hibernate Mapping DTD 2.0//EN
 http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd;
 hibernate-mapping
        class name=com.cb.Poi table=poi
        id name=id column=IDITEM type=long
        generator class=identity/
        /id
        property name=descripcion column=DESCRIPCION type=string/
        /class
 /hibernate-mapping

 I have created also the hibernate.cfg.xml file and I have put it in the
 WEB_INF/classes Axis directory:

 ?xml version='1.0' encoding='utf-8'?
 !DOCTYPE hibernate-configuration
 PUBLIC -//Hibernate/Hibernate Configuration DTD//EN
 http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd;
 hibernate-configuration
        session-factory
                property
 name=hibernate.connection.driver_classorg.hsqldb.jdbcDriver/property
        property name=hibernate.connection.url
 jdbc:hsqldb://192.168.0.XX:3306/mydb?useUnicode=trueamp;characterEncoding=UTF-8/property
        property name=hibernate.connection.usernameuser/property
        property name=hibernate.connection.passwordpassword/property
                property 
 name=dialectorg.hibernate.dialect.HSQLDialect/property
                property name=show_sqltrue/property
                property
 name=transaction.factory_classorg.hibernate.transaction.JDBCTransactionFactory/property
                property
 name=hibernate.cache.provider_classorg.hibernate.cache.HashtableCacheProvider/property
                property name=hibernate.hbm2ddl.autoupdate/property