selectOneMenu prime faces


<p:selectOneMenu style="width:146px" id="server" value="#{loginBean.user.server}" >
<f:selectItem itemLabel="SERVER1" itemValue="SERVER1" />
<f:selectItem itemLabel="SERVER2" itemValue="SERVER2" />
</p:selectOneMenu>
Advertisements

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet


java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/faces/webapp/FacesServlet

Add the following libraries inside pom.xml (Maven)

  <dependency>
     <groupId>com.sun.faces</groupId>
     <artifactId>jsf-api</artifactId>
     <version>2.1.13</version>
 </dependency>
 
 <dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-impl</artifactId>
    <version>2.1.13</version>
 </dependency>
 
 <dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>javax.servlet-api</artifactId>
   <version>3.1.0</version>
 </dependency>

java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet Eclipse luna with correct libraries


java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:520)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:501)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:120)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1031)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4914)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5201)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

solution follows

if you have related jars and getting the exception above

1

click right on project / click properties and select Deployment Assembly

da

and do the following steps click add

2

select java build path entries

3

add maven dependencies and redeploy your code

4

Primefaces p:dataTable with dynamic columns



<p:dataTable rendered="true" sortBy="#{record.column1}" value="#{tableGenerator.dataTable.records}" var="record"
		id="tblResult" paginator="true" rows="10" style="font-size:9px;"
		rowKey="#{record.column1}">
		<f:facet name="header">
			<h:outputText style="text-align:left!important;color:green;"
				value="Total Record size (#{tableGenerator.dataTable.recordsSize} records)" />
		</f:facet>
		<c:forEach var="column" items="#{tableGenerator.dataTable.columnArr}">
			<p:column sortBy="#{record[column]}" filterBy="#{record[column]}">
				<f:facet name="header">
					<h:outputText value="#{column}" />
				</f:facet>
				<h:outputText value="#{record[column]}" />
			</p:column>
		</c:forEach>
	</p:dataTable>