JSF 2.3 on EAP 7 - jboss-eap-7

I would like to upgrade to JSF 2.3 on an Jboss EAP 7.
I followed this guide:
https://docs.jboss.org/author/display/WFLY10/JSF+Configuration#JSFConfiguration-ConfiguringaJSFapptouseanondefaultJSFimplementation
I splitted the JSF 2.3 jar following this guide:
How to install one jar variant of JSF (javax.faces.jar) on WildFly
However, when I start EAP 7 I get this error:
2017-04-30 12:55:00,280 WARN (JSFDependencyProcessor.java:75) = WFLYJSF0005: Unknown JSF version 'mojarra-2.3.0'. Default version 'mojarra-2.3.0' will be used instead.
2017-04-30 12:55:00,281 ERROR (ServiceControllerImpl.java:1955) = MSC000001: Failed to start service jboss.deployment.unit."monitoring.war".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.unit."monitoring.war".DEPENDENCIES: WFLYSRV0153: Failed to process phase DEPENDENCIES of deployment "monitoring.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJSF0014: Default JSF implementation slot 'mojarra-2.3.0' is invalid
at org.jboss.as.jsf.deployment.JSFDependencyProcessor.deploy(JSFDependencyProcessor.java:80)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
Does anybody successfully upgraded EAP 7 to JSF 2.3?

I made a mistake by misreading the place where to put all the needed jars.
For instance, the module javax.faces.api I put in the folder:
EAP_HOME/modules/system/layers/base/javax/faces/api/JSF_IMPL
Instead, it needed to go to:
EAP_HOME/modules/javax/faces/api/JSF_IMPL.
It was specified like this in the guide, but for other modules (Oracle JDBC Driver...) I needed to put stuff directly under the base folder. Apparently, for JSF, this needs to be in the root of the modules folder...
Now it is loaded correctly and, when I use LOG.info(FacesContext.class.getPackage().getImplementationVersion()); it prints 2017-05-02 08:59:47,872 INFO (Web.java:66) = 2.3.0

Related

Problem when deploying project with web socket on Jetty 9.2.13.v20150730

I've experienced a problem while migrating an app from PrimeFaces 5.2 to 10.
This problem is related to migration of web socket implementation from Primefaces to Omnifaces.
The versions I'm using:
PF: 10.0.0
PF extensions: 10.0.6
Omnifaces 2.7.7
CDI 1.1
JSF 2.2
I don't have anything fancy, just a simple PushBean which sends a message.
I've tried downgrading to PF8, but, as expected, the result is the same.
The configuration is made as requested in the documentation, in my web.xml file having this flag enabled:
<context-param>
<param-name>org.omnifaces.SOCKET_ENDPOINT_ENABLED</param-name>
<param-value>true</param-value>
</context-param>
However, when I try to deploy my app to jetty, I'm receiving the following error:
java.lang.IllegalStateException: OmniFaces failed to initialize! Report an issue to OmniFaces.
at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:88)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:800)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:444)
.
.
.
Caused by: java.lang.RuntimeException: Cannot load platform configurator
at javax.websocket.server.ServerEndpointConfig$Configurator.fetchContainerDefaultConfigurator(ServerEndpointConfig.java:123)
at javax.websocket.server.DefaultServerEndpointConfig.<init>(DefaultServerEndpointConfig.java:85)
at javax.websocket.server.ServerEndpointConfig$Builder.build(ServerEndpointConfig.java:301)
at org.omnifaces.cdi.push.Socket.registerEndpointIfNecessary(Socket.java:1114)
at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:85)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:800)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:444)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:791)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:294)
I'm guessing that there is something that I'm not doing right, but, I don't know exactly what is it.
Can you please, give a little hand?
Thanks in advance!
The stacktrace / exception ...
Caused by: java.lang.RuntimeException: Cannot load platform configurator
at javax.websocket.server.ServerEndpointConfig$Configurator.fetchContainerDefaultConfigurator(ServerEndpointConfig.java:123)
at javax.websocket.server.DefaultServerEndpointConfig.<init>(DefaultServerEndpointConfig.java:85)
at javax.websocket.server.ServerEndpointConfig$Builder.build(ServerEndpointConfig.java:301)
This is coming from the javax.websocket API jar, when it attempts to find the Server Container Default Configuration (in other words, the implementation specific defaults, which would be Jetty)
If you are running Jetty, you need to be including the jetty support jar for javax.websocket.server in your classpath.
Which on Jetty 9.2.x would be the javax-websocket-server-impl-<ver>.jar file (and associated dependencies).
Per #BalusC, omnifaces is just a web-fragment deployed in your WAR's WEB-INF/lib.
That means you have to enable support for websocket on the Jetty server side.
For standalone (using ${jetty.base} and ${jetty.home} split) this means enabling the correct module for your version of Jetty.
Jetty ver
WebSocket spec
Module
Jetty 8.x and older
n/a
n/a
Jetty 9.0.x
n/a
n/a
Jetty 9.1.x
javax.websocket (beta)
websocket
Jetty 9.2.x - 9.4.x
javax.websocket 1.0
websocket
Jetty 10.0.x
javax.websocket 1.1
websocket-javax
Jetty 11.0.x
jakarta.websocket 2.0
websocket-jakarta
To do that you'll use the command line.
Jetty 9.x
[~]$ cd /path/to/my-jetty-base
[my-jetty-base]$ java -jar /path/to/jetty-home/start.jar
--add-to-start=websocket
Jetty 10+
[~]$ cd /path/to/my-jetty-base
[my-jetty-base]$ java -jar /path/to/jetty-home/start.jar
--add-module=websocket-javax

Webapp fails with "JBAS011232: Only one JAX-RS Application Class allowed" after adding a maven dependency to hadoop-azure

I have a webapp that runs fine in JBoss EAP 6.4. I want to add some functionality to my webapp so that it can process Parquet files that reside in AzureBlob storage. I add a single dependency to my pom.xml:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-azure</artifactId>
<version>3.1.0</version>
</dependency>
If I now try to start my webapp, it fails at start up:
09:29:43,703 ERROR [org.jboss.msc.service.fail] (MSC service thread
1-10) MSC000001: Failed to start service
jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE:
JBAS018733: Failed to process phase POST_MODULE of deployment
"myApp-0.0.1-SNAPSHOT.war" at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980)
[jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
... Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011232: Only one JAX-RS Application Class allowed.
com.sun.jersey.api.core.ResourceConfig
com.sun.jersey.api.core.DefaultResourceConfig
com.sun.jersey.api.core.PackagesResourceConfig
com.mycompany.myapp.rest.RestApplication
com.sun.jersey.api.core.ClassNamesResourceConfig
com.sun.jersey.api.core.ScanningResourceConfig
com.sun.jersey.api.core.servlet.WebAppResourceConfig
com.sun.jersey.api.core.ApplicationAdapter
com.sun.jersey.server.impl.application.DeferredResourceConfig
com.sun.jersey.api.core.ClasspathResourceConfig at
org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:206)
at
org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:104)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] ...
5 more
09:29:43,709 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) JBAS014612: Operation ("deploy") failed -
address: ([("deployment" => "myApp-0.0.1-SNAPSHOT.war")]) - failure
description: {"JBAS014671: Failed services" =>
{"jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE" =>
"org.jboss.msc.service.StartException in service
jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE:
JBAS018733: Failed to process phase POST_MODULE of deployment
"myApp-0.0.1-SNAPSHOT.war"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011232: Only one JAX-RS Application Class allowed.
com.sun.jersey.api.core.ResourceConfig
com.sun.jersey.api.core.DefaultResourceConfig
com.sun.jersey.api.core.PackagesResourceConfig
com.mycompany.myapp.rest.RestApplication
com.sun.jersey.api.core.ClassNamesResourceConfig
com.sun.jersey.api.core.ScanningResourceConfig
com.sun.jersey.api.core.servlet.WebAppResourceConfig
com.sun.jersey.api.core.ApplicationAdapter
com.sun.jersey.server.impl.application.DeferredResourceConfig
com.sun.jersey.api.core.ClasspathResourceConfig"}}
The message "JBAS011232: Only one JAX-RS Application Class allowed" seems to be caused by my webapp trying to use both RestEasy and Jersey. JBoss uses RestEasy by default. Apparently, hadoop-azure must have a Jersey application class. How can I eliminate this problem by indicating that I don't want to use the Jersey-based application class?
hadoop-azure pulls in hadoop-common, which pulls in Jersey. In the version of hadoop-azure you're using, hadoop-common is in compile <scope>. In new version, it is in provided scope. So you can just upgrade the hadoop-azure dependency to the latest one. If you need hadoop-common to compile, then you can redeclare hadoop-common and put it in provided scope.

Issue in Jboss 7.2.2 migration

I am deploying a WAR file to JBoss EAP 7.2.2. During deployment, I am getting
"Caused by: java.lang.IllegalArgumentException: Unable to load generated mapper class com.amadeus.jcp.services.ttr.display.structured.builder.response.selma.mapper.offer.DisplayTripCartResponseOfferQuotationMapperSelmaGeneratedClass"
which is caused by "Caused by: java.lang.ClassNotFoundException: com.amadeus.jcp.services.ttr.display.structured.builder.response.selma.mapper.offer.DisplayTripCartResponseOfferQuotationMapperSelmaGeneratedClass"
It is a selma generated class and available in a jar inside WEB-INF/lib.
Same WAR file is deploying successfully in JBoss EAP 7.1.
As per class loader hierarchy, it should be identified but not happening.
Anybody have any idea of this issue, please help.
Verified standalone.xml and jboss-deployment-structure.xml. Using same version before and after migration except for name space version upgrade to subsystems.
Using Java 1.8.0_191

java.util.concurrent.ExecutionException when starting tomcat 7

How to solve it?? I installed Java 7 and this occured when starting tomcat which has my application. I think the problem is based on my application. (
Tomcat 7 run successfully before. I installed java 7 and uninstall java 6 after this installation problem occured)
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/m.apus]]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/m.apus]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 7 more
Caused by: java.lang.NoClassDefFoundError: javax/ejb/FinderException
at java.lang.Class.getDeclaredFields0(Native Method)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
... 21 more
Edit
LifecycleException ocurred before I installed Java 7. I think this exception is not based on that. But I don't know why I encounter this exception.
Use Java EE libraries, there's files needed to support EJB. You've got java.lang.NoClassDefFoundError for the class that is in the library that implements Java EE specification. The file you you need is javax.ejb.jar from version 6 Java EE default reference implementation. Supply Java EE libraries with your Java web applications. Initially Tomcat has not support for EJB.
Tomcat 7 is not a (full) Java EE container. It is "just" a servlet/JSP server.
If you need EJBs, you'll need a full-fledged Java EE server such as Glassfish or JBoss

JBoss 5 - Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator

I keep getting that exception when I run JBoss. I'm in the process of migrating an application from JBoss 4.2.3 to JBoss 5.
First I had to migrate from Spring 2.5 to Spring 3.0.3, then from spring-jpa to spring-orm due to exceptions I was getting and solutions I found on google.
But now I've got that one and I'm not able to solve it. I'm also using Hibernate 3.5.4 Final.
This is the exception:
Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
at java.lang.Class.getConstructor0(Class.java:2706)
at java.lang.Class.getDeclaredConstructor(Class.java:1985)
at org.hibernate.cfg.AnnotationConfiguration.applyHibernateValidatorLegacyConstraintsOnDDL(AnnotationConfiguration.java:443)
... 106 more
There might be a conflict between Hibernate versions, as JBoss 5+ comes bundled with Hibernate. Make sure that you only have one version of Hibernate in your server (check the /lib dir).

Resources