3 Replies Latest reply on Jun 12, 2011 12:34 PM by Luiz Gomes

    Target Unreachable, identifier resolved to null

    Fabian Rivera Newbie

      Hello everyone, I'm just starting with SEAM so I'm sorry if this is an obvious question, but I can't resolve the following problem.

      I started a new Seam Web Project in Eclipse using JBoss Tools, the home.seam page worked as expected. Then I changed the contents of home.xhtml following an example to this:

       

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:rich="http://richfaces.org/rich"
          template="layout/template.xhtml">

       

          <ui:define name="body">

             

              <h:form >
                  <h:panelGrid columns="2">
                      Value1: <h:inputText value="#{calculator.value1}"/>
                      Value2: <h:inputText value="#{calculator.value2}"/>
                     The resutl is:<h:outputText value="#{calculator.answer}"/>
                  </h:panelGrid>
                  <h:commandButton value="Add" action="#{calcAction.calculate}"/>
              </h:form>
             
          </ui:define>
      </ui:composition>

       

      I created a new class in the ejb/ejbModule called Calculator:

      @Name("calculator")
      public class Calculator {
          private double value1;
          private double value2;
          private double answer;
          public void setValue1(double value1) {
              this.value1 = value1;
          }
          public double getValue1() {
              return value1;
          }
          public void setValue2(double value2) {
              this.value2 = value2;
          }
          public double getValue2() {
              return value2;
          }
          public void setAnswer(double answer) {
              this.answer = answer;
          }
          public double getAnswer() {
              return answer;
          }
          public void add()
          {
              this.answer=value1+value2;
          }

       

      }

      Also the CalcAction class:

       

      @Stateless
      @Name("calcAction")
      public class CalcAction implements Calc {
      @In
      @Out
      private Calculator calculator;
      public String calculate()
      {
          calculator.add();
          return "";
      }
      }

      with the Calc interface
      @Local

      public interface Calc {
          public String calculate();
      }

       

       

      The home.xhtml show all the elements, but when I click the Add button, I get the following exception:


      23:03:38,019 WARNING [lifecycle] /home.xhtml @18,62 value="#{calculator.value1}": Target Unreachable, identifier 'calculator' resolved to null
      javax.el.PropertyNotFoundException: /home.xhtml @18,62 value="#{calculator.value1}": Target Unreachable, identifier 'calculator' resolved to null
          at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
          at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:92)
          at javax.faces.component.UIInput.getConvertedValue(UIInput.java:942)
          at javax.faces.component.UIInput.validate(UIInput.java:868)
          at javax.faces.component.UIInput.executeValidate(UIInput.java:1072)
          at javax.faces.component.UIInput.processValidators(UIInput.java:672)
          at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
          at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1058)
          at javax.faces.component.UIForm.processValidators(UIForm.java:235)
          at org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:439)
          at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
          at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:455)
          at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
          at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
          at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
          at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
          at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
          at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Unknown Source)
      23:03:38,218 SEVERE [lifecycle] JSF1054: (Phase ID: PROCESS_VALIDATIONS 3, View ID: /home.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@55b768]

       

      What I am doing wrong or what should I modify in order for the page to work.

      Thanks a lot.