Unable to find component with ID Xxx in view - jsf

I have issue in my JSF Project on edit.xhtml. Not able to update the data in database. The problem is
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer getForComponent
WARNING: Unable to find component with ID subject in view.
I am currently using JSF-IMPL com.sun.faces version 2.2.18 and JSF-API com.sun.faces version 2.2.18.

Related

Tag Library supports namespace: http://primefaces.org/ui, but no tag was defined for name: dataView

I'm using JSF 2.2 and PrimeFaces 6.2 and, when I use <p:dataView ...> my program crash.
This is the error:
javax.servlet.ServletException: /index.xhtml #15,65 <p:dataView> Tag Library supports namespace: http://primefaces.org/ui, but no tag was defined for name: dataView
How can I solve it?
PS. I added the Jar file of PrimeFaces on classpath and, also, add the jar in webapp/WEB-INF/lib
PPS. Only for this tag I notice this error, others PrimeFaces tag work correctly.
The correct answer is this was added in PF 6.2.3 and you are using PF 6.2.
Here is the GitHub ticket it was created for. https://github.com/primefaces/primefaces/issues/3594

jsf 1.2 to jsf 2.2 migration causes: javax.faces.FacesException

I'm working on a project about migrating from jsf1.2 to JSF 2.2,I already removed the jsf 1.2 jars and I replaced them by jsf 2.2 jars! But when I'm trying to change schema namespace in faces-config file(new namespace definition for jsf 2.2) I got this exeception:
Caused by: javax.faces.FacesException: Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is
not an instance of com.sun.faces.spi.AnnotationProvider
This seems like an inconsistence in your dependencies.
This Exception obviously points out, that
org.jboss.as.web.deployment.jsf.JandexAnnotationProvider
is not an extension of
com.sun.faces.spi.AnnotationProvider
However, I've done a little research using http://grepcode.com to get a better Picture of this Problem.
It seams, that JandexAnnotationProvider actualy is an extension of AnnotationProvider, at least after jboss-as-web version 7.0.0
Also Interesting was, that JandexAnnotationProvider disappeared after version 7.1.2.Final
I would suggest updating to the latest Version of jboss-as-web, which is 7.2.0
This class might got replaced for a reason related to your problem.
You can acquire this version at:
http://central.maven.org/maven2/org/jboss/as/jboss-as-web/7.2.0.Final/jboss-as-web-7.2.0.Final.jar
or as Maven dependency:
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-web</artifactId>
<version>7.2.0.Final</version>
</dependency>
Best regards,
J.Adam

Make attributes of Composite Component from JAR available in autocomplete

I've made a Composite Component and archived it in a *.jar file. My solution is based on this tutorial : How to package JSF2 composite component as distributable JAR and this question: Java EE6> Packaging JSF facelets (xhtml) and ManagedBeans as JAR.
Everything works fine but I can't used autocomplete in Eclipse to add attributes of Composite Component when I add it through *.jar file. When I add it manually, i.e. place code in resources/composite_components everything works fine.
I'm using RAD 8.5.5
Thank you in advance.

Deploying PrimeFaces app to GlassFish4 causes java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItem

I'd like to use <p:calendar> in my JSF app developed in Netbeans, so I added the PrimeFaces library. However, when I deploy the app, it errors as follows:
Context with name [/ManagedBeansWithComponents] has not yet been started
C:\Users\Dell-pc\Documents\NetBeansProjects\ManagedBeansWithComponents\nbproject\build- impl.xml:1040: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 1 second)
And the server log says:
Source Document: jar:file:/C:/Users/Dell-pc/Documents/NetBeansProjects/ManagedBeansWithComponents/build/web/WEB-INF/lib/primefaces-3.5.jar!/META-INF/faces-config.xml
Cause: Class 'org.primefaces.component.fileupload.FileUploadRenderer' is missing a runtime dependency: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItem
How is this caused and how can I solve it?
java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItem
There is the cause. It's crystal clear. The mentioned class is missing in the runtime classpath. The solution is rather straightforward: put the mentioned class (or, the JAR file containing it) in the runtime classpath. As the package name hints, it's available on http://commons.apache.org/fileupload (which in turn has by the way http://commons.apache.org/io as dependency). Just download and drop those JARs in the same place as PrimeFaces JAR and all should be well.
Unrelated to the concrete problem, note that this particular problem is in turn unintented by PrimeFaces. This problem should actually only occur when you register the FileUploadFilter for the <p:fileUpload> component in web.xml. However, since GlassFish 4.0, it is overzealously preloading every single JSF component and renderer class found in the classpath even if it's never used by the application. The class loading in turn causes all its runtime dependencies to be checked. If it's missing, then you get the NoClassDefFoundError. This problem is thus specific to GlassFish 4.0 and does not occur when using GlassFish 3.x or any other servletcontainer such as Tomcat or JBoss.

Websphere 7 and JSF 1.2 - Application was not properly initialized at startup, could not find Factory

JSF 1.1 and websphere 6.1 was working properly in my case. Once I deployed that to a websphere 7 server, I received the following error -
Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactoryat javax.faces.FactoryFinder.getFactory(FactoryFinder.java:270)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:358)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
Not sure what it means, I have enabled JSF1.2 as project facet in the RAD but still keep getting the above error message and none of my jsf files are working.
EDIT
After following BalusC's comment, I see the following directories are lookup by the code (this is the o/p of url.getPath())
/C:/IBM/SDP/runtimes/base_v7/profiles/AppSrv01/properties/
/C:/IBM/SDP/runtimes/base_v7/properties/
/
/C:/IBM/SDP/runtimes/base_v7/java/lib/
/C:/IBM/SDP/runtimes/base_v7/lib/
/C:/IBM/SDP/runtimes/base_v7/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime/
/C:/IBM/SDP/runtimes/base_v7/installedConnectors/sib.api.jmsra.rar/
/C:/IBM/SDP/runtimes/base_v7/installedConnectors/wmq.jmsra.rar/
/C:/DETSphere10/DET_FALL9.0/DETEJB/classes/
/C:/DETSphere10/DET_FALL9.0/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/DETWEB/
There is no jsf impl in among these directories. Now I am more confused as the original lib should be present under c:\IBM\SDP\runtimes\base_v7\plugins !!
This is a typical error when there are multiple different versioned JSF libraries in the classpath. Websphere ships with builtin JSF libraries. If you'd like to use the webapp-supplied JSF libraries, then you need to set the classloading policy to module after deploying. This usually defaults to application which means that the webapp libraries are loaded by the main classloader. The main classloader may happen to have loaded the JSF API library. When its version is different from the JSF IMPL library in the webapp, then you may receive this kind of errors.
Update to help with nailing down the root cause better here are 2 suggestions:
You can reveal all used classpath roots on the local disk file system as follows:
for (URL url : Collections.list(Thread.currentThread().getContextClassLoader().getResources(""))) {
System.out.println(url.getPath());
}
Execute this in ServletContextListener#contextInitialized() or so.
(eventually after finding that out), install WinRAR, associate it with JAR file type and use its file-search facility to search for a JSF specific file like FacesContext.class and FacesContextImpl.class so that you can find all JAR's which contains the JSF API/impl. You can find out the exact JSF version by extracting the JAR and reading the MANIFEST file.
You need to keep the JSF JAR's (icu4j.jar and jsf-ibm.jar if you are using IBM's component library) in your /WEB-INF/lib folder.

Resources