javax.faces.el.E​​valuationException:无法获取表达式的值

时间:2014-01-14 09:38:58

标签: jsf exception event-handling

我正在尝试一个关于JSF的小例子并获得Evaluator exeption。请在下面找到详细信息并提供帮助。

堆栈跟踪

Error 500--Internal Server Error 
javax.faces.el.EvaluationException: Cannot get value for expression '#    {resumeBean.colorSupported}'
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:405)
at            javax.faces.component.html.HtmlSelectOneMenu.isDisabled(HtmlSelectOneMenu.java:130)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.isDisabled(HtmlMenuRendererBase.java:81)
at     org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:59)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:498)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:366)
at jsp_servlet.__customize._jsp__tag3(__customize.java:289)
at jsp_servlet.__customize._jsp__tag1(__customize.java:199)
at jsp_servlet.__customize._jsp__tag0(__customize.java:158)
at jsp_servlet.__customize._jspService(__customize.java:124)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
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.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:533)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:266)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3244)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

 Caused by: javax.faces.FacesException: java.lang.ClassNotFoundException: Class bytes found but defineClass()failed for: 'coreservlets.ResumeBean'
at org.apache.myfaces.shared_impl.util.ClassUtils.simpleClassForName(ClassUtils.java:165)
at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:268)
at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:49)
at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:314)
at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:570)
at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
... 36 more
 Caused by: java.lang.ClassNotFoundException: Class bytes found but defineClass()failed for: 'coreservlets.ResumeBean'
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:268)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:161)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:35)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.apache.myfaces.shared_impl.util.ClassUtils.classForName(ClassUtils.java:141)
at org.apache.myfaces.shared_impl.util.ClassUtils.simpleClassForName(ClassUtils.java:160)
... 43 more
Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at     weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:355)
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:294)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:262)
... 53 more

ResumeBean.java

package coreservlets;

import javax.faces.model.*;
import javax.faces.event.*;
import java.io.*;

public class ResumeBean implements Serializable {
private String name = "";
private String jobTitle = "";
private String fgColor = "BLACK";
private String bgColor = "WHITE";
private SelectItem[] availableColorNames =
{ new SelectItem("BLACK"),
  new SelectItem("WHITE"),
  new SelectItem("SILVER"),
  new SelectItem("RED"),
  new SelectItem("GREEN"),
  new SelectItem("BLUE") };
private SelectItem[] availableColorValues =
  { new SelectItem("#000000"),
    new SelectItem("#FFFFFF"),
    new SelectItem("#C0C0C0"),
    new SelectItem("#FF0000"),
    new SelectItem("#00FF00"),
    new SelectItem("#0000FF") };
private boolean isColorSupported = true;
private boolean isUsingColorNames = true;

public String getName() { return(name); }

public void setName(String name) {
this.name = name;
}

public String getJobTitle() { return(jobTitle); }

public void setJobTitle(String jobTitle) {
this.jobTitle = jobTitle;
}

public String getFgColor() { return(fgColor); }

public void setFgColor(String fgColor) {
this.fgColor = fgColor;
}

public String getBgColor() { return(bgColor); }

public void setBgColor(String bgColor) {
this.bgColor = bgColor;
}

public SelectItem[] getAvailableColors() {
if (isUsingColorNames) {
  return(availableColorNames);
} else {
  return(availableColorValues);
}
}

public boolean getColorSupported() { return(isColorSupported); }

public void toggleColorSupport(ActionEvent event) {
isColorSupported = !isColorSupported;
}

public String getColorSupportLabel() {
if (isColorSupported) {
  return("Disable Color Customization");
} else {
  return("Enable Colors Customization");
}
}

public boolean isUsingColorNames() { 
return(isUsingColorNames); 
}

public void setUsingColorNames(boolean isUsingColorNames) {
this.isUsingColorNames = isUsingColorNames;
}

public void changeColorMode(ValueChangeEvent event) {
boolean flag = 
  ((Boolean)event.getNewValue()).booleanValue();
setUsingColorNames(!flag);
}

public String showPreview() {
if (isColorSupported && fgColor.equals(bgColor)) {
  return("same-color");
} else {
  return("success");
}
}
} 

面-config.xml中

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
  "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>
  <managed-bean>
    <managed-bean-name>resumeBean</managed-bean-name>
    <managed-bean-class>coreservlets.ResumeBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>
  <managed-bean>
    <managed-bean-name>colorBean</managed-bean-name>
    <managed-bean-class>coreservlets.ColorBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>
  <navigation-rule>
    <from-view-id>/customize.jsp</from-view-id>
    <navigation-case>
      <from-outcome>same-color</from-outcome>
      <to-view-id>/WEB-INF/results/same-color.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>success</from-outcome>
      <to-view-id>/WEB-INF/results/show-preview.jsp</to-view-id>
    </navigation-case>
  </navigation-rule>
  <navigation-rule>
    <from-view-id>/customize-bg.jsp</from-view-id>
    <navigation-case>
      <from-outcome>success</from-outcome>
      <to-view-id>/WEB-INF/results/show-preview2.jsp</to-view-id>
    </navigation-case>
  </navigation-rule>
</faces-config>

应用程序服务器:weblogic 9.2 eclipse中使用的JDK编译器:1.5

请帮忙

0 个答案:

没有答案