How to make CDI BeanManager instance is available in wildfly 11.0? - jsf

I am using JSF 2.3 and richfaces 4.5.17. I want to use Omnifaces in my war project. Firstly it was giving me class clash exception for ApplicationFactory class. On googling, came to know about CDI bean manager.
Now, I am trying to add CDI Bean manager in my EAR. But I am continuously getting following exception:
{"WFLYCTL0062: Composite operation failed and was rolled back. Steps
that failed:" => {"Operation step-2" => {"WFLYCTL0080: Failed
services" =>
{"jboss.undertow.deployment.default-server.default-host./my-war" =>
"java.lang.RuntimeException: java.lang.IllegalStateException: CDI
BeanManager instance is not available in this environment.
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: CDI BeanManager instance is not
available in this environment.
Caused by: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
Caused by: java.lang.NullPointerException"}}}}
Following is my Build structure:
my-ear.ear
-- my-ejb.jar
-- my-entity.jar
-- my-war.war
I have put empty beans.xml file in my-war/WEB-INF.
I also have added following dependencies in my-war/WEB-INF/lib:
omnifaces-3.4.1.jar
cdi-api-2.0.jar
jsr311-api-1.1.1.jar
weld-se-shaded-3.1.3.Final.jar
I came to know online that wildfly has its internal CDI and no need to install separate. I referred these links:
CDI Reference
omnifaces-exception-cdi-beanmanager-instance-is-not-available-in-jndi
EDIT
Root cause of my using Omnifaces jar is to get popup functionality for image view using byte[]. And another functionality I want is to include JSP page in XHTML. These both together provided by Omnifaces. Full logs of the error I am getting here is:
????????????????????????????????????????????????????????????????????????????????
? ?? ? ?
? ? ????? ? OmniFaces failed to initialize! ?
? ???? ?????? ? ?
? ?????? ??????? ? This OmniFaces version requires CDI, ?
? ??????? ??????? ? but none was found on this environment. ?
? ??????????????????????? ? ?
? ??????????????????????? ? OmniFaces 3.x requires a minimum of JSF 2.3.?
? ????????????????????? ? Since this JSF version, the JSF managed bean?
? ????????????????????? ? facility #ManagedBean is DEPRECATED in ?
? ?????????????????????? ? in favour of CDI and CDI has become a ?
? ?????????????????????? ? REQUIRED dependency for JSF 2.3. ?
? ?????????????????????? ? ?
? ??????????????????????? ? ?
? ???????????????????????? ? ?
? ???????????????????????? ? ?
? ???????????????? ???????? ? ?
? ????????????????????????? ? ?
? ?????????????????????????? ? ?
? ?????????????????????????? ? ?
? ???????????????????????????? ? ?
? ???????????????????????????? ? ?
? ???????????????????????????? ? You have 3 options: ?
?????????????????????????????????? 1. Downgrade to OmniFaces 1.x. ?
?????????????????????????????????? 2. Install CDI in this environment. ?
?????????????????????????????????? 3. Switch to a CDI capable environment. ?
?????????????????????????????????? ?
?????????????????????????????????? For additional instructions, check ?
?????????????????????????????????? http://omnifaces.org/cdi ?
?????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????
[::::::::::] 16:31:56,259 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 92) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./my-war: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./my-war: java.lang.RuntimeException: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:84) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_151]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_151]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151]
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:241)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:99) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
... 6 more
Caused by: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
at org.omnifaces.ApplicationListener.checkCDIImplAvailable(ApplicationListener.java:199)
at org.omnifaces.ApplicationListener.checkCDI11Available(ApplicationListener.java:116)
at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:77)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:205)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:174)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508) [wildfly-undertow-11.0.0.Final.jar:11.0.0.Final]
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:239)
... 8 more
Caused by: java.lang.NullPointerException
at org.omnifaces.ApplicationListener.checkCDIImplAvailable(ApplicationListener.java:196)
... 22 more
[::::::::::] 16:31:56,272 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 4) WFLYCTL0013: Operation ("deploy") failed - address: ({"deployment" => "my-ear-ear-8.1.391.ear"}) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./my-war" => "java.lang.RuntimeException: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
Caused by: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
Caused by: java.lang.NullPointerException"}}
[::::::::::] 16:31:56,276 ERROR [org.jboss.as.server] (management-handler-thread - 4) WFLYSRV0021: Deploy of deployment "my-ear-ear-8.1.391.ear" was rolled back with the following failure message:
{"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./my-war" => "java.lang.RuntimeException: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
Caused by: java.lang.IllegalStateException: CDI BeanManager instance is not available in this environment.
Caused by: java.lang.NullPointerException"}}

Related

OmniFaces throws java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated

I've updated to Omnifaces 3.3 using build.gradle:
compile group: 'org.omnifaces', name: 'omnifaces', version: '3.3'
My EAR can run with 3.2, but I get the following errors when deploy 3.3:
21:07:07,856 INFO [org.omnifaces.ApplicationInitializer] (ServerService Thread Pool -- 31) Using OmniFaces version 3.3
21:07:07,876 INFO [io.undertow.websockets.jsr] (ServerService Thread Pool -- 31) UT026005: Adding programmatic server endpoint class org.omnifaces.cdi.push.SocketEndpoint for path /omnifaces.push/{channel}
21:07:07,878 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 31) Initializing Mojarra 2.3.9.SP01 for context '/GoStopHandle'
21:07:08,523 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 31) Monitoring file:/usr/local/Cellar/wildfly-as/16.0.0.Final/standalone/tmp/vfs/deployment/deploymentbed7dce99d600c8e/GoStopHandleWAR.war-4113c165328ad65/WEB-INF/faces-config.xml for modifications
21:07:08,527 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (ServerService Thread Pool -- 31) Running on PrimeFaces 7.0.5
21:07:08,527 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (ServerService Thread Pool -- 31) Running on PrimeFaces 7.0.5
21:07:08,527 SEVERE [org.omnifaces.ApplicationProcessor] (ServerService Thread Pool -- 31) OmniFaces failed to initialize! Report an issue to OmniFaces.: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
at deployment.GoStopHandle.ear.GoStopHandleWAR.war//org.omnifaces.ApplicationProcessor.checkDuplicateResourceHandler(ApplicationProcessor.java:88)
at deployment.GoStopHandle.ear.GoStopHandleWAR.war//org.omnifaces.ApplicationProcessor.processEvent(ApplicationProcessor.java:72)
at javax.faces.api#2.3.9.SP01//javax.faces.event.SystemEvent.processListener(SystemEvent.java:123)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.applicationimpl.Events.processListeners(Events.java:253)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.applicationimpl.Events.invokeListenersFor(Events.java:231)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.applicationimpl.Events.publishEvent(Events.java:115)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:127)
at javax.faces.api#2.3.9.SP01//javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
at javax.faces.api#2.3.9.SP01//javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:553)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:264)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:216)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:185)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:250)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
21:07:08,528 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 31) Critical error during deployment: : java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
at deployment.GoStopHandle.ear.GoStopHandleWAR.war//org.omnifaces.ApplicationProcessor.checkDuplicateResourceHandler(ApplicationProcessor.java:88)
at deployment.GoStopHandle.ear.GoStopHandleWAR.war//org.omnifaces.ApplicationProcessor.processEvent(ApplicationProcessor.java:72)
at javax.faces.api#2.3.9.SP01//javax.faces.event.SystemEvent.processListener(SystemEvent.java:123)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.applicationimpl.Events.processListeners(Events.java:253)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.applicationimpl.Events.invokeListenersFor(Events.java:231)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.applicationimpl.Events.publishEvent(Events.java:115)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:127)
at javax.faces.api#2.3.9.SP01//javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
at javax.faces.api#2.3.9.SP01//javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:553)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:264)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:216)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:185)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:250)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
21:07:08,529 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 31) MSC000001: Failed to start service jboss.deployment.subunit."GoStopHandle.ear"."GoStopHandleWAR.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.subunit."GoStopHandle.ear"."GoStopHandleWAR.war".undertow-deployment: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:252)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78)
... 8 more
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:283)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:216)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:185)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at org.wildfly.extension.undertow#16.0.0.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
at io.undertow.servlet#2.0.19.Final//io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:250)
... 10 more
Caused by: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
at deployment.GoStopHandle.ear.GoStopHandleWAR.war//org.omnifaces.ApplicationProcessor.checkDuplicateResourceHandler(ApplicationProcessor.java:88)
at deployment.GoStopHandle.ear.GoStopHandleWAR.war//org.omnifaces.ApplicationProcessor.processEvent(ApplicationProcessor.java:72)
at javax.faces.api#2.3.9.SP01//javax.faces.event.SystemEvent.processListener(SystemEvent.java:123)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.applicationimpl.Events.processListeners(Events.java:253)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.applicationimpl.Events.invokeListenersFor(Events.java:231)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.applicationimpl.Events.publishEvent(Events.java:115)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:127)
at javax.faces.api#2.3.9.SP01//javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
at javax.faces.api#2.3.9.SP01//javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:788)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:553)
at com.sun.jsf-impl#2.3.9.SP01//com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:264)
... 22 more
21:07:08,533 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 1) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "GoStopHandle.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"GoStopHandle.ear\".\"GoStopHandleWAR.war\".undertow-deployment" => "java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
Caused by: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files."}}
21:07:08,533 ERROR [org.jboss.as.server] (External Management Request Threads -- 1) WFLYSRV0021: Deploy of deployment "GoStopHandle.ear" was rolled back with the following failure message:
{"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"GoStopHandle.ear\".\"GoStopHandleWAR.war\".undertow-deployment" => "java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
Caused by: java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files."}}
21:07:08,545 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 31) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'GoStopHandle.ear/GoStopHandleJAR.jar#goStopHandleMongoDBPersistenceUnit'
21:07:08,551 INFO [org.hibernate.orm.beans] (ServerService Thread Pool -- 31) HHH10005004: Stopping BeanContainer : org.hibernate.resource.beans.container.internal.CdiBeanContainerExtendedAccessImpl#6f289f7f
21:07:08,551 INFO [org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider] (ServerService Thread Pool -- 31) OGM001202: Closing connection to MongoDB
21:07:08,551 INFO [org.mongodb.driver.connection] (ServerService Thread Pool -- 31) Closed connection [connectionId{localValue:4, serverValue:43}] to 127.0.0.1:27017 because the pool has been closed.
21:07:08,552 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 31) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'GoStopHandle.ear/GoStopHandleJAR.jar#goStopHandleMongoDBPersistenceUnit'
21:07:08,563 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0208: Stopped subdeployment (runtime-name: GoStopHandleJAR.jar) in 29ms
21:07:08,591 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0208: Stopped subdeployment (runtime-name: GoStopHandleWAR.war) in 57ms
21:07:08,594 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0028: Stopped deployment GoStopHandle.ear (runtime-name: GoStopHandle.ear) in 60ms
21:07:10,525 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (Mojarra-WebResourceMonitor-2-thread-1) Unable to access url file:/usr/local/Cellar/wildfly-as/16.0.0.Final/standalone/tmp/vfs/deployment/deploymentbed7dce99d600c8e/GoStopHandleWAR.war-4113c165328ad65/WEB-INF/faces-config.xml. Monitoring for this resource will no longer occur.
21:15:46,752 INFO [org.jboss.as.repository] (ServerService Thread Pool -- 42) WFLYDR0009: Content /usr/local/Cellar/wildfly-as/16.0.0.Final/standalone/data/content/71/89ba9c42dac295cdb4b7e9ccf47471afd95a22 is obsolete and will be removed
21:15:46,756 INFO [org.jboss.as.repository] (ServerService Thread Pool -- 42) WFLYDR0002: Content removed from location /usr/local/Cellar/wildfly-as/16.0.0.Final/standalone/data/content/71/89ba9c42dac295cdb4b7e9ccf47471afd95a22/content
I run with:
PrimeFace (Elite) 7.0.5 OmniFaces 3.2
Java openjdk 11.0.2 Kotlin 1.3.41
JBoss WildFly 16.0.0.FINAL Undertow 2.0.19.Final Mojarra 2.3.9.SP01
Google Chrome Version 75.0.3770.100 (64-bit) Safari 12.1
(14607.1.40.1.4) macOS Mojave 10.14.5
java.lang.IllegalStateException: Resource handler class org.primefaces.application.resource.PrimeResourceHandler is duplicated. This will result in erratic resource handling behavior. Please check your faces-config.xml files, also in web fragment JAR files.
OmniFaces 3.3 has indeed introduced a preventive check for duplicate resource handlers in JSF configuration. See issue 504.
In your specific case, however, this literal error message is a bit unhelpful because in this specific case it's not necessarily caused by a developer mistake in faces-config.xml file in your WAR or web fragment JAR files.
It's actually caused by a developer mistake in build or runtime configuration. Your build and/or runtime classpath ended up getting duplicate PrimeFaces JAR files which each registered their own PrimeResourceHandler via their own faces-config.xml file. The PrimeFaces JAR file is essentially also a "web fragment JAR file", but actually not a custom one (hence the error message being slightly unhelpful for starters, I'll improve that for the next OmniFaces version).
In order to solve your problem you need to make sure that there's only one PrimeFaces JAR file in /WEB-INF/lib folder of the produced WAR file, and that there are no duplicates throughout the runtime classpath. In case your application is in EAR format, you also need to make sure that no one web fragment JAR file ends up in /lib folder of the produced EAR file. In case you deploy to a custom built server stack, you also need to make sure that no one web fragment JAR file is manually placed in default classpath of the server (e.g. /lib folder of Tomcat). In case you deploy to a custom built Java environment, you also need to make sure that no one web fragment JAR file is manually placed in default classpath of the JRE (e.g. /lib folder of JRE installation).

Omnifaces-Exception: CDI BeanManager instance is not available in JNDI

i have problems with deploying my jsf-application on the upserver. starting tomcat results in the following exception:
14-Jul-2016 07:26:52.661 SEVERE [localhost-startStop-1] com.sun.faces.config.ConfigureListener.contextInitialized Critical error during deployment:
java.lang.ExceptionInInitializerError
at org.omnifaces.util.Beans.getManager(Beans.java:88)
at org.omnifaces.util.Beans.getReference(Beans.java:113)
at org.omnifaces.application.OmniApplication.<init>(OmniApplication.java:70)
at org.omnifaces.application.OmniApplicationFactory.createOmniApplication(OmniApplicationFactory.java:89)
at org.omnifaces.application.OmniApplicationFactory.getApplication(OmniApplicationFactory.java:54)
at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:93)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
at com.sun.faces.lifecycle.ClientWindowFactoryImpl.<init>(ClientWindowFactoryImpl.java:62)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at javax.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:405)
at javax.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:251)
at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:543)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:283)
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:328)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:236)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:439)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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: java.lang.IllegalStateException: CDI BeanManager instance is not available in JNDI.
at org.omnifaces.config.BeanManager.<init>(BeanManager.java:97)
at org.omnifaces.config.BeanManager.<clinit>(BeanManager.java:47)
... 30 more
Caused by: java.lang.IllegalStateException: javax.naming.NamingException: Cannot create resource instance
at org.omnifaces.util.JNDI.lookup(JNDI.java:95)
at org.omnifaces.config.BeanManager.<init>(BeanManager.java:93)
... 31 more
Caused by: javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:96)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
at org.apache.naming.NamingContext.lookup(NamingContext.java:841)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at org.apache.naming.NamingContext.lookup(NamingContext.java:829)
at org.apache.naming.NamingContext.lookup(NamingContext.java:166)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:157)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at org.omnifaces.util.JNDI.lookup(JNDI.java:90)
... 32 more
14-Jul-2016 07:26:52.665 SEVERE [localhost-startStop-1] org.omnifaces.ApplicationListener.checkCDIAvailable
????????????????????????????????????????????????????????????????????????????????
? ?? ? ?
? ? ????? ? OmniFaces failed to initialize! ?
? ???? ?????? ? ?
? ?????? ??????? ? This OmniFaces version requires CDI, but ?
? ??????? ??????? ? none was found on this environment. ?
? ??????????????????????? ? ?
? ??????????????????????? ? OmniFaces 2.x requires a minimum of JSF 2.2.?
? ????????????????????? ? Since this JSF version, the JSF managed bean?
? ????????????????????? ? facility #ManagedBean is semi-official ?
? ?????????????????????? ? deprecated in favour of CDI. JSF 2.2 users ?
? ?????????????????????? ? are strongly encouraged to move to CDI. ?
? ?????????????????????? ? ?
? ??????????????????????? ? OmniFaces goes a step further by making CDI ?
? ???????????????????????? ? a REQUIRED dependency next to JSF 2.2. This ?
? ???????????????????????? ? not only ensures that your web application ?
? ???????????????? ???????? ? represents the state of art, but this also ?
? ????????????????????????? ? makes for us easier to develop OmniFaces, ?
? ?????????????????????????? ? without the need for all sorts of hacks in ?
? ?????????????????????????? ? in order to get OmniFaces to deploy on ?
? ???????????????????????????? ? environments without CDI. ?
? ???????????????????????????? ? ?
? ???????????????????????????? ? You have 3 options: ?
?????????????????????????????????? 1. Downgrade to OmniFaces 1.x. ?
?????????????????????????????????? 2. Install CDI in this environment. ?
?????????????????????????????????? 3. Switch to a CDI capable environment. ?
?????????????????????????????????? ?
?????????????????????????????????? For additional instructions, check ?
?????????????????????????????????? http://omnifaces.org/cdi ?
?????????????????????????????????? ?
????????????????????????????????????????????????????????????????????????????????
14-Jul-2016 07:26:52.682 INFO [localhost-startStop-1] com.sun.faces.config.ConfigureListener.contextInitialized Initializing Mojarra 2.2.12 ( 20150720-0848 https://svn.java.net/svn/mojarra~svn/tags/2.2.12#14885) for context '/protano'
14-Jul-2016 07:26:52.840 INFO [localhost-startStop-1] com.sun.faces.spi.InjectionProviderFactory.createInstance JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
14-Jul-2016 07:26:52.872 SEVERE [localhost-startStop-1] com.sun.faces.config.ConfigureListener.contextInitialized Critical error during deployment:
java.lang.NoClassDefFoundError: Could not initialize class org.omnifaces.config.BeanManager
at org.omnifaces.util.Beans.getManager(Beans.java:88)
at org.omnifaces.util.Beans.getReference(Beans.java:113)
at org.omnifaces.application.OmniApplication.<init>(OmniApplication.java:70)
at org.omnifaces.application.OmniApplicationFactory.createOmniApplication(OmniApplicationFactory.java:89)
at org.omnifaces.application.OmniApplicationFactory.getApplication(OmniApplicationFactory.java:54)
at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:93)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:142)
at com.sun.faces.lifecycle.ClientWindowFactoryImpl.<init>(ClientWindowFactoryImpl.java:62)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at javax.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:405)
at javax.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:251)
at javax.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:543)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:283)
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:328)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:236)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:439)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4840)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
14-Jul-2016 07:26:52.889 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start.
in my local enviroment it works fine. i already checked all affected files for presence and values:
WEB-INF
-(empty) beans.xml
WEB-INF/lib
-cdi-api-1.2.jar
-weld-servlet-2.2.9.Final.jar
META-INF
context.xml with following content:
<Context>
<Resource name="BeanManager"
auth="Container"
type="javax.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory"/>
</Context>
Enviroment:
java 8
mojarra 2.2.12
omnifaces 2.4
tomcat: 8.0.36 with cdi installed, carefully followed the steps given here:
http://balusc.omnifaces.org/2013/10/how-to-install-cdi-in-tomcat.html
there is a similar topic which is not helpful. for me the solution is unclear.
Omnifaces exception on deployment on Tomcat 7
any other help/advice would be much appreciated.
When you work with eclipse and its wtp-server-plugin and rely on "clean tomcat working directory" the most time, you may forget to cleanup tomcat's work folder also when a deploy fails on production enviroments.
after deletion of
tomcat/webapps/appName
tomcat/webapps/appName.war
tomcat/work
i redeployed and the errors went away.

java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet with a WAR file

I am using WSO2 Application Server. When trying to deploy a WAR file build with JSF java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet is thrown on WSO2 AS. I have 3 questions;
Why this Exception is thrown?
Is it because Tomcat doesn't support Java EE and JSF.
If then, why can't we use TomEE.
For further details I'll paste the error log here.
[2014-08-29 02:06:27,153] ERROR {org.apache.catalina.core.StandardContext} - Servlet /EnterpriseApplication-war threw load() exception
java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
at org.wso2.carbon.webapp.mgt.loader.CarbonWebappClassLoader.loadClass(CarbonWebappClassLoader.java:138)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1137)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:280)
at org.wso2.carbon.tomcat.internal.CarbonTomcat.addWebApp(CarbonTomcat.java:177)
at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleWebappDeployment(TomcatGenericWebappsDeployer.java:222)
at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleWarWebappDeployment(TomcatGenericWebappsDeployer.java:174)
at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.handleHotDeployment(TomcatGenericWebappsDeployer.java:141)
at org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer.deploy(TomcatGenericWebappsDeployer.java:116)
at org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deployThisWebApp(AbstractWebappDeployer.java:140)
at org.wso2.carbon.webapp.mgt.AbstractWebappDeployer.deploy(AbstractWebappDeployer.java:90)
at org.wso2.carbon.webapp.deployer.WebappDeployer.deploy(WebappDeployer.java:42)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:810)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:139)
at org.wso2.carbon.core.CarbonAxisConfigurator.loadServices(CarbonAxisConfigurator.java:464)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:95)
at org.wso2.carbon.core.CarbonConfigurationContextFactory.createNewConfigurationContext(CarbonConfigurationContextFactory.java:65)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:398)
at org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:347)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1267)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Since others can benefit from this answer, I will post my findings;
This exception is thrown because WSO2 AS is not bundled with JSF. JSF comes as an additional feature that can be installed from the online Carbon p2 repository.
Name: WSO2 Carbon - J2EE Runtime Environment
Identifier: org.wso2.carbon.as.runtimes.j2ee.feature
Refer this link for more details.
Already answered. Tomcat doesn't support it natively.
TomEE could have used. But not all web applications are using Java EE packages. WSO2 AS provides a way to enabling additional packages only for selected webapps through a webapp-classloading.xml.
For example if you put a webapp-classloading.xml file inside the META-INF folder, you will override the default settings and only the classloading environments defined in that XML file are exposed to the web application.

PicketLink - NoClassDefFound: org/picketlink/idm/config/StoreConfiguration

I'm beginning to migrate my Seam 2.3 app over to JavaEE 6, and as part of that will be using PicketLink 2.5.0 and PicketBox 5.0 for security, particularly the IDM component. I'm trying to make use of the JPA Identity Store, and have created my own entities with the appropriate annotations. However, when I attempt to add a user, I get the following exception:
java.lang.NoClassDefFoundError: org/picketlink/idm/config/StoreConfiguration
I've looked in the JAR files, and sure enough I don't see this object. I'm using PicketBox 5.0. Is this a known issue with this combination of PicketLink and PicketBox? Is there something I'm doing wrong? Is this object located in a different JAR? The code to create my user looks like this:
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.identityManager().jpaStore();
PicketBoxConfiguration config = builder.build();
DefaultPicketBoxManager picketBoxManager = new DefaultPicketBoxManager(
config);
picketBoxManager.start();
EntityManagerPropagationContext.set(this.entityManager);
IdentityManager idm = picketBoxManager.getIdentityManager();
SimpleUser user = new SimpleUser("testuser");
idm.add(user);
System.out.println("User added");
UPDATE: A bit more info on my setup...
I have downloaded PicketLink 2.5.0beta6 and PicketBox 5.0.0. All the relevant JARs are maintained within my EAR file, which is deployed on JBoss EAP 6.1. When I run my code, I see the following Exception thrown:
java.lang.NoClassDefFoundError: org/picketlink/idm/config/StoreConfiguration
org.picketbox.core.AbstractPicketBoxManager.doStart(AbstractPicketBoxManager.java:244)
org.picketbox.core.AbstractPicketBoxLifeCycle.start(AbstractPicketBoxLifeCycle.java:53)
net.test.services.TestEJB.doTest(TestEJB.java:42)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:129)
org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:137)
org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:58)
org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
...
JBWEB000071: root cause
java.lang.ClassNotFoundException: org.picketlink.idm.config.StoreConfiguration from [Module "deployment.TestApp-ear.ear:main" from Service Module Loader]
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196)
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444)
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432)
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374)
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119)
org.picketbox.core.AbstractPicketBoxManager.doStart(AbstractPicketBoxManager.java:244)
org.picketbox.core.AbstractPicketBoxLifeCycle.start(AbstractPicketBoxLifeCycle.java:53)
net.test.services.TestEJB.doTest(TestEJB.java:42)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
I was able to locate documentation on the JBoss site that explained how to upgrade the PicketLink libraries within JBoss EAP 6.1. That solved everything.

Run javaEE from netbeans locally

I am trying to run my javaEE site locally in Netbeans IDE. I believe I have everything set up correctly, but I am receiving the following error:
Initializing... deploy?DEFAULT=C:\Documents and
Settings\nicholasr\Desktop\Work Notes\temp code
files\ASP\build\web&name=ASP&force=true failed on GlassFish Server 3.1
Error occurred during deployment: Exception while deploying the app
[ASP] : Servlet [Resource Servlet] and Servlet [Persistent Faces
Servlet] have the same url pattern: [/xmlhttp/*]. Please see
server.log for more details. C:\Documents and
Settings\nicholasr\Desktop\Work Notes\temp code
files\ASP\nbproject\build-impl.xml:871: The module has not been
deployed. at
org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:187)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106) at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348) at
org.apache.tools.ant.Target.execute(Target.java:390) at
org.apache.tools.ant.Target.performTasks(Target.java:411) at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at
org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
at
org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
at
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)
BUILD FAILED (total time: 58 seconds)
I've done some searching on the net, but don't see any related links. Does anyone know why I would be getting this error and how it can be resolved? I can provide any additional information if needed. Thanks!
Error occurred during deployment: Exception while deploying the app [ASP] : Servlet [Resource Servlet] and Servlet [Persistent Faces Servlet] have the same url pattern: [/xmlhttp/]*
You seem to be using IceFaces. I don't do IceFaces, but the error message suggests that they shouldn't be mapped on the very same URL pattern. I did some minor research and based on the following documents...
Adding IceFaces 2 to your application
Converting IceFaces 1.8 to IceFaces 2
The previously declared Persistent Faces Servlet and Blocking Servlet are no longer needed in ICEfaces 2, as their functionality has changed and setup has been reduced. Remove all declarations and mappings for those two servlets:
... I can only conclude that the "Persistent Faces Servlet" is typical for IceFaces 1.8.x and the "Resource Servlet" is typical for IceFaces 2.x. You should use the one or the other, not both. I think you're targeting IceFaces 2.x, so you should get rid of the declaration and the mapping of the "Persistent Faces Servlet" in your web.xml altogether.

Resources