-->
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: duplicate import
PostPosted: Thu Jan 15, 2004 6:53 pm 
Newbie

Joined: Wed Jan 14, 2004 8:20 pm
Posts: 3
Hello


Can somebody help me with this error? I am trying to run the example given by http://www.systemmobile.com/articles/In ... rnate.html


i did not change anything in the two mapping files ( team and player ).....




C:\hibernate-2.1\hibernate_intro>ant run-tests
Buildfile: build.xml

build:

run-tests:
[junit] Running example.test.TeamDAOTest
[junit] %%%% Error Creating SessionFactory %%%%
[junit] example.persistence.DAOException: duplicate import: Player wraps: [net.sf.hibernate.MappingException: duplicate
[junit] at example.persistence.HibernateSession.loadClasses(HibernateSession.java:84)
[junit] at example.persistence.HibernateSession.currentSession(HibernateSession.java:32)
[junit] at example.persistence.BaseDAO.retrieveObjs(BaseDAO.java:114)
[junit] at example.persistence.TeamDAO.searchTeams(TeamDAO.java:43)
[junit] at example.test.TeamDAOTest.testSelectTeams(TeamDAOTest.java:88)
[junit] at java.lang.reflect.Method.invoke(Native Method)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536)
[junit] net.sf.hibernate.MappingException: duplicate import: Player
[junit] at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60)
[junit] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:106)
[junit] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:163)
[junit] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1076)
[junit] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
[junit] at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
[junit] at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:286)
[junit] at example.persistence.HibernateSession.loadClasses(HibernateSession.java:81)
[junit] at example.persistence.HibernateSession.currentSession(HibernateSession.java:32)
[junit] at example.persistence.BaseDAO.retrieveObjs(BaseDAO.java:114)
[junit] at example.persistence.TeamDAO.searchTeams(TeamDAO.java:43)
[junit] at example.test.TeamDAOTest.testSelectTeams(TeamDAOTest.java:88)
[junit] at java.lang.reflect.Method.invoke(Native Method)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] %%%% wrapped exception: Tests run: 2, Failures: 2, Errors: 0, Time elapsed: 1.141 sec
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536)
[junit] TEST example.test.TeamDAOTest FAILED
[junit] Running example.test.PlayerDAOTest
[junit] %%%% Error Creating SessionFactory %%%%
[junit] example.persistence.DAOException: duplicate import: Player wraps: [net.sf.hibernate.MappingException: duplicate
[junit] at example.persistence.HibernateSession.loadClasses(HibernateSession.java:84)
[junit] at example.persistence.HibernateSession.currentSession(HibernateSession.java:32)
[junit] at example.persistence.BaseDAO.retrieveObjs(BaseDAO.java:114)
[junit] at example.persistence.PlayerDAO.searchPlayers(PlayerDAO.java:43)
[junit] at example.test.PlayerDAOTest.testSelectPlayers(PlayerDAOTest.java:65)
[junit] at java.lang.reflect.Method.invoke(Native Method)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536)
[junit] net.sf.hibernate.MappingException: duplicate import: Player
[junit] at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:60)
[junit] at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:106)
[junit] at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:163)
[junit] at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1076)
[junit] at net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
[junit] at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
[junit] at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:286)
[junit] at example.persistence.HibernateSession.loadClasses(HibernateSession.java:81)
[junit] at example.persistence.HibernateSession.currentSession(HibernateSession.java:32)
[junit] at example.persistence.BaseDAO.retrieveObjs(BaseDAO.java:114)
[junit] at example.persistence.PlayerDAO.searchPlayers(PlayerDAO.java:43)
[junit] at example.test.PlayerDAOTest.testSelectPlayers(PlayerDAOTest.java:65)
[junit] at java.lang.reflect.Method.invoke(Native Method)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] %%%% wrapped exception: Tests run: 2, Failures: 2, Errors: 0, Time elapsed: 1.219 sec
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:536)
[junit] TEST example.test.PlayerDAOTest FAILED

BUILD SUCCESSFUL
Total time: 3 seconds
C:\hibernate-2.1\hibernate_intro>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 7:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
The duplicate import most certainly is an DTD violation - this is a bit confusing and will be fixed in the next release. Check your log somwhere before the exception, you should find the real cause there.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 7:14 pm 
Newbie

Joined: Wed Jan 14, 2004 8:20 pm
Posts: 3
Hi. Thanks for your reply. I got two Qs.

1. This is a example that is giving the error is given at http://www.systemmobile.com/articles/In ... rnate.html
This is a link from the hibernate website.

2. Where is the log ?


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 7:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Put a log4j.properties in your classpath root. There is a sample one in the src directory of the hibernate distribution


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 8:21 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I download nick sample and I have no mapping issue running 'ant run-tests'
Note that Nick sample use hibernate 2.0.1 You're trying to use hibernate 2.1

_________________
Emmanuel


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.