webtier@glassfish.java.net

Re: [webtier] Error Rendering View[/categorias.xhtml] java.lang.IllegalArgumentException

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Mon, 03 Aug 2009 10:01:49 -0400

Another possibility is that you are attempting to pass in an invalid
attribute type: a String instead of a MethodExpression, for example.
That would cause an IAE.

--Lincoln

On Sun, 2009-08-02 at 20:17 -0700, Jim Driscoll wrote:

> Just as a hint, JSF 2 Facelets pages need to be valid XML.
>
> That means that you can't have an id that's " ", or that's "". There
> are other rules as well.
>
> The hint is in the name of the method that threw the Exception - validateId.
>
> I believe that we've added a couple error messages to help diagnose the
> problem, in the latest versions of Mojarra.
>
>
> Jim
>
> On 8/2/09 9:56 AM, webtier_at_javadesktop.org wrote:
> > Hello,
> >
> > I am newer in JSF. I am developping a web app that load the first page. This page has a command button to load the second page categorias.xml. And it is at this point where the app throws the exception,
> >
> > Error Rendering View[/categorias.xhtml]
> > java.lang.IllegalArgumentException
> > at javax.faces.component.UIComponentBase.validateId(UIComponentBase.java:523)
> > at javax.faces.component.UIComponentBase.setId(UIComponentBase.java:333)
> > at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:151)
> > at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:64)
> > at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:131)
> > at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:310)
> > at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:280)
> > at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
> > at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
> > at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
> > at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
> > at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
> > at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
> > at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
> > at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
> > at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:144)
> > at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
> > at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
> > at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
> > at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
> > at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:524)
> > at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
> > at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
> > at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
> > at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
> > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
> > at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
> > at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
> > at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
> > at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> > at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
> > at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> > at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> > at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> > at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> > at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
> > at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
> > at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.executeServlet(CometEngine.java:547)
> > at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.handle(CometEngine.java:299)
> > at com.sun.enterprise.web.connector.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:87)
> > at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:175)
> > at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:153)
> > at com.sun.enterprise.web.connector.grizzly.async.AsyncProcessorTask.doTask(AsyncProcessorTask.java:92)
> > at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
> > at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
> > executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl_at_1e72466) threw exception
> > java.lang.IllegalArgumentException
> > at javax.faces.component.UIComponentBase.validateId(UIComponentBase.java:523)
> > at javax.faces.component.UIComponentBase.setId(UIComponentBase.java:333)
> > at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:151)
> > at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:64)
> > at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:131)
> > at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:310)
> > at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:280)
> > at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
> > at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
> > at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
> > at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
> > at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
> > at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
> > at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
> > at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
> > at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:144)
> > at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
> > at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
> > at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
> > at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
> > at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:524)
> > at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
> > at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
> > at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
> > at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
> > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
> > at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
> > at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
> > at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
> > at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> > at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
> > at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> > at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> > at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
> > at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> > at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> > at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> > at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
> > at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
> > at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.executeServlet(CometEngine.java:547)
> > at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.handle(CometEngine.java:299)
> > at com.sun.enterprise.web.connector.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:87)
> > at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:175)
> > at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:153)
> > at com.sun.enterprise.web.connector.grizzly.async.AsyncProcessorTask.doTask(AsyncProcessorTask.java:92)
> > at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
> > at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
> > etc...
> >
> > This is the backing bean,
> >
> > public class CategoriasBean implements Serializable {
> >
> > private CategoriaJpaController controller;
> > protected List<DetalleCategoria> categorias;
> > protected DetalleCategoria detalleCategoria;
> > protected String selectedItem;
> >
> > public CategoriasBean() {
> > getListCategorias();
> > }
> >
> > private void getListCategorias() {
> > controller = new CategoriaJpaController();
> > List<DetalleCategoria> list = controller.findCategoriaEntities();
> > this.categorias = list;
> > }
> >
> > public void prepareForEdit(ActionEvent anEvent) {
> >
> > CategoriasBean tmpBean = null;
> > try {
> > UIComponent tmpComponent = anEvent.getComponent();
> >
> > while (null != tmpComponent&& !(tmpComponent instanceof UIData)) {
> > tmpComponent = tmpComponent.getParent();
> > }
> >
> > if (tmpComponent != null&& (tmpComponent instanceof UIData)) {
> > Object tmpRowData = ((UIData) tmpComponent).getRowData();
> > if (tmpRowData instanceof CategoriasBean) {
> > tmpBean = (CategoriasBean) tmpRowData;
> > }
> > }
> > //TODO Exception Handling if UIData not found or tmpRowBean of wrong type
> > } catch (IllegalArgumentException e) {
> > throw new IllegalArgumentException("Se jodio!!! " + e.getMessage());
> > }
> > }
> >
> > public List getSelectItems() {
> > List selectItems = new ArrayList();
> > Iterator it = categorias.iterator();
> > while (it.hasNext()){
> > DetalleCategoria dc = (DetalleCategoria) it.next();
> > selectItems.add(new SelectItem(dc.getIdCategoria().toString(), dc.getCategoria()));
> > }
> > // The values are the keys passed to the selectItem property.
> > // The labels are those what you see on the menu.
> >
> > return selectItems;
> > }
> >
> > /**
> > * @return the categorias
> > */
> > public List<DetalleCategoria> getCategorias() {
> > return categorias;
> > }
> >
> > /**
> > * @param categorias the categorias to set
> > */
> > public void setCategorias(List<DetalleCategoria> categorias) {
> > this.categorias = categorias;
> > }
> >
> > public DetalleCategoria getDetalleCategoria() {
> > return detalleCategoria;
> > }
> >
> > /**
> > * @param detailCategoria the detailCategoria to set
> > */
> > public void setDetalleCategoria(DetalleCategoria detalleCategoria) {
> > this.detalleCategoria = detalleCategoria;
> > }
> >
> > public String getSelectedItem() {
> > if (selectedItem == null) {
> > selectedItem = "1"; // This will be the default selected item.
> > }
> > return selectedItem;
> > }
> > }
> >
> > and this is the jsf,
> >
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > <html xmlns="http://www.w3.org/1999/xhtml"
> > xmlns:ui="http://java.sun.com/jsf/facelets"
> > xmlns:h="http://java.sun.com/jsf/html"
> > xmlns:f="http://java.sun.com/jsf/core"
> > xmlns:c="http://java.sun.com/jstl/core">
> > <body>
> > <center>
> > <ui:composition template="/template.xhtml">
> >
> > <center>
> > <ui:define name="title">
> > <h:form id="">
> > <h:outputText value="#{ManagedBean.subcategorias}"/>
> > </h:form>
> > </ui:define>
> > </center>
> >
> > <center>
> > <ui:define name="body">
> > <h:form id="frmCategorias">
> > <h:selectOneMenu value="#{CategoriasBean.selectedItem}">
> > <f:selectItems value="#{CategoriasBean.selectItems}" />
> > </h:selectOneMenu>
> > </h:form>
> > </ui:define>
> > </center>
> >
> > </ui:composition>
> > </center>
> > </body>
> > </html>
> >
> > What is going wrong?
> >
> > Thnaks in advance,
> > Jose Alvarez de Lara
> > [Message sent by forum member 'josealvarezdelara' (josealvarezdelara)]
> >
> > http://forums.java.net/jive/thread.jspa?messageID=358515
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>