-->
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: problem parsing configuration/hibernate.cfg.xml
PostPosted: Tue Oct 25, 2005 1:36 pm 
Newbie

Joined: Tue Oct 25, 2005 12:28 pm
Posts: 18
Location: London
Hey guys, quick question and that is when deploying a JAR file containing the hibernate configuration file (hibernate.cfg.xml) does this need to be archived under a folder named configuration, within the archive? Error seems to indicate this, although I don't recall reading anywhere in the documentation about this. As long as it is on the classpath I thought.

At bottom of exception list is an parser error. The XML validates in XML Spy easy enough though.

I am getting this exception when deploying on Weblogic:


org.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1291)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1216)
at com.blah.dataservice.utils.HibernateUtils.getSession(HibernateUtils.java:24)
at com.blah.dataservice.category.extraction.CategoryExtractorImpl.findAll(CategoryExtractorImpl.jav
a:38)
at com.blah.dataservice.utils.ExtractorStartup.doStuff(ExtractorStartup.java:31)
at com.blah.dataservice.utils.ExtractorStartup.main(ExtractorStartup.java:64)
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:324)
at weblogic.t3.srvr.StartupClassService.invokeMain(StartupClassService.java:229)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.java:160)
at weblogic.t3.srvr.StartupClassService.access$000(StartupClassService.java:36)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:121)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassService.java:116)
at weblogic.t3.srvr.PostDeploymentStartupService.resume(PostDeploymentStartupService.java:63)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)
Caused by: org.dom4j.DocumentException: Error on line 3 of document : White spaces are required between publicId and systemI
d. Nested exception: White spaces are required between publicId and systemId.
at org.dom4j.io.SAXReader.read(SAXReader.java:350)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1286)
... 22 more

_________________
Cheers,
MikeR


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 1:45 pm 
Regular
Regular

Joined: Thu Apr 14, 2005 2:15 pm
Posts: 66
Take a look at the cause:

Caused by: org.dom4j.DocumentException: Error on line 3 of document : White spaces are required between publicId and systemI
d. Nested exception: White spaces are required between publicId and systemId.

Poste your hibernate.cfg.xml and com.blah.dataservice.utils.HibernateUtils.getSession(HibernateUtils.java:24).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 25, 2005 1:59 pm 
Newbie

Joined: Tue Oct 25, 2005 12:28 pm
Posts: 18
Location: London
Hi Ronald, yes, I see what you mean. Here is my config file and util file:


<?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>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@blah:blah</property>
<property name="hibernate.connection.username">blah</property>
<property name="hibernate.connection.password">blah</property>
<property name="show_sql">true</property>
<property name="transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory
</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider
</property>
<mapping resource="com/blah/Blah.hbm.xml"/>
</session-factory>
</hibernate-configuration>



Here is my utility class:

public static synchronized Session getSession() throws HibernateException {
if (factory == null) {
factory = new Configuration().configure().buildSessionFactory();
}
return factory.openSession();
}

_________________
Cheers,
MikeR


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 3:58 am 
Newbie

Joined: Tue Oct 25, 2005 12:28 pm
Posts: 18
Location: London
Hello, I've tried all combinations I can think of putting white space and new lines everywhere in the xml file. I've tried explicitely declaring PUBLIC and SYSTEM and have experiemented ommitting these upper case words. I am using an example from a Hibernate 3 tutorial. I get no problems when deploying out of container. I don't want to diss Weblogic, I am just confused why I get this error when deploying within a J2EE container. I would prefer to use another app server but there you have it ;)

Any more info or ideas appreciated.

_________________
Cheers,
MikeR


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 4:12 am 
Newbie

Joined: Tue Oct 25, 2005 12:28 pm
Posts: 18
Location: London
Aha.

hibernate.cnf.xml in my jar was not being picked up by WLS since it had another version on its classpath. Doh.

Solution is to ensure this is the exact syntax of your main config xml file if using Hibernate 3.0:



<?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>

<!-- blah -->

</session-factory>

</hibernate-configuration>



Thanks Ronald for your comment. Hopefully this thread will be picked up via a google search so people can get the immediate solution to the error message:

org.dom4j.DocumentException: White spaces are required between publicId and systemId

_________________
Cheers,
MikeR


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.