Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2538
  • Last Modified:

java.lang.IllegalArgumentException: Conversion Error setting value ''{0}'' for ''{1}''.

I am getting this when I try to run the JSF page (code is given below) using Weblogic server 10.0

Can someone pls help me.......

Here is the error displayed:

java.lang.IllegalArgumentException: Conversion Error setting value ''{0}'' for ''{1}''.
      at com.sun.faces.util.Util.getSelectItems(Util.java:628)
      at com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:488)
      at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:465)
      at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:430)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:420)
      at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:401)
      at org.apache.myfaces.custom.datalist.HtmlListRenderer.encodeChildren(HtmlListRenderer.java:178)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
      at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:607)
      at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:544)
      at jsp_servlet._portlets._sample.__selectonelistboxsample._jspx___tag3(__selectonelistboxsample.java:264)
      at jsp_servlet._portlets._sample.__selectonelistboxsample._jspx___tag2(__selectonelistboxsample.java:217)
      at jsp_servlet._portlets._sample.__selectonelistboxsample._jspService(__selectonelistboxsample.java:160)
      at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
      at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:394)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:309)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      at org.apache.beehive.netui.pageflow.PageFlowPageFilter.continueChainNoWrapper(PageFlowPageFilter.java:455)
      at org.apache.beehive.netui.pageflow.PageFlowPageFilter.runPage(PageFlowPageFilter.java:432)
      at org.apache.beehive.netui.pageflow.PageFlowPageFilter.doFilter(PageFlowPageFilter.java:284)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526)
      at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:454)
      at com.bea.portlet.adapter.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:110)
      at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
      at com.bea.portlet.adapter.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:77)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
      at com.bea.portlet.adapter.faces.FacesContentStubImpl.render(FacesContentStubImpl.java:316)
      at com.bea.netuix.servlets.controls.content.FacesContent.beginRender(FacesContent.java:360)
      at com.bea.netuix.nf.ControlLifecycle$7.visit(ControlLifecycle.java:485)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:518)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:220)
      at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
      at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
      at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
      at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:326)
      at com.bea.netuix.nf.UIControl.render(UIControl.java:582)
      at com.bea.netuix.servlets.controls.PresentationContext.render(PresentationContext.java:486)
      at com.bea.netuix.servlets.util.RenderToolkit.renderChild(RenderToolkit.java:146)
      at com.bea.netuix.servlets.jsp.taglib.RenderChild.doStartTag(RenderChild.java:62)
      at jsp_servlet._framework._skeletons._default.__flowlayout._jspService(__flowlayout.java:285)
      at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
      at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:528)
      at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:454)
      at com.bea.netuix.servlets.controls.application.laf.JspTools.renderJsp(JspTools.java:130)
      at com.bea.netuix.servlets.controls.application.laf.JspControlRenderer.beginRender(JspControlRenderer.java:72)
      at com.bea.netuix.servlets.controls.application.laf.PresentationControlRenderer.beginRender(PresentationControlRenderer.java:65)
      at com.bea.netuix.nf.ControlLifecycle$7.visit(ControlLifecycle.java:481)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:518)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walkRecursiveRender(ControlTreeWalker.java:529)
      at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:220)
      at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
      at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
      at com.bea.netuix.nf.Lifecycle.runOutbound(Lifecycle.java:208)
      at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:168)
      at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
      at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
      at com.bea.netuix.servlets.manager.UIServlet.doGet(UIServlet.java:211)
      at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:196)
      at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
      at com.bea.netuix.servlets.manager.PortalServlet.service(PortalServlet.java:686)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      at com.bea.portal.tools.servlet.http.HttpContextFilter.doFilter(HttpContextFilter.java:60)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:336)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:26)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3393)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(Unknown Source)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)

JSF PAGE:
 
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:tf="http://org.tiaa.portal/faces"
	xmlns:netuix="http://bea.com/faces/adapter/tags-naming" xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	
	<!--
	
		<script type="text/javascript">
	
			function method1(itemValue)
			{
				var itemValue="asd";
				document.getElementById(formname:selitem).value;
				
			}
		</script>
		
	-->
	
	<f:view>
		<netuix:namingContainer id="facesContent">
			<head>
			<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
			<title>selectOneListbox example</title>
			</head>
			<body>
			<h:form >
				<t:dataList var="var" value="#{samplelist.namelist}">
					<h:selectOneMenu id="name" >
						<f:selectItems value="#{var.name}"  />
					</h:selectOneMenu>
				</t:dataList>
				
 
			</h:form>
			</body>
		</netuix:namingContainer>
	</f:view>
</jsp:root>
 
 
 
Names.java
 
 
public class Names {
	
	private String name;
	private int age;
	private String gender;
	private String designation;
 
	public Names() {
		// TODO Auto-generated constructor stub
	}
 
	public int getAge() {
		return age;
	}
 
	public void setAge(int age) {
		this.age = age;
	}
 
	public String getDesignation() {
		return designation;
	}
 
	public void setDesignation(String designation) {
		this.designation = designation;
	}
 
	public String getGender() {
		return gender;
	}
 
	public void setGender(String gender) {
		this.gender = gender;
	}
 
	public String getName() {
		return name;
	}
 
	public void setName(String name) {
		this.name = name;
	}
 
}
 
 
SampleListBoxController.java
 
import java.util.ArrayList;
 
import javax.faces.component.UIData;
import javax.faces.event.ValueChangeEvent;
 
public class SampleListBoxController {
 
	protected String itemName;
 
	private ArrayList<Names> namelist = new ArrayList<Names>();
	
	private UIData data;
 
	public SampleListBoxController() {
		// TODO Auto-generated constructor stub
 
		displayDetails();
	}
 
	public void valChange(ValueChangeEvent valChangeEvent) {
		/*FacesContext con = FacesContext.getCurrentInstance();
		con.getViewRoot();*/
		data.getValue();
		System.out.println(data.getValue()+" "+data.getId());
		String str = (String) valChangeEvent.getNewValue();
		setItemName(str);
		System.out.println("selected item :" + itemName);
	}
 
	public void displayDetails() {
		
		System.out.println("inside display details method of SamplelistboxController");
		ArrayList<Names> namelist = new ArrayList<Names>();
 
		Names name1 = new Names();
		Names name2 = new Names();
		Names name3 = new Names();
		Names name4 = new Names();
		Names name5 = new Names();
		Names name6 = new Names();
		
		System.out.println("setting record1");
		
		name1.setName("Gayathri");
		System.out.println("name : "+name1.getName());
		name1.setGender("Female");
		name1.setAge(25);
		name1.setDesignation("Clerk");
		System.out.println("setting record2");
		
		name2.setName("Raman");
		name2.setGender("Male");
		name2.setAge(30);
		name2.setDesignation("Assistant Manager");
		System.out.println("setting record2");
		
		name3.setName("Shankar");
		name3.setGender("Male");
		name3.setAge(28);
		name3.setDesignation("Clerk");
		System.out.println("setting record2");
		
		name4.setName("Sangeetha");
		name4.setGender("Female");
		name4.setAge(27);
		name4.setDesignation("Receptionist");
		System.out.println("setting record2");
		
		name5.setName("Ramachandran");
		name5.setGender("Male");
		name5.setAge(40);
		name5.setDesignation("General Manager");
		System.out.println("setting record2");
		
		name6.setName("Kalyani");
		name6.setGender("Female");
		name6.setAge(33);
		name6.setDesignation("Manager");
		System.out.println("after setting all objects");
		
		System.out.println("adding names object in arraylist");
		
		namelist.add(name1);
		
		namelist.add(name2);
		namelist.add(name3);
		namelist.add(name4);
		namelist.add(name5);
		namelist.add(name6);
 
		setNamelist(namelist);
		System.out.println("after setting namelist");
		//return namelist;
	}
 
	public String getItemName() {
		return itemName;
	}
 
	public void setItemName(String str1) {
		itemName = str1;
	}
 
	public ArrayList<Names> getNamelist() {
		return namelist;
	}
 
	public void setNamelist(ArrayList<Names> namelist) {
		this.namelist = namelist;
	}
 
}
 
 
faces-config.xml entry:
 
<managed-bean>
	<managed-bean-name>samplelist</managed-bean-name>
	<managed-bean-class>SampleListBoxController</managed-bean-class>
	<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

Open in new window

0
Kadhiravan
Asked:
Kadhiravan
1 Solution
 
VenabiliCommented:
Oh - this is one of the quirky cryptic things... Usually have to do with selectItems element - and as I see only one of them in your code: suspect that the issue is here:
<f:selectItems value="#{var.name}" />
Make sure that var AND var.name are not null and that this is what you are trying to do.

This error in most cases indicate that a value cannot be taken... even though it complains for conversion.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now