The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

jacques (4) [Avatar] Offline
#1
Hello,

Probably I will look like a fool but I am relatively new to Java, Hibernate, Spring and other JavaWorld well knowned acronyms and buzzwords. I am coming from 10 years of Delphi mainly writing development frameworks so that aspect, I know a bit.

I am using NetBeans IDE and I simply cannot figure out how to install ORMunit to use it with my projects. I tried to set up projects using the provided structure in crichardson_srcs_xxx.zip but I cannot compile as there is always some library missing. There is something I am doing wrong for sure.

Thanks in advance for your help

Jacques
jacques (4) [Avatar] Offline
#2
Re: Installing ORMunit
I tend to agree with Vladimir...

After figuring out the maven system and correcting two entries in pom files (the first one being ... as described in the other thread and the other one being the transaction/jta/1.0.1B instead of 1.0.1b) in the ormunit-hibernate.pom, I got to this message set from which I cannot figure out where to go from there.

The file http://repo1.maven.org/maven2/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar does not exists.

jacques@ledj0-desktop:~/prjcts/pia-1.0-SNAPSHOT$ mvn install
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] POJOs in Action
[INFO] POJOs In Action - Util
[INFO] POJOs in Action - Utils Spring
[INFO] POJOs in Action - shared spring hibernate
[INFO] POJOs in Action - Chapters 4 and 6, ORMUnit for Hibernate
[INFO] POJOs in Action - Chapter 1, Hibernate Banking Example
[INFO] POJOs in Action - Chapter 3, Domain model
[INFO] POJOs in Action - Chapter 9, ORMUnit for iBATIS
[INFO] POJOs in Action - Chapter 13, iBATIS Lock Manager
[INFO] POJOs in Action - Chapter 6, Hibernate domain model
[INFO] POJOs in Action - chapter 7, POJO facade
[INFO] POJOs in Action - Chapter 7, POJO facade, Hibernate
[INFO] POJOs in Action - Chapter 8, Exposed Hibernate Web Application
[INFO] POJOs in Action - shared spring ibatis
[INFO] POJOs in Action - Chapter 9, Transaction Script examples
[INFO] POJOs in Action - Chapter 11, Dynamic queries domain model
[INFO] POJOs in Action - Chapter 11, Hibernate Dynamic Paged Queries
[INFO] POJOs in Action - Chapter 11, Dynamic queries, iBATIS
[INFO] POJOs in Action - Chapter 12, Concurrency, domain model
[INFO] POJOs in Action - Chapter 12, Hibernate concurrency
[INFO] POJOs in Action - Chapter 12, Concurrency, transaction script
[INFO] POJOs in Action - Chapter 13, Offline locking, domain model
[INFO] POJOs in Action - Chapter 13, Hibernate Offline Locking
[INFO] ----------------------------------------------------------------------------
[INFO] Building POJOs in Action
[INFO] task-segment: [install]
[INFO] ----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /var/prjcts/pia-1.0-SNAPSHOT/pom.xml to /home/jacques/.m2/repository/net/chrisrichardson/pia/1.0-SNAPSHOT/pia-1.0-SNAPSHOT.pom
[INFO] ----------------------------------------------------------------------------
[INFO] Building POJOs In Action - Util
[INFO] task-segment: [install]
[INFO] ----------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] Building jar: /var/prjcts/pia-1.0-SNAPSHOT/pia-util/target/pia-util-1.0-SNAPSHOT.jar
[INFO] [install:install]
[INFO] Installing /var/prjcts/pia-1.0-SNAPSHOT/pia-util/target/pia-util-1.0-SNAPSHOT.jar to /home/jacques/.m2/repository/net/chrisrichardson/pia-util/1.0-SNAPSHOT/pia-util-1.0-SNAPSHOT.jar
[INFO] ----------------------------------------------------------------------------
[INFO] Building POJOs in Action - Utils Spring
[INFO] task-segment: [install]
[INFO] ----------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] [jar:jar]
[INFO] Building jar: /var/prjcts/pia-1.0-SNAPSHOT/pia-util-spring/target/pia-util-spring-1.0-SNAPSHOT.jar
[INFO] [install:install]
[INFO] Installing /var/prjcts/pia-1.0-SNAPSHOT/pia-util-spring/target/pia-util-spring-1.0-SNAPSHOT.jar to /home/jacques/.m2/repository/net/chrisrichardson/pia-util-spring/1.0-SNAPSHOT/pia-util-spring-1.0-SNAPSHOT.jar
[INFO] ----------------------------------------------------------------------------
[INFO] Building POJOs in Action - shared spring hibernate
[INFO] task-segment: [install]
[INFO] ----------------------------------------------------------------------------
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /var/prjcts/pia-1.0-SNAPSHOT/shared-spring-hibernate/pom.xml to /home/jacques/.m2/repository/net/chrisrichardson/shared-spring-hibernate/1.0-SNAPSHOT/shared-spring-hibernate-1.0-SNAPSHOT.pom
[INFO] ----------------------------------------------------------------------------
[INFO] Building POJOs in Action - Chapters 4 and 6, ORMUnit for Hibernate
[INFO] task-segment: [install]
[INFO] ----------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading: http://repo1.maven.org/maven2/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar
[WARNING] Unable to get resource from repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) javax.transaction:jta:jar:1.0.1B

Try downloading the file manually from:
http://java.sun.com/products/jta

Then, install it using the command:
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta \r
-Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file

Path to dependency:
1) net.chrisrichardson:ormunit-hibernate:jar:1.0-SNAPSHOT
2) javax.transaction:jta:jar:1.0.1B

----------
1 required artifact is missing.

for artifact:
net.chrisrichardson:ormunit-hibernate:jar:1.0-SNAPSHOT

from the specified remote repositories:
central (http://repo1.maven.org/maven2)


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11 seconds
[INFO] Finished at: Tue Jul 18 21:14:48 EDT 2006
[INFO] Final Memory: 6M/13M
[INFO] -------------------------------------------------------------

I wish I could install ORMunit utilities so I can enforce this TDD approach.

Thanks in advance for your assistance.

Jacques
jacques (4) [Avatar] Offline
#3
Re: Installing ORMunit
Sorry for the last post. I did not realize there was a suggestion for downloading the file from Sun site and installing it manually.

Next hurdle is the following message at the end of a long (over 4 minutes) process. I don't know if this BUILD ERROR message is fatal or if only a test failed due to local environment.


18-Jul-2006 9:45:54 PM org.hibernate.cache.EhCacheProvider buildCache
WARNING: Could not find configuration [org.hibernate.cache.StandardQueryCache]; using defaults.
18-Jul-2006 9:45:54 PM org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 6 named queries
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 9.465 sec <<< FAILURE!
Running net.chrisrichardson.foodToGo.viewOrdersTransactionScripts.dao.OrderDAOIBatisImplMockTests
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.413 sec

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

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 minutes 34 seconds
[INFO] Finished at: Tue Jul 18 21:45:57 EDT 2006
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------
jacques@ledj0-desktop:~/prjcts/pia-1.0-SNAPSHOT$ cd prjcts jacques@ledj0-desktop:~/prjcts/pia-1.0-SNAPSHOT$

Thanks again for your help.

Jacques
ceracm (113) [Avatar] Offline
#4
Re: Installing ORMunit
Two things:

1. try 'mvn -Dmaven.test.skip=true install' to skip the tests or 'mvn -fn install' to tell mvn to ignore errors

2. Send me email: chris at chrisrichardson.net

Chris
jacques (4) [Avatar] Offline
#5
Re: Installing ORMunit
These switches worked as expected and I finally could complete a successfull build. In the case where some eventual netbeans user or newbie like me would encounter the same problems, I want to add the following precisions.

After a successfull build with or without the aforementionned maven switches, the following steps should be taken for Netbeans users:

1- using Library manager, create a library named ORMunit to which you add the following jars:

.../pia-1.0-SNAPSHOT/ormunit-hibernate/target/ormunit-hibernate-1.0-SNAPSHOT.jar,
.../pia-1.0-SNAPSHOT/pis-util/target/piautil-1.0-SNAPSHOT.jar,
.../pia-1.0-SNAPSHOT/pis-util-spring/target/piautil-spring-1.0-SNAPSHOT.jar,
.../spring-framework-1.2.8/dist/spring-mock.jar

The last jar file contains the org.springframework.test package and can be found in the spring framework dist directory.

2- add the ORMunit library to the Libraries section of the tested project: this will automatically include these jars in the project's classpath.

From there, templates could be created easily to streamline the specific testing units.

Thanks again for your help.

Jacques