-->
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 Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Thu Dec 07, 2006 7:03 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
christian wrote:
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/".

Really? When I look in testsuite-integration-ejb3.xml I see:
Code:
    <!-- Two locations to scan for META-INF/persistence.xml and @Entity classes -->
    <parameter name="scan_classpath" value="caveatemptor-jpa/build/classes"/>

And it doesn't matter if I change all the references to match the root directory, or change the root directory to match the references, I still get:
Code:
test.integration:
    [mkdir] Created dir: C:\temp\caveatemptor\build\test-output
   [testng] FAILED: withoutEJBContainer
   [testng] javax.naming.NameNotFoundException: EntityManagerFactories not bound
...
and friends.

I'm guessing the posted zip is different than what your working with.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 2:54 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
OK, so rename it to "caveatemptor-jpa". I know, voodoo.

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 2:57 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I've just done this and it works fine:

unzip ../caveatemptor-jpa-061110.zip
mv caveatemptor-jpa-061110 caveatemptor-jpa
cd caveatemptor-jpa
ant startdb
(new CLI) ant

Yes, the second step shouldn't be necessary.

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 2:58 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I do not use MySQL, so somebody else will have to adapt the examples (there is a bit more to do than just changing the dialect) and send me the changes. I can then integrate them.

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 1:47 pm 
Newbie

Joined: Fri Dec 08, 2006 1:37 pm
Posts: 3
I cannot get this to work either. I have tried following the step by step in the post from "Posted: Fri Dec 08, 2006 1:57 am" and get the "FAILED: withEJBContainer" and "FAILED: withEJBContainer" failures. I have run it on Windows XP and on SuSE 10 (as user and root) without any luck. I have always had to manually create the schema too, which is not in that step by step. I have tried it with the top dir being "caveatemptor-jpa" and "caveatemptor" (the latter included changing the configs as needed.

I will wait for the new zip to give it another try unless some other insight comes up.

Joe


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 1:53 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Folks, all I will do in the updated ZIP is rename a directory. If you tried this and it didn't work, a new ZIP will not work either.

I have no problems at all here on three different systems.

You need to tell me exactly what you are doing, otherwise you are on your own.

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 2:16 pm 
Newbie

Joined: Fri Dec 08, 2006 1:37 pm
Posts: 3
I did the following on Windows XP:

1. download the .zip file
2. unzip it
3. ran "move caveatemptor-jpa-061110 caveatempty-jpa"
4. ran "ant startdb"
5. ran "ant schemaexport"
6. opened build\caveatemptor-jpa-ddl.sql and copied DDL skipping intial drop tables
7. ran "ant dbmanager"
8. pasted and ran the export DDL, tables now appears in tree
9. ran "ant"

The resulting output is:

Buildfile: build.xml

compile:

copymetafiles:

test.integration:
[delete] Deleting directory C:\dl\hibernate\caveatemptor\build\test-output
[mkdir] Created dir: C:\dl\hibernate\caveatemptor\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: 4 seconds


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 5:11 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Why are you doing all these things? This is not what the README says and what I've posted earlier.

It's really simple, three steps.

Quote:
3. ran "move caveatemptor-jpa-061110 caveatempty-jpa"


No, you didn't. Otherwise the name of the directory would be "caveatemptor-jpa". In your log it is "caveatemptor".

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 6:00 pm 
Newbie

Joined: Fri Dec 08, 2006 1:37 pm
Posts: 3
Actually, yes I did. I forgot to mention that I tried both renamings, based on other posts. Neither worked. Sorry for the confusion, the screen had the last attempt and that is what I pasted.

On my system, for whatever reason, the steps you posted earlier and the steps in the README do not work. I do not get the schema autopopulated, so step #4 in the README is hopelessly bound to fail on the lack of a COMMENT table, unless I do #5 and #6 first.

So, I am left with a couple possible conclusions:
1. Something is missing in the zip
2. Something is missing in the steps or build process
3. Something is different between the environment you and I are running

Since it works so well for you, but not for me or some of the other posters, I am inclined to suspect #3. You insistance that "This is not what the README says and what I've posted earlier." indicates you are not considering that or don't think it is possible.

Have you tried the process on a "clean machine" with only a JDK and Ant installed? Since at least 3 posters have tried your process and it failed, you may have something else in your environment that we don't have. Also, what versions of the JDK and Ant are you using?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 7:27 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
All the posters made different mistakes and did not provide enough information (and yes, the directory name in the default ZIP is wrong, my mistake). I've tested the ZIP that is on the website several times. Except for the wrong directory name, everything is fine.

I can imagine a Windows problem with the slashes instead of backslashes in the scanner configuration path. But since I don't use Windows, somebody else will have to provide more information if they get it running on Windows.

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 10:44 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
christian wrote:
All the posters made different mistakes and did not provide enough information

I'm (blissfully ;-) not aware of any mistakes I've made. And I didn't realize you were looking for more information. I posted what I've tried and my results. I'd be happy to provide any info you ask for and try anything else you can suggest. I'm running ant 1.6.5 and JDK 1.5.0_06 on WinXP.

The two symptoms I see are that the auto schema generation isn't working and that the EntityManagerFactory JNDI stuff isn't getting set up. Is the scanner responsible for setting up JNDI or just with finding entities? Is there any way to debug why the auto schema generation isn't running? Maybe (hopefully) the problems are related.

Quote:
I can imagine a Windows problem with the slashes instead of backslashes in the scanner configuration path.

It's not just a windows problem, I have reproduced it on linux. I have reproduced it from both the zip and the gz version.

Thanks,
Clark


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 09, 2006 5:19 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The problem is only the configuration of the scanner. If it doesn't find the annotated .class files and the META-INF/persistence.xml in the build/classes/ directory, it won't deploy the persistence unit.

Hence no automatic schema export and "EntityManager not found".

Please everyone: Edit your src/etc/testsuite-integration-ejb3.xml file and use this:

Code:
    <!-- Location to scan for META-INF/persistence.xml and @Entity classes -->
    <parameter name="scan_classpath" value="build/classes"/>


Remove the old scan_classpath configuration. Try a backslash "build\classes" on Windoze.

If neither works, I have no idea what could be wrong. Do that next:

Code:
        // Deploy all EJBs found on classpath (fast, scans only build directory)
        // This is a relative location, matching the substring end of one of java.class.path locations!
        // Print out System.getProperty("java.class.path") to understand this...
        EJB3StandaloneBootstrap.scanClasspath(scanClasspath);


You should see the directory name you have configured as the end of a line of the system classpath configuration. Just print out System.getProperty()....

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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 09, 2006 4:09 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
SOLVED! I have gotten it to run on both linux and windows. There's two problems:

1. The hibernate-annotations.jar is required in the runtime dir.

I'm not sure how it runs for others without it there (I get class not found exceptions on ForeignKey without it there). Possibly others have it in the jvm ext dir or else there is some other problem with the classpath stuff in ant. Obviously it shouldn't have to be in the project twice--perhaps there's some build.xml refactoring that's needed.

2. The scan_classpath value is os path.separator sensitive.

Unfortunately, there doesn't seem to be a value that will work between both windows and nix platforms. This could probably be done with an ant substitution on ${path.separator}, but the testsuite file is not copied which is how the substitution is usually done (but I'm no ant expert). But it seems like the scanner should handle this kind of thing.

Code:
scan_classpath value:     Windows:        Linux:
"build\classes"           works           doesn't work
"build/classes"           doesn't work    works
"build//classes"          doesn't work    doesn't work


Also, <project root> in front of any working entry also works.

-Clark


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 09, 2006 4:54 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Quote:
1. The hibernate-annotations.jar is required in the runtime dir.


Definitely not. You'd be the first person to "discover" this, and there are thousands using it like a regular lib without any problems.

Quote:
2. The scan_classpath value is os path.separator sensitive.


That is what I guessed. So I will have to come up with a solution that works on Windoze.

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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 09, 2006 6:02 pm 
Beginner
Beginner

Joined: Tue Nov 14, 2006 4:11 pm
Posts: 23
Well, let me explain how it works repeatably and on multiple platforms for me:

1. Unpack the zip
2. Windows: set scan_classpath to"build\classes". Nix: "build/classes"
3. In separate shell, run: ant startdb
4. Run: ant

This produces:
Code:
[testng] Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.ForeignKey

ForiegnKey is found in the annotations jar. So then I copy that jar into the runtime dir, rerun ant, and everything works.

Folks can draw their own conclusions about why that is and what it implies.

I'll look forward to when I don't have to monkey with the project to get it to run. But for now, having "discovered" that copying the jar works, I'll settle for it.


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 Previous  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.