• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Tomcat, JSF and JPA

 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have tried using ordinary Tomcat server with JSF 2.3 (I am using Eclipse).  Unfortunately, I am having as much problems getting JSF to work on Eclipse with Tomcat.  I have tried to get CDI working in Eclipse but to avall.  I have tried the options set out in this link Installing CDI in Tomcat, but cannot get CDI working.

If I stick to using TomEE and openJPA I am getting the following exception:

javax.el.ELException: <openjpa-3.1.2-r66d2a72 fatal user error> org.apache.openjpa.persistence.ArgumentException: No metadata was found for type "class com.waycontech.jsf.add.persistence.Student$$OwbNormalScopeProxy0". The class does not appear in the list of persistent types: [com.waycontech.jsf.add.persistence.Student].



It seems there is an inner class added to my Entity class which openJPA tries to persist instead of the class itself???

If I try to use Tomcat, I am having a problem using JSF.
If I try to use TomEE, I am having a problem with openJPA.

Any help would be appreciated,

Fintan
 
Saloon Keeper
Posts: 23409
159
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've split this post away from its original thread because it really wasn't related to that thread and deserves a thread of its own.

Perhaps the biggest problem here is the difference between vanilla Tomcat and TomEE.

Tomcat is a minimal-stack JEE server, supporting only the most basic JEE features, including servlets and JSPs. TomEE, on the other hand, bulks up to be a full-stack JEE server.

Critical differences are that WARs built for Tomcat must explicitly include implementation JARs for things like JSF and JPA. But JSF and JPA are defined as container-provided services for a full-stack JEE server and if you attempt to supply those JARs in a TomEE WAR, they will conflict with the JARs built into TomEE. In other words, you must either build a TomEE WAR without the jars required in a vanilla Tomcat WAR or you must deploy the WAR with metatdata that tells TomEE to use your application's JSF and JPA jars instead of the TomEE jars.

CDI is an entirely different bucket of worms. When last I checked CDI and the Spring Framework didn't like each other and CDI didn't provide a lot of the services that I depended on from Spring. While I hope that things have resolved amicably since then, I've not been working in that area for a long time, so I'm afraid I cannot be of help there. I hope someone else can inform us.

Your inner proxy class error reminds me of something from long ago, but I don't recall details. However, if this is coming from the vanilla Tomcat, it might be related to a limitation of using Spring JPA in vanilla Tomcat. As I said, JPA is not built into Tomcat, so you have to include a JPA implementation JAR for vanilla Tomcat WARs. However in the case of Spring Data JPA, there are also a pair of JARs that have to be installed into Tomcat itself (that is, into the TOMCAT_HOME/lib directory). Spring JPA uses AOP reweaving to put the JPA hooks into the POJO JPA Entity class code. If those reweaving functions are not available, something like the error you described may happen.
 
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic