I trying to upgrade myfaces from 2.0.18 to the latest 3.0.1 but I am getting Class not found exception with the below error
noClassDefFound: javax/faces/component/UIComponent
Could you please let me know what is causing this issue or where can i get this class to add.
Your issue is that version of MyFaces is for jakarta libs not javax libs.
From Apache MyFaces docs version 3.0.1:
"The upcoming Jakarta Faces 3.0. It's equals to JSF 2.3 but with
"jakarta.faces" packages and constants instead of "javax.faces"."
https://github.com/apache/myfaces
Related
I am using TomEE Plus 1.7.2 Server and try to start a webapp with OmniFaces included, but I get a Nullpointer exception:
WARNUNG: Could not instantiate eager request scoped beans for request /index.xhtml. Possibly the CDI request scope is not active. If this is indeed the case, see JavaDoc on org.omnifaces.cdi.Eager on how to remedy this.
java.lang.NullPointerException
at org.omnifaces.cdi.eager.EagerBeansWebListener.requestInitialized(EagerBeansWebListener.java:78)
When I use the EagerBeansFilter as shown at OmniFaces docs, I get a slight variation:
WARNUNG: Could not instantiate eager application scoped beans. Possibly the CDI application scope is not active. This is known to be the case in certain Tomcat and Jetty based configurations.
java.lang.NullPointerException
at org.omnifaces.cdi.eager.EagerBeansRepository.instantiateApplicationScopedAndRegisterListener(EagerBeansRepository.java:69)
Is this server not combinable with omnifaces?
TomEE is after WildFly one of most tested servers for OmniFaces, particularly because it uses almost everywhere in Java EE a different implementation as compared to WildFly (Apache vs Oracle). In the OmniFaces compatibility matrix you can find TomEE versions which successfully ran through all pages in OmniFaces showcase.
Those exceptions mentioned in your question will be thrown when CDI BeanManager couldn't find the OmniFaces EagerBeansRepository, which is an #ApplicationScoped bean. This in turn indicates a misconfigured CDI environment (e.g. wrong beans.xml or missing JNDI/listener configuration) or a dirty build (e.g. duplicate libraries). Verifying the CDI configuration and performing a full clean/rebuild should solve the problem.
At least, OmniFaces 2.2 or newer is technically incompatible with TomEE 1.x, because TomEE 1.x ships with JSF 2.1 and OmniFaces 2.2 or newer has a hard dependency on JSF 2.2 due to new <o:viewAction> tag. So, unless you modify TomEE to provide JSF 2.2, OmniFaces 2.2 or newer won't deploy and should fail deployment with below exception:
java.lang.NoClassDefFoundError: javax/faces/component/UIViewAction
The latest OmniFaces version which successfully deploys on a stock TomEE 1.7.x server is OmniFaces 2.1. If you want to use OmniFaces 2.2 or newer on a stock TomEE, then you need to upgrade to TomEE 7.x.
I'm using NetBeans IDE 8.0. The IDE issues a notification as shown in the following snap shot.
Classes of javax.faces.bean are gonna be deprecated
Is there any reason for this notification, may be the classes from the specified package are going to be deprecated shortly?
My application uses,
Mojarra 2.2.6
PrimeFaces 4.0
PrimeFaces Extension 1.1.0
GlassFish Server 4.0
OmniFaces 1.6.3
and other related components.
Since JavaEE 7, JSF favors CDI over Managed bean. That's why javax.faces.bean will eventually be deprecated but it's gonna be slowwwww.
FYI:
You should not have any other #ManagedBean beside #Named.
I'm trying to use the excellent OmniFaces library on a Glassfish v2.1 server.
It works well until I try to use the org.omnifaces.util.Faces class. In this case, I encounter a
java.lang.ClassNotFoundException: javax.servlet.ServletRegistration
From what I've gathered, it seems this class appeared with the Servlet 3.0 specification.
Glassfish v2.1 is only Servlet 2.5 compatible but OmniFaces documentation indicates that it only requires Servlet 2.5.
Is there something I'm missing ? Is this a dependency that was accidentally added ?
Full configuration is :
Myfaces 2.1.12
Glassfish v2.1.1 (9.1_02 Patch12)
OmniFaces 1.6
Thank you for your answers.
I've come across this article that explains things a bit more but I'm still confused as to whether or not it should work on Glassfish 2.1.
OmniFaces is indeed supposed to be Servlet 2.5 compatible, but that's not thoroughly tested as the development and showcase environments are Servlet 3.0 based. See also https://github.com/omnifaces/omnifaces/wiki/Java-EE-5-and-6-compatibility, so it may happen that something accidently slipped through. This is one of those things.
As per issue 298, this has been fixed for the current 1.8 snapshot.
I'm developping an entreprise application on jboss AS 7.1.
I was reading answers to those question (Q1 and Q2) asking for the same problem then mine and the solution was to upgrade to the Mojarra 2.1.9.
I'm using maven but i'm not referencing any Mojarra jar dependency as it's provided by jboss server and i don't know which version it uses itself and since those questions have been asked a long time ago then i don't know if the solution is just to add dependencies to my pom to override the version used by jboss(normally, jboss AS 7.1 has overcome this problem already, i don't understand why it still happen to me)..
Which version should i add or what is the best solution at this moment ?
Cheers.
JBoss AS 7.1.0 ships with Mojarra 2.1.5, so you definitely need to upgrade. Specifically JBoss 7.1.0 has however unfortunately a bug which makes it impossible to upgrade Mojarra from webapp's /WEB-INF/lib on. This was fixed in 7.1.1. For 7.1.0 you need to upgrade Mojarra in JBoss' own modules.
Detailed upgrade instructions for JBoss AS 7.x and EAP 6.x can be found in this answer: Upgrade JSF / Mojarra in JBoss AS / EAP / WildFly.
Update: as per the comments it turns out that you didn't carefully specify the version in the question and you're actually using 7.1.1 which ships with Mojarra 2.1.7 which you also definitely need to upgrade. Just drop the javax.faces.jar file of the desired Mojarra version (currently, 2.1.26 is latest available 2.1.x) in webapp's /WEB-INF/lib and add the following context parameter to webapp's web.xml:
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
I am trying to find out what implementation version of JSF that bundle with Glassfish 3.0.1. Is it Mojarra 2.0.2 or 2.0.3
Here http://glassfish.java.net/downloads/3.0.1-final.html, it only tell me that it is JSF 2.0 but not sure what implementation is it.
I remember you can find out about that information by writing 1-2 simple line of codes, but I forgot. I am using Java-EE 6 BTW
It is 2.0.2. You can replace it with a download of 2.0.3 or even 2.1.0-RC (don't forget to clean the cache).
FacesContext.class.getPackage().getImplementationVersion();