javax.servlet.ServletContainerInitializer: Provider org.apache.myfaces.ee6.MyFacesContainerInitializer not a subtype - jsf

I'm trying to migrate a JSF (MyFaces, Trinidad) project from 1.2 to 2.0. I've followed this link. Below is what I've did.
1. Updated the XMLNS of faces-config.xml, web.xml, facelets.xml
2. Updated the Jar files (MyFaces 2.0.16, Trinidad 2.0.1)
3. Removed the facelets
3. Removed the ALTERNATE_VIEW_HANDLER tag from web.xml
4. Changed the classloaderMode to PARENT_LAST in WAS 8.5
We are using jspx alone and not xhtml pages. el-api 2.2 and el-ri 1.1.11 are also in our lib folder
When I start the server, I'm getting the below exception. Please help me to resolve the problem.
ContainerHelp E WSVR0501E: Error creating component com.ibm.ws.runtime.component.CompositionUnitMgrImpl#8d7ccd79
com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: <b>Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.apache.myfaces.ee6.MyFacesContainerInitializer not a subtype </b>
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:432)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
.......
.......
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.apache.myfaces.ee6.MyFacesContainerInitializer not a subtype
at java.util.ServiceLoader$ServiceIterator.next(ServiceLoader.java:212)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:535)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)

Related

The absolute uri: http://java.sun.com/jsf/html cannot be resolved when running JSF 1.0 application on Wildfly 8.1

I'm working on upgrading one of my applications from JSF 1.0 to 2.0. It runs on JBoss 4.0.3SP1 and I'm trying to make it run on WildFly 8.1 final. After some struggles, I was able to get the application compiled and deployed to WildFly but got this error, when accessing the .jsp file.
2015-07-09 07:40:08,600 ERROR [io.undertow.request] (default task-2) UT005022: Exception generating error page /errorpages/error.faces: org.apache.jasper.Jasper
Exception: JBWEB004113: **The absolute uri: http://java.sun.com/jsf/html cannot be resolved in either web.xml or the jar files deployed with this application** at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:53) [jastow-1.0.0.Final.jar:1.0.0.Final]
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:147) [jastow-1.0.0.Final.jar:1.0.0.Final]
I've read the following articles but still cannot fix the problem.
JSF 1.2 on Wildfly 8 Final - weld-core-jsf is still referencing JSF 2.2 API
Can not find the tag library descriptor for http://java.sun.com/jsf/facelets
https://developer.jboss.org/wiki/StepsToAddAnyNewJSFImplementationOrVersionToWildFly
https://developer.jboss.org/wiki/DesignOfWildFlyMulti-JSFFeature
I also enabled org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL in web.xml and disabled "weld" in WildFly and I put the following libs/files in <EAR>/lib, <WAR>/WEB-INF/lib.
jsf-api.jar
jsf-impl.jar
jstl.jar
standard.jar
html_basic.tld, jsf_core.tld
And, for JSTL, I tried different URLs, like:
<%# taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
or
<%# taglib uri="http://java.sun.com/jsp/jstl/html" prefix="h"%>
or put the URL into <html> instead of using <%#taglib>.
However, the problem cannot be resolved by the above steps.
Is there anyone had the same problem can share some experience? I'd like to see if there is a possibility I can run the JSF 1.0 code on WildFly?
Thanks in advance!

java.lang.IllegalArgumentException: Multiple entries with same key: interface javax.validation.constraints.Min

I'm running an EAR with EJB + EJB + WAR deployment in JBoss WildFly 8.2.0.Final with JSF 2.2 and RichFaces 4.5.2.Final. My problem is, that all RichFaces resources fail to load properly in the client. The generated URL don't resolve and return with HTTP 404.
The deployment is build upon Maven und results in the following structure:
The reason for using <scope>compile</scope> in the EJB module and not the WAR is that I need to extend RichFaces classes from within my EJB module. We've build a dynamic form generator based on some of the components.
As soon as I add JARs to EAR/lib/ and WAR/WEB-INF/lib/ by using <scope>compile</scope> instead of <scope>provided</scope> in the WAR module I get the following stacktrace while starting the application server:
Caused by: java.lang.IllegalArgumentException: Multiple entries with same key: interface javax.validation.constraints.Min=org.richfaces.javascript.LibraryFunctionImplementation#c77af4e and interface javax.validation.constraints.Min=org.richfaces.javascript.LibraryFunctionImplementation#5a903150
at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:150)
at com.google.common.collect.RegularImmutableMap.checkNoConflictInBucket(RegularImmutableMap.java:104)
at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:70)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:254)
at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:75)
at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:65)
at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:60)
at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:60)
at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:110)
at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:69)
at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:167)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2190)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2163)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:303)
at org.jboss.as.jsf.injection.weld.ForwardingApplication.publishEvent(ForwardingApplication.java:294)
at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:692)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:260)
... 9 more
How can I solve this problem?
Frontend artifacts don't belong in EAR's /lib. They belong in WAR's /WEB-INF/lib. It would otherwise make the backend (the EJB) totally unreusable on other frontends (other WARs), such as Spring MVC, JAX-RS RESTful, "Plain vanilla" JSP/Servlet, etc..etc.. Using/importing JSF FacesContext and friends such as Servlet's HttpServletRequest in an EJB class is already a seriously big red alert. You should not be doing that.
Move that code to WAR. Or, if you intend to make it reusable across various WARs, make it a web fragment project instead which can then end up as another JAR in /WEB-INF/lib.
See also:
JSF Service Layer

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.

weblogic 10.3.4 java.lang.ClassNotFoundException: javax.el.ELContextListener

I have a JSF 1.2 application which I intend to deploy to Weblogic 10.3.4. At local Tomcat environment it works fine. But when I try to deploy it to weblogic I am getting a ClassNotFoundException on javax.el.ELContextListener. When I add el-api.jar file, then I get a LinkageError: loader constraint violation on javax.EL.ELResolver. It is a deadly vicious circle.
At first I tried to deploy it as WAR. Then I created an enterprise project so that I can deploy as EAR, but it did not solve the problem. My EAR file structure is fine.
Firstly I got error below,
Caused By: java.lang.ClassNotFoundException: javax.el.ELContextListener
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
When I add el-api-2.2.jar to /WEB-INF/lib of WAR or /APP-INF/lib of EAR, then I get loader constarint error;
com.sun.faces.config.ConfigureListener failed: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.addELResolver(Ljavax/el/ELResolver;)V" the class loader (instance of weblogic/utils/classloaders/GenericClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ELResolver used in the signature.
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.addELResolver(Ljavax/el/ELResolver;)V" the class loader (instance of weblogic/utils/classloaders/GenericClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ELResolver used in the signature
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:582)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:212)
What is the problem with it? I changed my classpath order but result was the same. My web.xml is declared as Servlet 2.5 and I have the following JARs in /WEB-INF/lib:
commons-beanutils-1.7.0.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
commons-logging-1.0.4.jar
darkX-3.3.3.Final.jar
glassX-3.3.3.Final.jar
jsf-api.jar
jsf-impl.jar
jstl-1.2.jar
laguna-3.3.3.Final.jar
log4j-1.2.14.jar
poi-3.7-20101029.jar
quartz-all-1.8.4.jar
richfaces-api-3.3.3.Final.jar
richfaces-impl-3.3.3.Final.jar
richfaces-ui-3.3.3.Final.jar
scjd12.jar
slf4j-api-1.6.0.jar
slf4j-log4j12-1.6.0.jar
themes-3.3.3.Final.jar
You can try using filtering classloader.
weblogic-application.xml file can include something like:
<prefer-application-packages>
<package-name>javax.faces.*</package-name>
<package-name>com.sun.faces.*</package-name>
<package-name>org.apache.myfaces.*</package-name>
</prefer-application-packages>
This enables WebLogic's filtering classloader to block your application from seeing the JSF in the container (the javax.faces and myfaces part in this case). You need to keep everything that depends on your library also in your apps classloader, which is why I have facelets in this example.
Hope this helps..
If you still get this error even though you did all the changes necessary related to el jars (i mean prefer-application-packages and other stuff in weblogic-application.xml etc.), I think there is something wrong in your web.xml file.
Please check that you have the lines below in your web.xml.
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
Finally I manage to find the solution.
jsf-impl jar includes "ELContextListenerImpl" class which implements "ELContextListener" interface. And ELContextListener interface is included in the wlfullclient-10.3.X.jar in the server path.
If you dont have wlfullclient jar in the server path you will have "ClassNotFoundException: javax.el.ELContextListener" error. Getting this error if you add el-api jar this time you will get "LinkageError: loader constraint violation" because versions of jars you used and the server has are different. Anyway the problem will be resolved after creating wlfullclient-10.3.X.jar in the weblogic server.
In order to create that jar you can read this post: http://wls4mscratch.wordpress.com/2010/06/19/steps-to-build-a-wlfullclient-jar-in-wls-10-0-x-and-wls-10-3-x/

JSF html component on WebSphere 7.0

We are in the process of upgrading to WebSphere 7.0 on Windows 2008 R2. Our applications currently run on WebSphere 6.1 on Windows 2003.
We use custom controls we wrote using JSF 1.1 in our applications. Our controls seem to render and interact fine, however whenever we use a JSF HTML component such as:
<%# taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
...
<h:graphicImage url="#{MenuBean.bannerImagePath}" />
We get the following error:
com.ibm.ws.jsp.JspCoreException: Unable to convert string '#{MenuBean.bannerImagePath}' to class javax.el.ValueExpression for attribute url: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
com.ibm.ws.jsp.JspCoreException: Unable to convert string '#{MenuBean.bannerImagePath}' to class javax.el.ValueExpression for attribute url: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:939)
at com.ibm._jsp._dashboard._jspx_meth_h_graphicImage_0(_dashboard.java:136)
at com.ibm._jsp._dashboard._jspx_meth_f_view_0(_dashboard.java:436)
at com.ibm._jsp._dashboard._jspService(_dashboard.java:109)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1583)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1523)
I have found an article on IBM's website giving a possible fix:
http://www-01.ibm.com/support/docview.wss?uid=swg21318801
However I have removed the specified jars and am still receiving the error message. Again our custom controls seem to work fine under WebSphere 7's JSF 1.2.
Thanks for any help you can provide.
Mike
Listing of WEB-INF\lib
activation.jar
commons-beanutils-1.8.0.jar
commons-collections-3.2.1.jar
commons-dbcp-1.2.2.jar
commons-digester-1.8.1.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-logging-1.1.1.jar
commons-pool-1.4.jar
concurrent.jar
dib-2.0.3.jar
ibatis-2.3.4.726.jar
ifc-3.1.0.jar
imgipt-3.0.0.7.jar
ironeyesql.jar
iText-2.1.5.jar
jasperreports-3.5.0.jar
jaxen-full.jar
jcommon-1.0.12.jar
jdom.jar
jdt-compiler-3.1.1.jar
jfreechart-1.0.9.jar
localization-3.1.0.jar
log4j-1.2.15.jar
mail.jar
mflutil-3.1.0.jar
mmwfoundation-3.1.0.jar
RapidSpellWeb.jar
saxpath.jar
Stedmans.dict
tcr-3.1.0.jar
xalan.jar
xercesImpl-2.4.0.jar
xml-apis.jar
After recompiling against JSF 1.2, rebuilding config files, and updating tld files in the WEB-INF folder, I'm happy to report our problem is fixed. Not exactly sure which fixed the problem. Thanks for your time.
Mike

Resources