java.lang.IllegalArgumentException:javax.faces.component.UIComponentBase.isRendered

时间:2015-11-12 07:56:47

标签: jsf jsf-2 el illegalargumentexception rendered-attribute

我得到了一个非常尴尬的预测,我不知道出了什么问题:我使用Glassfish 3.1.2,JSF,EJB和JPA。我完全不知道出了什么问题:(我希望你能给我一些细节

[#|2015-11-12T08:52:00.089+0100|SEVERE|oracle-glassfish3.1.2|javax.enterprise.resource.webcontainer.jsf.application|_ThreadID=92;_ThreadName=http-thread-pool-18190(5);|Error Rendering View[/error.xhtml]
java.lang.IllegalArgumentException: wrong number of arguments
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:779)
    at javax.el.BeanELResolver.invoke(BeanELResolver.java:528)
    at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:257)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:134)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:183)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
    at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
    at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:415)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1772)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1781)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1781)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:452)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:604)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1554)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:808)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:510)
    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:479)
    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:361)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:474)
    at org.apache.catalina.core.StandardHostValve.dispatchToErrorPage(StandardHostValve.java:671)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:358)
    at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:322)
    at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:219)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:656)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:334)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:230)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:311)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:189)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:850)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:747)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1032)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:231)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:745)
|#]

[#|2015-11-12T08:52:00.090+0100|WARNING|oracle-glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web._vs.server|_ThreadID=92;_ThreadName=Thread-12;|ApplicationDispatcher[/aip] PWC1231: Servlet.service() for servlet FacesServlet threw exception
java.lang.IllegalArgumentException: wrong number of arguments
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:779)
    at javax.el.BeanELResolver.invoke(BeanELResolver.java:528)
    at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:257)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:134)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:183)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
    at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
    at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:415)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1772)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1781)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1781)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:452)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:604)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1554)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:808)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:510)
    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:479)
    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:361)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:474)
    at org.apache.catalina.core.StandardHostValve.dispatchToErrorPage(StandardHostValve.java:671)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:358)
    at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:322)
    at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:219)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:656)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:334)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:230)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:311)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:189)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:850)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:747)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1032)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:231)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:745)
|#]

我的error.xhtml看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<!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:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core">
<h:body>

    <ui:composition template="layout.xhtml">

        <ui:define name="headline">
                Fehler
            </ui:define>

        <ui:define name="subheadline">
                Es ist ein Fehler aufgetreten
            </ui:define>

        <ui:define name="content">
            <div class="container">
                <h3>Details</h3>
                <div class="container-content">
                    Es ist ein unerwarteter Fehler aufgetreten

                    <br />
                    <br />
                    #{currentDate}: 
                </div>
            </div>
        </ui:define>
    </ui:composition>

</h:body>
</html>

更新

好的,我想我发现了问题:

layout.xhtml中的

我有以下几行:     rendered="#{userSession.hasRole('APPROVER')}"

在视图中我有以下签名:

public boolean hasRole(RoleType role);

public boolean hasRole(String role);

public boolean hasRole(RoleType... roles);

我的猜测是它与varargs方法有关。比较:Invoke method with varargs in EL throws java.lang.IllegalArgumentException: wrong number of arguments

感谢您的帮助!

0 个答案:

没有答案