-->
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.  [ 5 posts ] 
Author Message
 Post subject: Could not parse configuration
PostPosted: Mon Mar 17, 2008 3:13 pm 
Newbie

Joined: Mon Jul 18, 2005 7:45 pm
Posts: 15
Location: Argentina
Hi,

I have this problem during Hibernate startup and I couldn´t find my way around this.
I downloaded the sources and I follow the debug until org.dom4j.io.SAXReader.read method. There I have a Null nested Null exception and no more clues.

Could somebody give a hand with this I will appreciate.
Thanks in advance.
Daniel

Hibernate version:
3.2.6
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="arballon">
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.password">sql</property>
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://AYA-NOTEBOOK:1433</property>
<property name="hibernate.connection.username">dba</property>
<property name="hibernate.connection.password">sql</property>
<property name="hibernate.connection.poolSize">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<mapping class="com.arballon.gwt.core.server.persistent.MenuItem" />
<mapping class="com.arballon.gwt.core.server.persistent.MenuFolder" />
</session-factory>
</hibernate-configuration>

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
16:44:30,140 INFO Environment:514 - Hibernate 3.2.6
16:44:30,170 INFO Environment:532 - loaded properties from resource hibernate.properties: {hibernate.bytecode.use_reflection_optimizer=false}
16:44:30,170 INFO Environment:681 - Bytecode provider name : cglib
16:44:30,220 INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling
16:44:30,360 INFO Configuration:1432 - configuring from resource: /hibernate.cfg.xml
16:44:30,360 INFO Configuration:1409 - Configuration resource: /hibernate.cfg.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.arballon.gwt.core.server.util.HibernateUtil.<clinit>(HibernateUtil.java:14)
at com.arballon.gwt.core.server.dao.HibernateDAOFactory.instantiateDAO(HibernateDAOFactory.java:14)
at com.arballon.gwt.core.server.dao.HibernateDAOFactory.getMenuItemDAO(HibernateDAOFactory.java:8)
at com.arballon.gwt.core.server.test.TestMenuItemDAO.<init>(TestMenuItemDAO.java:17)
at com.arballon.gwt.core.server.test.TestMenuItemDAO.main(TestMenuItemDAO.java:50)
Caused by: org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1500)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1420)
at com.arballon.gwt.core.server.util.HibernateUtil.<clinit>(HibernateUtil.java:12)
... 4 more
Caused by: org.dom4j.DocumentException: null Nested exception: null
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1490)
... 7 more

Name and version of the database you are using:
I'm using SQL Server 2000 with microsoft JDBC Driver


Top
 Profile  
 
 Post subject: When I open Hibernate Perspective in Eclipse parse fine
PostPosted: Mon Mar 17, 2008 5:42 pm 
Newbie

Joined: Mon Jul 18, 2005 7:45 pm
Posts: 15
Location: Argentina
The strange thing is that when I opened Hibernate Perspective in Eclipse IDE it parse configuration files ok, it generates session factory Ok.

Did I miss something?

Wait for your inputs,
Thanks again.
Daniel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 18, 2008 2:35 pm 
Newbie

Joined: Mon Jul 18, 2005 7:45 pm
Posts: 15
Location: Argentina
I found the problem!
It's my fault, I was using Configuration instead of AnnotationConfiguration
at my HibernateUtil class.

Now, I replaced and I have the following error:

Error Trace
Code:
15:03:27,805  INFO Version:15 - Hibernate Annotations 3.3.1.GA
15:03:27,835  INFO Environment:514 - Hibernate 3.2.6
15:03:27,845  INFO Environment:532 - loaded properties from resource hibernate.properties: {hibernate.bytecode.use_reflection_optimizer=false}
15:03:27,845  INFO Environment:681 - Bytecode provider name : cglib
15:03:27,875  INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling
15:03:27,975  INFO Configuration:1432 - configuring from resource: /hibernate.cfg.xml
15:03:27,975  INFO Configuration:1409 - Configuration resource: /hibernate.cfg.xml
15:03:28,325 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
15:03:28,325 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
15:03:28,335 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
15:03:28,395 DEBUG Configuration:1393 - hibernate.connection.driver_class=com.microsoft.jdbc.sqlserver.SQLServerDriver
15:03:28,395 DEBUG Configuration:1393 - hibernate.connection.password=sql
15:03:28,405 DEBUG Configuration:1393 - hibernate.connection.url=jdbc:microsoft:sqlserver://AYA-NOTEBOOK:1433
15:03:28,405 DEBUG Configuration:1393 - hibernate.connection.username=dba
15:03:28,405 DEBUG Configuration:1393 - hibernate.connection.password=sql
15:03:28,405 DEBUG Configuration:1393 - hibernate.connection.poolSize=1
15:03:28,405 DEBUG Configuration:1393 - hibernate.dialect=org.hibernate.dialect.SQLServerDialect
15:03:28,415 DEBUG Configuration:1393 - show_sql=true
15:03:28,415 DEBUG Configuration:1393 - format_sql=true
15:03:28,415 DEBUG Configuration:1393 - current_session_context_class=thread
15:03:28,415 DEBUG Configuration:1393 - cache.provider_class=org.hibernate.cache.NoCacheProvider
15:03:28,415 DEBUG AnnotationConfiguration:632 - null<-org.dom4j.tree.DefaultAttribute@1c695a6 [Attribute: name class value "com.arballon.gwt.core.server.persistent.MenuItem"]
15:03:28,485 DEBUG AnnotationConfiguration:632 - null<-org.dom4j.tree.DefaultAttribute@13bd574 [Attribute: name class value "com.arballon.gwt.core.server.persistent.MenuFolder"]
15:03:28,485  INFO Configuration:1547 - Configured SessionFactory: null
15:03:28,485 DEBUG Configuration:1548 - properties: {hibernate.connection.password=sql, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, sun.boot.library.path=C:\jdk1.5.0_04\jre\bin, java.vm.version=1.5.0_04-b05, hibernate.connection.username=dba, 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=AR, sun.os.patch.level=Service Pack 2, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\eclipse\workspace\ArballonGWT, java.runtime.version=1.5.0_04-b05, hibernate.connection.poolSize=1, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hibernate.current_session_context_class=thread, java.endorsed.dirs=C:\jdk1.5.0_04\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=c:\temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., cache.provider_class=org.hibernate.cache.NoCacheProvider, user.variant=, os.name=Windows XP, sun.jnu.encoding=Cp1252, java.library.path=C:\jdk1.5.0_04\bin;.;C:\WINDOWS\system32;C:\WINDOWS;c:\ruby\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Archivos de programa\ATI Technologies\ATI Control Panel;C:\Archivos de programa\Archivos comunes\Adaptec Shared\System;C:\Archivos de programa\Microsoft SQL Server\80\Tools\Binn\;c:\arballon\Server;c:\arballon\Server\Scripts;c:\arballon\Server\dlls;c:C:\jdk1.5.0_04\bin;c:\Informix\bin, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.1, user.home=C:\Documents and Settings\arballon.AYA-NOTEBOOK, user.timezone=America/Buenos_Aires, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, hibernate.format_sql=true, hibernate.connection.driver_class=com.microsoft.jdbc.sqlserver.SQLServerDriver, show_sql=true, user.name=arballon, java.class.path=C:\eclipse\workspace\ArballonGWT\build\classes;C:\eclipse\workspace\gwtde\gwtde-0.1.1.jar;C:\mygwt-0.5.0\mygwt.jar;C:\gwt-windows-1.4.61\gwt-user.jar;C:\gwt-windows-1.4.61\gwt-servlet.jar;C:\hibernate-3.2\hibernate-annotations-3.3.1.GA\lib\ejb3-persistence.jar;C:\hibernate-3.2\hibernate-annotations-3.3.1.GA\hibernate-annotations.jar;C:\hibernate-3.2\hibernate-annotations-3.3.1.GA\lib\hibernate-commons-annotations.jar, format_sql=true, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, current_session_context_class=thread, java.vm.specification.version=1.0, java.home=C:\jdk1.5.0_04\jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.SQLServerDialect, hibernate.connection.url=jdbc:microsoft:sqlserver://AYA-NOTEBOOK:1433, user.language=es, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.5.0_04, java.ext.dirs=C:\jdk1.5.0_04\jre\lib\ext, sun.boot.class.path=C:\hibernate-3.2\hibernate3.jar;C:\hibernate-3.2\lib\commons-collections-2.1.1.jar;C:\hibernate-3.2\lib\log4j-1.2.11.jar;C:\hibernate-3.2\lib\dom4j-1.6.1.jar;C:\hibernate-3.2\lib\jta.jar;C:\hibernate-3.2\lib\antlr-2.7.6.jar;C:\hibernate-3.2\lib\asm.jar;C:\hibernate-3.2\lib\asm-attrs.jar;C:\hibernate-3.2\lib\xml-apis.jar;C:\hibernate-3.2\lib\cglib-2.1.3.jar;C:\hibernate-3.2\lib\commons-logging-1.1.1.jar;C:\hibernate-3.2\lib\xerces-2.6.2.jar;C:\SQLServerJDBC\lib\msutil.jar;C:\SQLServerJDBC\lib\msbase.jar;C:\SQLServerJDBC\lib\mssqlserver.jar;C:\jdk1.5.0_04\jre\lib\rt.jar;C:\jdk1.5.0_04\jre\lib\i18n.jar;C:\jdk1.5.0_04\jre\lib\sunrsasign.jar;C:\jdk1.5.0_04\jre\lib\jsse.jar;C:\jdk1.5.0_04\jre\lib\jce.jar;C:\jdk1.5.0_04\jre\lib\charsets.jar;C:\jdk1.5.0_04\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.desktop=windows, sun.cpu.isalist=}
15:03:28,485 DEBUG AnnotationConfiguration:794 - Validator not present in classpath, ignoring event listener registration
15:03:28,485 DEBUG SearchConfiguration:56 - Search not present in classpath, ignoring event listener registration
15:03:28,485 DEBUG Configuration:1291 - Preparing to build session factory with filters : {}
15:03:28,485 DEBUG AnnotationConfiguration:253 - Execute first pass mapping processing
Exception in thread "main" java.lang.ExceptionInInitializerError
   at com.arballon.gwt.core.server.util.HibernateUtil.<clinit>(HibernateUtil.java:16)
   at com.arballon.gwt.core.server.dao.HibernateDAOFactory.instantiateDAO(HibernateDAOFactory.java:14)
   at com.arballon.gwt.core.server.dao.HibernateDAOFactory.getMenuItemDAO(HibernateDAOFactory.java:8)
   at com.arballon.gwt.core.server.test.TestMenuItemDAO.<init>(TestMenuItemDAO.java:17)
   at com.arballon.gwt.core.server.test.TestMenuItemDAO.main(TestMenuItemDAO.java:50)
Caused by: java.lang.IllegalAccessError: tried to access method org.hibernate.cfg.Mappings.<init>(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/Map;Ljava/util/Map;)V from class org.hibernate.cfg.ExtendedMappings
   at org.hibernate.cfg.ExtendedMappings.<init>(ExtendedMappings.java:69)
   at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:182)
   at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:272)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
   at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
   at com.arballon.gwt.core.server.util.HibernateUtil.<clinit>(HibernateUtil.java:14)
   ... 4 more


I was checking other posts and I found that this could be because of compatibility versions, but I double check this and is not the case.
I'm using Hibernate 3.2.6 core, Hibernate Annotations 3.3.1
Also Eclipse plug-in is Hibernate Tools 3.2.0

I´m not sure how to continue debuging this problem, I will thank you any help.

Daniel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 18, 2008 4:01 pm 
Newbie

Joined: Mon Jul 18, 2005 7:45 pm
Posts: 15
Location: Argentina
I don't get it.

The class org.hibernate.cfg.ExtendedMappings calls its super constructor with this signature:

Code:
      super(
            classes,
            collections,
            tables,
            queries,
            sqlqueries,
            sqlResultSetMappings,
            imports,
            secondPasses,
            propertyReferences,
            namingStrategy,
            typeDefs,
            filterDefinitions,
            extendsQueue,
            auxiliaryDatabaseObjects,
            tableNameBinding,
            columnNameBindingPerTable
      );



and the superclass constructor is:

Code:
   Mappings(
         final Map classes,
         final Map collections,
         final Map tables,
         final Map queries,
         final Map sqlqueries,
         final Map sqlResultSetMappings,
         final Map imports,
         final List secondPasses,
         final List propertyReferences,
         final NamingStrategy namingStrategy,
         final Map typeDefs,
         final Map filterDefinitions,
//         final List extendsQueue,
         final Map extendsQueue,
         final List auxiliaryDatabaseObjects,
         final Map tableNamebinding,
         final Map columnNameBindingPerTable
         ) {


So if we eliminate the commented row, both signatures are the same.
Aditionaly both classes are on the same package so there is no compatibility issue between jars.

I also check the Exception message and the types and quantity of the contructor's parameters are the same!

I don't understand why this is throwing the java.lang.IllegalAccessError.

Did I miss something?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 18, 2008 6:50 pm 
Newbie

Joined: Mon Jul 18, 2005 7:45 pm
Posts: 15
Location: Argentina
I decided to add my persistent annotated classes, this maybe help to find the solution:

MenuFolder Class
Code:
package com.arballon.gwt.core.server.persistent;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;

@Entity
@DiscriminatorValue("CP")
public class MenuFolder extends MenuItem {
   private Set<MenuItem> items=new HashSet<MenuItem>();
   
   public MenuFolder(){
      super();
   }

   @OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE}, mappedBy="folder")
   public Set<MenuItem> getItems() {
      return items;
   }

   public void setItems(Set<MenuItem> items) {
      this.items = items;
   }
   
   public void addItem(MenuItem item){
      item.setFolder(this);
      this.getItems().add(item);
   }
   
   public void removeItem(MenuItem item){
      item.setFolder(null);
      this.getItems().remove(item);
   }

}


MenuItem class
Code:
package com.arballon.gwt.core.server.persistent;

import javax.persistence.*;

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING)
@DiscriminatorValue("IT")
@Table (name="adk_menu")
public class MenuItem {
   
   private Long id;
   private String name;
   private String decription;
   private String URL;
   private MenuFolder folder;
   
   public MenuItem(){
      
   }
   
   @Id
   @GeneratedValue(strategy=GenerationType.AUTO)
   @Column(name="menu_id")
   public Long getId() {
      return id;
   }
   
   public void setId(Long id) {
      this.id = id;
   }
   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
   public String getDecription() {
      return decription;
   }
   public void setDecription(String decription) {
      this.decription = decription;
   }
   public String getURL() {
      return URL;
   }
   public void setURL(String url) {
      URL = url;
   }

   @ManyToOne
   @JoinColumn(name="carpeta_id", nullable=false)
   public MenuFolder getFolder() {
      return folder;
   }

   public void setFolder(MenuFolder parent) {
      this.folder = parent;
   }

   @Override
   public boolean equals(Object obj) {
      MenuItem otherItem;
      if(obj instanceof MenuItem){
         otherItem=(MenuItem)obj;
         if(otherItem.getId().equals(this.getId())){
            return true;
         }else{
            return false;
         }
      }else{
         return false;
      }
   }

}


Please any input will be appreciated.
Thanks.
Daniel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

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.