[Gvsig_desarrolladores] Hibernate-spatial

Sergio Piñón Campañó sergiopinhon en gmail.com
Jue Jul 17 22:40:02 CEST 2008


Hola, estoy intentando desarrollar una aplicación haciendo uso del framework 
hibernate-spatial. Soy capaz de realizar la lectura de la BD postgis y cargar 
todas las clases con sus atributos geográficos desde fuera de gvsig en una 
clase de pruebas, pero a la hora de intentarlo desde la extensión me da el 
siguiente error:


EBUG [AWT-EventQueue-1] (Launcher.java:649) - Initializing extensions from 
org.gvsig.georeferencing
Loading org.gvsig.georeferencing.GeoreferencingModule...
Loading org.gvsig.georeferencing.GeoreferencingToolsModule...
DEBUG [AWT-EventQueue-1] (Launcher.java:649) - Initializing extensions from 
org.gvsig.rasterTools
Loading org.gvsig.rasterTools.saveRaster.SaveRasterModule...
Loading org.gvsig.rasterTools.pansharpening.PanSharpeningModule...
Loading org.gvsig.rasterTools.exportToGeoRaster.ExportToGeoRasterExtension...
Loading org.gvsig.rasterTools.scaleManager.ScaleManagerModule...
DEBUG [AWT-EventQueue-1] (Launcher.java:649) - Initializing extensions from 
extGuiaEmpresas
Loading aplicaciones.GestionEmpresasExtension...
Loading aplicaciones.GestionUsuariosExtension...
DEBUG [AWT-EventQueue-1] (Controlador.java:45) - Cargado fichero de 
configuración correctamente
 INFO [AWT-EventQueue-1] (Environment.java:514) - Hibernate 3.2.6
 INFO [AWT-EventQueue-1] (Environment.java:547) - hibernate.properties not 
found
 INFO [AWT-EventQueue-1] (Environment.java:681) - Bytecode provider name : 
cglib
 INFO [AWT-EventQueue-1] (Environment.java:598) - using JDK 1.4 
java.sql.Timestamp handling
<<<<<<<<<>>>>>>>
 INFO [AWT-EventQueue-1] (Configuration.java:1432) - configuring from 
resource: /hibernate.cfg.xml
 INFO [AWT-EventQueue-1] (Configuration.java:1409) - Configuration 
resource: /hibernate.cfg.xml
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:38) - trying to resolve 
system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:40) - recognized hibernate 
namespace; attempting to resolve on classpath under org/hibernate/
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:50) - located 
[http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in 
classpath
DEBUG [AWT-EventQueue-1] (Configuration.java:1393) - 
hibernate.connection.driver_class=org.postgresql.Driver
DEBUG [AWT-EventQueue-1] (Configuration.java:1393) - 
hibernate.connection.password=sergio
DEBUG [AWT-EventQueue-1] (Configuration.java:1393) - 
hibernate.connection.url=jdbc:postgresql://localhost:5432/probas3
DEBUG [AWT-EventQueue-1] (Configuration.java:1393) - 
hibernate.connection.username=sergio
DEBUG [AWT-EventQueue-1] (Configuration.java:1393) - 
hibernate.dialect=org.hibernatespatial.postgis.PostgisDialect
DEBUG [AWT-EventQueue-1] (Configuration.java:1592) - 
null<-org.dom4j.tree.DefaultAttribute en 11415c8 [Attribute: name resource 
value "dominio/Usuario.hbm.xml"]
 INFO [AWT-EventQueue-1] (Configuration.java:559) - Reading mappings from 
resource : dominio/Usuario.hbm.xml
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:38) - trying to resolve 
system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:40) - recognized hibernate 
namespace; attempting to resolve on classpath under org/hibernate/
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:50) - located 
[http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
 INFO [AWT-EventQueue-1] (HbmBinder.java:300) - Mapping class: 
dominio.Usuario -> usuarios
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: login -> 
login
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: nombre -> 
nombre
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: apellidos -> 
apellidos
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: password -> 
password
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: rol -> rol
DEBUG [AWT-EventQueue-1] (Configuration.java:1592) - 
null<-org.dom4j.tree.DefaultAttribute en 14aa2db [Attribute: name resource 
value "dominio/Provincia.hbm.xml"]
 INFO [AWT-EventQueue-1] (Configuration.java:559) - Reading mappings from 
resource : dominio/Provincia.hbm.xml
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:38) - trying to resolve 
system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:40) - recognized hibernate 
namespace; attempting to resolve on classpath under org/hibernate/
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:50) - located 
[http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
 INFO [AWT-EventQueue-1] (HbmBinder.java:300) - Mapping class: 
dominio.Provincia -> provincias
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: gid -> gid
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: cdprovi -> 
cdprovi
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: provi -> 
provi
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: sup -> sup
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: theGeom -> 
the_geom
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: concellos
DEBUG [AWT-EventQueue-1] (Configuration.java:1592) - 
null<-org.dom4j.tree.DefaultAttribute en c7057c [Attribute: name resource 
value "dominio/Concello.hbm.xml"]
 INFO [AWT-EventQueue-1] (Configuration.java:559) - Reading mappings from 
resource : dominio/Concello.hbm.xml
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:38) - trying to resolve 
system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:40) - recognized hibernate 
namespace; attempting to resolve on classpath under org/hibernate/
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:50) - located 
[http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
 INFO [AWT-EventQueue-1] (HbmBinder.java:300) - Mapping class: 
dominio.Concello -> concellos
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: gid -> gid
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: provincia -> 
cdprovi
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: id -> id
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: nome -> nome
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: 
actividade -> actividade
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: cdcom -> 
cdcom
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: cdmuni -> 
cdmuni
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: pd98 -> pd98
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: pd99 -> pd99
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: sup -> sup
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: theGeom -> 
the_geom
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: poboacions
DEBUG [AWT-EventQueue-1] (Configuration.java:1592) - 
null<-org.dom4j.tree.DefaultAttribute en 407166 [Attribute: name resource 
value "dominio/Poboacion.hbm.xml"]
 INFO [AWT-EventQueue-1] (Configuration.java:559) - Reading mappings from 
resource : dominio/Poboacion.hbm.xml
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:38) - trying to resolve 
system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:40) - recognized hibernate 
namespace; attempting to resolve on classpath under org/hibernate/
DEBUG [AWT-EventQueue-1] (DTDEntityResolver.java:50) - located 
[http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
 INFO [AWT-EventQueue-1] (HbmBinder.java:300) - Mapping class: 
dominio.Poboacion -> poboacions
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: gid -> gid
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: concello -> 
id_concell
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: id -> id
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: nome -> nome
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: 
habitantes -> habitantes
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: cdprovi -> 
cdprovi
DEBUG [AWT-EventQueue-1] (HbmBinder.java:1267) - Mapped property: theGeom -> 
the_geom
 INFO [AWT-EventQueue-1] (Configuration.java:1547) - Configured 
SessionFactory: null
DEBUG [AWT-EventQueue-1] (Configuration.java:1548) - properties: 
{hibernate.connection.password=sergio, java.runtime.name=Java(TM) 2 Runtime 
Environment, Standard Edition, 
sun.boot.library.path=/home/loko/jdk1.5.0_15/jre/lib/i386, 
java.vm.version=1.5.0_15-b04, hibernate.connection.username=sergio, 
java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, 
path.separator=:, java.vm.name=Java HotSpot(TM) Client VM, 
file.encoding.pkg=sun.io, user.country=ES, sun.java.launcher=SUN_STANDARD, 
sun.os.patch.level=unknown, java.vm.specification.name=Java Virtual Machine 
Specification, user.dir=/Meu/Proyecto/Proyecto-Eclipse/_fwAndami, 
java.runtime.version=1.5.0_15-b04, 
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, 
java.endorsed.dirs=/home/loko/jdk1.5.0_15/jre/lib/endorsed, os.arch=i386, 
java.io.tmpdir=/tmp, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., os.name=Linux, 
sun.jnu.encoding=ISO-8859-15, 
java.library.path=/Meu/Proyecto/Proyecto-Eclipse/binaries/linux, 
http.proxyPort=, java.specification.name=Java Platform API Specification, 
java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, 
os.version=2.6.24, user.home=/home/loko, user.timezone=Europe/Madrid, 
java.awt.printerjob=sun.print.PSPrinterJob, file.encoding=ISO-8859-15, 
java.specification.version=1.5, 
hibernate.connection.driver_class=org.postgresql.Driver, user.name=loko, 
java.class.path=/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/bin:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/castor-0.9.5.3-xml.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/log4j-1.2.8.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/javaws.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/iver-utiles.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/tempFileManager.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/xml-apis.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/crimson.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/xerces_2_5_0.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/commons-dbcp-1.0-dev-20020806.zip:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/commons-pool-1.2.zip:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/commons-collections-3.1.zip:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/commons-codec-1.3.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/xmlrpc-2.0.1.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/beans.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/gvsig-i18n.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/looks-2.0.2.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/JWizardComponent.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/jcalendar.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/kxml2.jar:/Meu/Proyecto/Proyecto-Eclipse/_fwAndami/lib/jh.jar, 
hibernate.bytecode.use_reflection_optimizer=false, 
java.vm.specification.version=1.0, java.home=/home/loko/jdk1.5.0_15/jre, 
sun.arch.data.model=32, 
hibernate.dialect=org.hibernatespatial.postgis.PostgisDialect, 
hibernate.connection.url=jdbc:postgresql://localhost:5432/probas3, 
user.language=es, java.specification.vendor=Sun Microsystems Inc., 
java.vm.info=mixed mode, sharing, java.version=1.5.0_15, 
java.ext.dirs=/home/loko/jdk1.5.0_15/jre/lib/ext, http.proxyHost=, 
sun.boot.class.path=/home/loko/jdk1.5.0_15/jre/lib/rt.jar:/home/loko/jdk1.5.0_15/jre/lib/i18n.jar:/home/loko/jdk1.5.0_15/jre/lib/sunrsasign.jar:/home/loko/jdk1.5.0_15/jre/lib/jsse.jar:/home/loko/jdk1.5.0_15/jre/lib/jce.jar:/home/loko/jdk1.5.0_15/jre/lib/charsets.jar:/home/loko/jdk1.5.0_15/jre/classes, 
java.vendor=Sun Microsystems Inc., file.separator=/, 
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, 
sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, 
sun.cpu.isalist=}
DEBUG [AWT-EventQueue-1] (Configuration.java:1291) - Preparing to build 
session factory with filters : {}
DEBUG [AWT-EventQueue-1] (Configuration.java:1126) - processing extends queue
DEBUG [AWT-EventQueue-1] (Configuration.java:1130) - processing collection 
mappings
DEBUG [AWT-EventQueue-1] (CollectionSecondPass.java:41) - Second pass for 
collection: dominio.Provincia.concellos
 INFO [AWT-EventQueue-1] (HbmBinder.java:2382) - Mapping collection: 
dominio.Provincia.concellos -> concellos
DEBUG [AWT-EventQueue-1] (CollectionSecondPass.java:57) - Mapped collection 
key: cdprovi, one-to-many: dominio.Concello
DEBUG [AWT-EventQueue-1] (CollectionSecondPass.java:41) - Second pass for 
collection: dominio.Concello.poboacions
 INFO [AWT-EventQueue-1] (HbmBinder.java:2382) - Mapping collection: 
dominio.Concello.poboacions -> poboacions
DEBUG [AWT-EventQueue-1] (CollectionSecondPass.java:57) - Mapped collection 
key: id_concell, one-to-many: dominio.Poboacion
DEBUG [AWT-EventQueue-1] (Configuration.java:1141) - processing native query 
and ResultSetMapping mappings
DEBUG [AWT-EventQueue-1] (Configuration.java:1149) - processing association 
property references
DEBUG [AWT-EventQueue-1] (Configuration.java:1171) - processing foreign key 
constraints
DEBUG [AWT-EventQueue-1] (Configuration.java:1254) - resolving reference to 
class: dominio.Provincia
DEBUG [AWT-EventQueue-1] (Configuration.java:1254) - resolving reference to 
class: dominio.Concello
 INFO [AWT-EventQueue-1] (HBSpatialExtension.java:76) - Initializing 
HBSpatialExtension
 WARN [AWT-EventQueue-1] (HBSpatialExtension.java:138) - Hibernate Spatial 
Configured but no spatial dialect
%%%% Error creando SessionFactory %%%%
org.hibernatespatial.HibernateSpatialException: No spatial Dialect could be 
created
	at org.hibernatespatial.GeometryUserType.configure(GeometryUserType.java:69)
	at 
org.hibernatespatial.GeometryUserType.setParameterValues(GeometryUserType.java:226)
	at org.hibernate.type.TypeFactory.injectParameters(TypeFactory.java:339)
	at org.hibernate.type.CustomType.<init>(CustomType.java:67)
	at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.java:245)
	at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:260)
	at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
	at org.hibernate.mapping.Property.isValid(Property.java:185)
	at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
	at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
	at org.hibernate.cfg.Configuration.validate(Configuration.java:1108)
	at 
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1293)
	at accesoDatos.SessionFactory.rebuildSessionFactory(SessionFactory.java:61)
	at accesoDatos.SessionFactory.getSession(SessionFactory.java:44)
	at accesoDatos.ControlHibernate.getObjetos(ControlHibernate.java:34)
	at controlador.Controlador.<init>(Controlador.java:52)
	at controlador.Controlador.getControlador(Controlador.java:79)
	at 
aplicaciones.GestionUsuariosExtension.initialize(GestionUsuariosExtension.java:26)
	at com.iver.andami.Launcher.initializeExtensions(Launcher.java:694)
	at com.iver.andami.Launcher.access$9(Launcher.java:644)
	at com.iver.andami.Launcher$4.run(Launcher.java:334)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at 
com.iver.andami.ui.AndamiEventQueue.dispatchEvent(AndamiEventQueue.java:58)
	at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
ERROR [main] (Launcher.java:358) - excepción al arrancar
java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(EventQueue.java:853)
	at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1257)
	at com.iver.andami.Launcher.main(Launcher.java:332)
Caused by: java.lang.NullPointerException
	at accesoDatos.ControlHibernate.getObjetos(ControlHibernate.java:44)
	at controlador.Controlador.<init>(Controlador.java:52)
	at controlador.Controlador.getControlador(Controlador.java:79)
	at 
aplicaciones.GestionUsuariosExtension.initialize(GestionUsuariosExtension.java:26)
	at com.iver.andami.Launcher.initializeExtensions(Launcher.java:694)
	at com.iver.andami.Launcher.access$9(Launcher.java:644)
	at com.iver.andami.Launcher$4.run(Launcher.java:334)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at 
com.iver.andami.ui.AndamiEventQueue.dispatchEvent(AndamiEventQueue.java:58)
	at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)




Las clases las mapea bien, pero me dice que no es capaz de crear el dialecto 
spatial y las librerias(hibernate-spatial* , hibernate-spatial-postgis y 
demás)  las tengo en el directorio correcto.
¿Alguien ha hecho algo con hibernate-spatial y gvSIg?
Muchas gracias.
-- 
Un saludo,
	Sergio.



Más información sobre la lista de distribución gvSIG_desarrolladores