After extracting TomEE-plus (apache-tomee-1.0.0-plus.zip) and building the jsf example (on examples-4.0.0-src.zip\webapps\jsf), I came across the following error on catalina.*.log with the following message:
SEVERE: An error occured while initializing MyFaces: Class org.apache.openejb.jsf.CustomApplicationFactory is no javax.faces.application.ApplicationFactory
java.lang.IllegalArgumentException: Class org.apache.openejb.jsf.CustomApplicationFactory is no javax.faces.application.ApplicationFactory
Am I the only one who gets this error? Is there a solution or a workaround?
Already tried to use nightly build (version 78) and got
SEVERE: Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener java.lang.VerifyError: (class: org/apache/webbeans/jsf/OwbApplicationFactory, method: setApplication signature: (Ljavax/faces/application/Application;)V) Bad type in putfield/putstatic
I read about TomEE, watched the video, got excited but felt disappointed working with it and JSF 2.0, Hibernate, MySql and Primefaces. It has been frustrating for me working with TomEE and JSF. Configuration
Initially, I thought you could drop a JSF war in TomEE without issues but that is not true. TomEE jars conflicts with jars in a jsf web application. TomEE expects all your jars to be in TomEE lib directory - which is awful and not a good design. Some configurations that are usually done in a web application, TomEE expects them to be done in tomee.xml. This will not scale if you have multiple applications deployed in TomEE. I noticed too that it is not easy to swap out MyFaces jars and use javax.myfaces jar. Also, any attempt to use javaee-api jar is a no no.
I may be wrong in some of my assumptions and findings but a good way to go is for someone in the TomEE team to come up with a pure JSF 2.0 example that shows how:
1. To annotate the Managed bean
2. Create a service that fetches data from a MySQl database with a defined Entity bean
3. Show how to inject the service in a Managed bean
4. Show a .xhtml file that uses the Managed bean (use Primefaces as the add on component)
5.And Finally (very important) show the persistent.xml and what entries are required in web.xml and tomee.xml.
Which jar files should be in the web lib directory and which one should be in TomEE lib directory?
Don't point me to the examples, I have seen all of them. They are helpful but they did not solve the issues I raised.
A really simple functional and complete JSF 2.0 example will help a great deal.
JSF 2 runs fine in Tomcat. I am only testing it out in TomEE in order to take advantage of what java ee 6 offers. Currently, I use spring to inject services into beans. I was thinking of dropping Spring Framework for a complete java ee solution running in a light container like TomEE.
> JSF 2 runs fine in Tomcat. I am only testing it out in TomEE in order to
> advantage of what java ee 6 offers. Currently, I use spring to inject
> services into beans. I was thinking of dropping Spring Framework for a
> complete java ee solution running in a light container like TomEE.
> View this message in context:
> http://openejb.979440.n4.nabble.com/Running-TomEE-plus-jsf-Examples-Fails-tp4656561p4656567.html > Sent from the OpenEJB User mailing list archive at Nabble.com.
Thanks Romain. I have taken a quick look at the code and saw that it uses servlets, jsps and web services. Based on the configuration you supplied I am going to write a pure JSF 2.0 web application (.xhtml, Managed Bean, Service layer, MySql) to test it out. Your example is a good start for me. I will post my feed back when I am done.