-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with 3.6 tutorial code run in eclipse
PostPosted: Fri Oct 14, 2011 10:41 pm 
Newbie

Joined: Fri Oct 14, 2011 10:16 pm
Posts: 1
Hi all,

In eclipse I created a simple maven project (without archetype) named "hibernate-tutorial", and import the tutorial code into the project from the follow link:

http://docs.jboss.org/hibernate/core/3. ... orials.zip

After importing, the hierarchy of the project is as follows:

hibernate-tutorial
src/main/java (empty)
src/main/resources (empty)
src/test/java (empty)
src/test/resources (empty)
JRE System Library
Maven Dependencies
annotation (tutorial code)
basic (tutorial code)
entitymanager (tutorial code)
envers (tutorial code)
src (tutorial code)
pom.xml (tutorial code)

I used maven 3.0.3 and jdk 1.6.0_27 to build the tutorial code (mvn clean, mvn install) but got a build failure:

=======================================
Running org.hibernate.tutorial.hbm.NativeApiIllustrationTest
122 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
129 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.3.Final
131 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
134 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
138 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
205 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
205 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
274 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from resource : org/hibernate/tutorial/hbm/Event.hbm.xml
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.35 sec <<< FAILURE!

Results :

Tests in error:
testBasicUsage(org.hibernate.tutorial.hbm.NativeApiIllustrationTest): resource: org/hibernate/tutorial/hbm/Event.hbm.xml not found

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Hibernate Getting Started Guide Tutorials ......... SUCCESS [0.487s]
[INFO] Hibernate hbm.xml Tutorial ........................ FAILURE [2.381s]
[INFO] Hibernate Annotations Tutorial .................... SKIPPED
[INFO] Hibernate JPA Tutorial ............................ SKIPPED
[INFO] Hibernate Envers Tutorial ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.021s
[INFO] Finished at: Fri Oct 14 19:33:46 PDT 2011
[INFO] Final Memory: 15M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.7.2:test (default-test) on project hibernate-tutorial-hbm: There are test failures.
[ERROR]
[ERROR] Please refer to /workspace/nmtg_platform_comp/hibernate-tutorial/basic/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/disp ... eException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hibernate-tutorial-hbm
===================================================

I did try "mvn clean install -rf :hibernate-tutorial-hbm" but still didn't work.

Can anyone tell me how to run the example code in eclipse, and how to use the resultant jar? As a newbie of Hibernate, I just want to see how it works at this point.

Thanks a lot; any suggestion will be highly appreciated.
-yrliu


Top
 Profile  
 
 Post subject: Re: Problem with 3.6 tutorial code run in eclipse
PostPosted: Wed Nov 16, 2011 8:10 am 
Newbie

Joined: Wed Nov 16, 2011 8:02 am
Posts: 1
Greetings,

there seems to be wrong top level pom.xml.

Try to change the directory name "src/main/java" to "src/test/java" in the following piece of code (at the end of the file):
Code:
    ...
            <testResource>
                <filtering>false</filtering>
                <directory>[b]src/main/java[/b]</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </testResource>
   ...


and run mvn clean test again.

Tomas


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