-->
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.  [ 6 posts ] 
Author Message
 Post subject: Problem reading xml config files.
PostPosted: Tue Mar 18, 2008 11:47 am 
Newbie

Joined: Tue Mar 18, 2008 11:23 am
Posts: 8
I am having trouble getting hibernate to parse my configuration files and mapping files. I've checked them for being well formed, but nothing seems to work. I tried using a programmatic configuration for the session factory, and it only kept telling me that it could not parse my mapping file. I am just doing a test app for Flex remoting on JBoss, and everything is working fine, save hibernate. Any gurus have an idea?

Things I have tried:
Well Formed?
Properly Encoded?
Hit Computer with Hammer?

Thanks

INFO:

Hibernate version:
3.2

Mapping documents:
Hibernate Config:

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

<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/tak</property>
<property name="connection.username">root</property>
<property name="connection.password">dragon</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</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>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<mapping resource="com/tak/impl/tasl/taskImpl.hbm.xml"></mapping>

</session-factory>

</hibernate-configuration>

Mapping:

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

<class name="com.tak.impl.task.taskImpl" table="tasks">
<id name="id" column="id">
<generator class="native"/>
</id>
<property name="name"/>
</class>

</hibernate-mapping>

Full stack trace of any exception that occurs:

Initial SessionFactory creation failed.org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 18, 2008 1:12 pm 
Beginner
Beginner

Joined: Fri Aug 24, 2007 4:46 am
Posts: 36
Location: Bielefeld / Germany
Just a wild guess: do you have an additional newline at the top of one of the files before the <?xml...?>? If yes, please remove it.

If this doesn't help, use the hammer again...;-)


Top
 Profile  
 
 Post subject: JBoss?
PostPosted: Tue Mar 18, 2008 3:42 pm 
Newbie

Joined: Tue Mar 18, 2008 11:23 am
Posts: 8
If I run a unit test on my simple service class it returns fine which is a step ahead of where the JBoss deployed one is. Maybe that piece of info will help all you gurus.


Top
 Profile  
 
 Post subject: Re: JBoss?
PostPosted: Tue Mar 18, 2008 3:53 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
LiquidMK3 wrote:
If I run a unit test on my simple service class it returns fine which is a step ahead of where the JBoss deployed one is. Maybe that piece of info will help all you gurus.


That tells me there is another configuration on classpath that is being confused with yours. You could rename this file and have the configuration to look for the renamed file so that you make sure you are looking at the right configuration file.



Farzad-


Top
 Profile  
 
 Post subject: Tried that
PostPosted: Tue Mar 18, 2008 5:50 pm 
Newbie

Joined: Tue Mar 18, 2008 11:23 am
Posts: 8
I gave it a shot and renaming it didn't fix anything.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 19, 2008 2:14 pm 
Newbie

Joined: Tue Mar 18, 2008 11:23 am
Posts: 8
Solution:

Missing jar file. The error I was receiving was extremely ambiguous, and offered very little in the way of a solution. Turns out I was missing a jar file. In an act of desperation I copied the lib directory from my java project to my deployment directory (without overwriting the commonalities) and all is now fine. Weird that it wouldn't give a more direct error message.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.