wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts 2 tutorial errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 tutorial errors" Watch "Struts 2 tutorial errors" New topic
Author

Struts 2 tutorial errors

Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
I am trying to run the Struts 2 + Spring 2 + JPA + AJAX tutorial found at http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html. But exceptions keep getting thrown during startup of tomcat. Try as I might I cannot seem to resolve it. Here is the error:



The key part appears to be



All the code is copied directly from the tutorial page. Any ideas?


The squeaky wheel gets the grease. Well, that or replaced...
Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
I found that it is really important to have exact version of jars specified. The easiest way to do this is run the maven script that comes in the download for the tutorial. Run the "mvn install" command first. Be sure you have the jta jar. Delete the test dir from the source code unless you have junit (they do not have it in the pom.xml).

Then run "mvn package" and maven will get all the dependent jars and then puts the app source and war file in a directory called "target". The jars are in target/quickstartSNAPSHOT/WEB-INF/lib.
Eric Nielsen
Ranch Hand

Joined: Dec 14, 2004
Posts: 194
Actually it looks to me like the key part is that persistence.xml isn't gettng parsed properly, and thus not allowing it to initialize the EntityManagerFactory. I'd double check that persistence.xml was copied cleanly and placed at the right place of the directory structure.
Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
Yes. I had persistance.xml in WebRoot/META-INF. This was incorrect. One of the things I noticed when I ran the maven build is that it was placed in src/META-INF. And applicationContext.xml was placed in src/ but I had placed it in /WEB-INF. It looks I had them in the wrong place.

I have since dropped Hibernate in favor of OpenJPA. And I have found bugs in Sruts2 that were resolved by moving to the latest version of Struts2. Where I had problems with this before, having persistence.xml in the right place seems to solve everything. Go figure...

Thanks for the response.
julio perez
Greenhorn

Joined: May 12, 2008
Posts: 1
I have the same problem.
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 435
Why there are no posts from other posters displaying?


Help gets you when you need it!
Sharad Sharma
Greenhorn

Joined: Jun 27, 2008
Posts: 4
i had the same problem but I am sorry to say that i exactly don't remember how i fixed this. But I had to make an entry in Struts.xml for Spring framework and had to add a library also. I hope some googling might help you out
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts 2 tutorial errors
 
Similar Threads
Tomcat 5.5 SEVERE: Error listenerStart
Struts 2 + Spring 2 + JPA + AJAX
Context Initialization Failed
org.jboss.deployers.spi.DeploymentException: JBoss 5.0.1
Struts 2 + Spring 2 + JPA + AJAX