Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Struts 2 tutorial errors

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Rusty Enisin
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same problem.
 
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why there are no posts from other posters displaying?
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
reply
    Bookmark Topic Watch Topic
  • New Topic