-->
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.  [ 35 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: problem running caveatemptor-jpa-061110
PostPosted: Mon Dec 04, 2006 3:01 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
Following the directions in the README.txt (which suggest everything should work out-of-the-box), everything compiles fine but both the without and with EJB container integration tests fail:

Code:
C:\temp\caveatemptor-jpa-061110>ant test.integration
Buildfile: build.xml

compile:
    [mkdir] Created dir: C:\temp\caveatemptor-jpa-061110\build\classes
    [javac] Compiling 39 source files to C:\temp\caveatemptor-jpa-061110\build\classes
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.

copymetafiles:
     [copy] Copying 1 file to C:\temp\caveatemptor-jpa-061110\build\classes
     [copy] Copying 7 files to C:\temp\caveatemptor-jpa-061110\build\classes

test.integration:
    [mkdir] Created dir: C:\temp\caveatemptor-jpa-061110\build\test-output
   [testng] FAILED: withoutEJBContainer
   [testng] javax.naming.NameNotFoundException: EntityManagerFactories not bound
   [testng]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
   [testng]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
   [testng]     at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
   [testng]     at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
   [testng]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:626)
   [testng]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
   [testng]     at javax.naming.InitialContext.lookup(InitialContext.java:351)
   [testng]     at auction.test.EJB3IntegrationTest.getEntityManagerFactory(Unknown Source)
   [testng]     at auction.test.basic.PersistentStateTransitions.withoutEJBContainer(Unknown Source)
   [testng] ... Removed 20 stack frames
   [testng] FAILED: withEJBContainer
   [testng] javax.transaction.NotSupportedException: Transaction already active, cannot nest transactions.
   [testng]     at org.jboss.tm.TxManager.begin(TxManager.java:557)
   [testng]     at org.jboss.ejb3.embedded.UserTransactionImpl.begin(UserTransactionImpl.java:74)
   [testng]     at auction.test.basic.PersistentStateTransitions.withEJBContainer(Unknown Source)
   [testng] ... Removed 20 stack frames

   [testng] ===============================================
   [testng]     Integration JPA
   [testng]     Tests run: 2, Failures: 2, Skips: 0
   [testng] ===============================================


   [testng] ===============================================
   [testng] CaveatEmptor Integration
   [testng] Total tests run: 2, Failures: 2, Skips: 0
   [testng] ===============================================

     [echo] Validate the result of the test in build/test-output!

BUILD SUCCESSFUL
Total time: 22 seconds


Any ideas?
TIA, Clark


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 3:16 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You renamed the unzipped directory? Because the deployer scans for this:

<parameter name="scan_classpath" value="caveatemptor-jpa/build/classes"/>

If you print out System.classpath, you'll see how Hibernate finds the directory for scanning.

You can customize that in src/etc/testsuite-integration.xml

I guess you could rewrite the whole thing so that you pass down the basedir from Ants build.xml into TestNG as a deployment parameter for the EJB3 container. The alternative is to scan the whole classpath, which I don't like much (too slow).

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 04, 2006 4:46 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
Quote:
You renamed the unzipped directory?

No, actually I didn't rename anything. That is what the zip contains. I just downloaded caveatemptor-jpa-061110.zip again and verified it.

I went and renamed the unzip dir to caveatemptor-jpa and repeated the process but it gave the identical errors, so it must be something else.

Also, here's what is showing up in JNDI java:
Code:
   
   [testng] Namespace: java:
   [testng] #####################################
   [testng] +- comp.ejb3 (class: javax.naming.Context)
   [testng] |   NonContext: null
   [testng] +- caveatemptorTestingDatasource (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
   [testng] +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
   [testng] +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
   [testng] +- TransactionManager (class: org.jboss.tm.TxManager)
   [testng] #####################################

in the event it helps.

Thanks,
Clark


Top
 Profile  
 
 Post subject: Could someone else verify this?
PostPosted: Tue Dec 05, 2006 2:45 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
Could someone else please verify if this works (or doesn't) for them? It only takes a couple minutes to unzip it and run it if you have ant installed. Just unzip it and run ant in the root folder.

http://www.hibernate.org/hib_files/caveatemptor-jpa-061110.zip

Thanks,
Clark


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 3:26 pm 
Newbie

Joined: Tue Dec 05, 2006 3:23 pm
Posts: 4
It fails for me, too, though in a different way:

Administrator@typhoon /cygdrive/c/dev/caveatemptor-jpa-061110
$ JAVA_HOME=C:/Program\ Files/Java/jdk1.5.0_09 ant
Buildfile: build.xml

compile:

copymetafiles:

test.integration:
[delete] Deleting directory C:\dev\caveatemptor-jpa-061110\build\test-output
[mkdir] Created dir: C:\dev\caveatemptor-jpa-061110\build\test-output
[testng] FAILED: beforeTestMethod
[testng] org.dbunit.dataset.NoSuchTableException: COMMENT
[testng] at org.dbunit.database.DatabaseDataSet.getTableMetaData(Database
DataSet.java:192)
[testng] at org.dbunit.operation.DeleteAllOperation.execute(DeleteAllOper
ation.java:98)
[testng] at org.dbunit.operation.CompositeOperation.execute(CompositeOper
ation.java:67)
[testng] at auction.test.EJB3IntegrationTest.beforeTestMethod(Unknown Sou
rce)
[testng] ... Removed 22 stack frames
[testng] SKIPPED: afterTestMethod
[testng] SKIPPED: withoutEJBContainer
[testng] SKIPPED: beforeTestMethod
[testng] SKIPPED: afterTestMethod
[testng] SKIPPED: withEJBContainer

[testng] ===============================================
[testng] Integration JPA
[testng] Tests run: 6, Failures: 1, Skips: 5
[testng] ===============================================


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 3:42 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
Humble apologies. I forgot that you have to start the database (I forgot because I've had it running for days).

Probably safest to just have you follow the README.txt from the root dir (below) since it's been a few days since I went through it). Just follow steps 1 through 4.

Code:
The following Ant targets are available:

    clean                   Clean the build directory

    startdb                 Run HSQL database server with clean DB
    dbmanager               Start HSQL DB manager
    schemaexport            Exports schema DDL to file in build directory

    test.integration        Run the integration tests

    instrument.lazyloading  Enhance bytecode for lazy loading interception

1. Open your command shell and change to the project directory

2. Use 'ant startdb' to start a fresh HSQL database, keep the database running

3. Open a second command shell and change to the project directory

4. Use 'ant' to run the basic integration tests against HSQL DB (a schema is
   exported automatically for each test run).

5. Use 'ant schemaexport' to export the DDL file build/caveatemptor-jpa-ddl.sql

6. Use 'ant dbmanager' to open the HSQL database browser, note that
   the database is empty after each test run! Set automatic schema export to
   "create" instead of "create-drop", to see the schema and data from the last
   test run.

Thanks,
Clark


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 3:51 pm 
Newbie

Joined: Tue Dec 05, 2006 3:23 pm
Posts: 4
I apologize, too. I should have mentioned that I do have the database running (via "ant startdb" - I was following the README). If I kill it I get different errors.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 4:35 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
Try this, generate the ddl file and then run the hsql db manager and paste all the create statements into the sql window and run them. I think that's what I had to do. I'm not sure why, since persistence.xml has:

Code:
<!-- Create the database schema when this test.persistence unit is deployed, drop
                it (clean the database) when it is undeployed
           -->
           <property name="hibernate.hbm2ddl.auto" value="create-drop"/>

in it and thus should just build it as needed. But I seem to recall having to do this.

Thanks for bearing with me on this,
Clark


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 4:55 pm 
Newbie

Joined: Tue Dec 05, 2006 3:23 pm
Posts: 4
Okay, looks like I'm now up to your error. I used "ant schemaexport" to create the DDL file. That file doesn't run in dbmanager because of the leading alter tables (the tables don't exist yet). I removed the leading alter tables and then it ran. Now "ant" gives this error:

Code:
Administrator@typhoon /cygdrive/c/dev/caveatemptor-jpa-061110
$ JAVA_HOME=C:/Program\ Files/Java/jdk1.5.0_09 ant
Buildfile: build.xml

compile:

copymetafiles:

test.integration:
   [delete] Deleting directory C:\dev\caveatemptor-jpa-061110\build\test-output
    [mkdir] Created dir: C:\dev\caveatemptor-jpa-061110\build\test-output
   [testng] FAILED: withoutEJBContainer
   [testng] javax.naming.NameNotFoundException: EntityManagerFactories not bound

   [testng]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)

   [testng]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)

   [testng]     at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
   [testng]     at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
   [testng]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:62
6)
   [testng]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:58
8)
   [testng]     at javax.naming.InitialContext.lookup(InitialContext.java:351)
   [testng]     at auction.test.EJB3IntegrationTest.getEntityManagerFactory(Unkn
own Source)
   [testng]     at auction.test.basic.PersistentStateTransitions.withoutEJBConta
iner(Unknown Source)
   [testng] ... Removed 20 stack frames
   [testng] FAILED: withEJBContainer
   [testng] javax.transaction.NotSupportedException: Transaction already active,
cannot nest transactions.
   [testng]     at org.jboss.tm.TxManager.begin(TxManager.java:557)
   [testng]     at org.jboss.ejb3.embedded.UserTransactionImpl.begin(UserTransac
tionImpl.java:74)
   [testng]     at auction.test.basic.PersistentStateTransitions.withEJBContaine
r(Unknown Source)
   [testng] ... Removed 20 stack frames

   [testng] ===============================================
   [testng]     Integration JPA
   [testng]     Tests run: 2, Failures: 2, Skips: 0
   [testng] ===============================================


   [testng] ===============================================
   [testng] CaveatEmptor Integration
   [testng] Total tests run: 2, Failures: 2, Skips: 0
   [testng] ===============================================


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 5:37 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
Well at least I know it's repeatable. Hopefully the powers that be will offer a fix or a new zip file.

Thanks for the help,
Clark


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 06, 2006 7:19 pm 
Newbie

Joined: Wed Dec 06, 2006 7:06 pm
Posts: 1
Location: Copenhagen, Denmark
cupdike wrote:
Well at least I know it's repeatable. Hopefully the powers that be will offer a fix or a new zip file.

Thanks for the help,
Clark


Clark, edit src/etc/testsuite-integration-ejb3.xml and change caveatemptor-jpa to <parameter name="scan_classpath" value="caveatemptor-jpa-061110/build/classes"/> then everything will work.
I don't need to copy sql to the dbmanager. things work as described in the README

Andreas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 07, 2006 5:02 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Well, this is a mistake in the packaging. I need to release a new version that will default to a new directory name after unzipping, or have a changed configuration file for TestNG/EJB3 deployment scanning.

I'll probably do that next week.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 07, 2006 12:25 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
greiezer wrote:
Clark, edit src/etc/testsuite-integration-ejb3.xml and change caveatemptor-jpa to <parameter name="scan_classpath" value="caveatemptor-jpa-061110/build/classes"/> then everything will work.
I don't need to copy sql to the dbmanager. things work as described in the README

Andreas

I've tried renaming the root dir to caveatemptor-jpa, and I've tried it by editing the scan classpath (and I assume you fixed the project short name property in build.xml if you got it to work too). Still no dice--giving up until the new zip is put out.

If you don't need to copy the sql to the dbmanager, I'm guessing you've already run another version that put the schema in there, or there is something else different going on. I had a coworker step through the readme and try your changes and it still misbehaved until he manually put the schema in the dababase.

-Clark


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 07, 2006 1:29 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
It's really not a big deal. You just need to rename the directory to "caveatemptor". The scanner is looking for a directory that ends in "caveatemptor/build/classes/".

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 07, 2006 4:14 pm 
Newbie

Joined: Mon Dec 04, 2006 5:44 pm
Posts: 2
To Christian:

Can you provide readme about how to run caveatemptor on mysql too?

I am trying to use mysql as databases. Is the foreign key is mandatory?

MySQL seems have difficult to add foreign key.

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 35 posts ]  Go to page 1, 2, 3  Next

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.