1

我有以下代码:

otroDemo.java:

package beans;

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ApplicationScoped;

@ManagedBean(name = "otroDemo")
@ApplicationScoped
public class otroDemo implements Serializable {

    private static final long serialVersionUID = 1L;

    private String valor;

    public otroDemo() {
        valor = "AAAA!!";
    }

    public String getValor() {
        return valor;
    }

    public void setValor(String valor) {
        this.valor = valor;
    }
}

otroDemo.xhtml

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
...
<div id="contenido">
    <p:panel header="Blablabla" styleClass="panel">
        <h:outputText value="#{otroDemo.valor}" />
    </p:panel>
</div>

我正在使用 JSF 2、PrimeFaces 3.4.RC1、Mojarra 2.1.12 和 Glassfish 3.1.2。

问题:我得到以下异常:

javax.el.PropertyNotFoundException: /otrodemo.xhtml @93,67 value="#{otroDemo.valor}": The class 'beans.otroDemo$Proxy$_$$_WeldClientProxy' does not have the property 'valor'.
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
    at javax.faces.component.UIOutput.getValue(UIOutput.java:169)
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:59)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:43)
    at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:192)
    at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:115)
    at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:55)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:424)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    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:594)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    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:722)

而且我不太确定这里有什么问题。它以前有效,现在无效。你能帮我一把吗?

4

1 回答 1

1

我不太确定这里有什么问题。它以前有效,现在无效。

...

当我清理我的项目时出现错误:无法删除文件 C:\Users...\NetBeansProjects...\build\web\WEB-INF\lib\sqljdbc4.jar

服务器的工作文件夹显然变脏了。可以发生。有太多可能的因素会导致这种情况。服务器在开发过程中密集地进行热发布/热部署,并且可能在并发时刻,文件被锁定,从而由于某种原因忽略/取消了解锁,这反过来又导致在热部署期间无法进行清理。这可能是 IDE、服务器或使用的插件中的错误,谁知道呢。

您最好的选择是关闭服务器,然后执行通常的清理/重建/重新部署/重新启动过程。

于 2012-10-03T20:47:40.663 回答