4 Replies Latest reply on Oct 4, 2007 6:38 AM by w17chm4n

    Base is null

    w17chm4n

      I`m having a problem while trying to run my application (Seam 1.2.1) on JBoss 4.0.5.

      Let the code explain...

      controllertest.jsp (jsf)

      <%@page contentType="text/html"%>
      <%@page pageEncoding="UTF-8"%>
      
      <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
      <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
      
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      
      <html>
       <body>
       <f:view>
       <h:form id="controller">
       <p>
       <h:commandButton value="Add new category (QuestionCategoryManger)" action="#{QuestionCategoryManager.test}"/>
       </p>
       </h:form>
       </f:view>
       </body>
      </html>
      


      QuestionCategoryManager
      import java.util.List;
      import javax.ejb.Local;
      
      @Local
      public interface QuestionCategoryManager {
       String test();
       void addCategory(String categoryName);
       void removeCategory(long id, boolean withQuestions);
       void removeCategory(String categoryName, boolean withQuestions);
       QuestionCategory getQuestionCategoryById(long id);
       QuestionCategory getQuestionCategoryByName(String categoryName);
       List<QuestionCategory> getAllQuestionsCategories();
      }
      


      QuestionCategoryControllerBean
      mport javax.ejb.Stateless;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      
      
      /**
       *
       * @author W17chM4n
       */
      
      @Stateless(name="QuestionCategoryManger")
      public class QuestionCategoryManagerBean implements QuestionCategoryManager {
      
       @PersistenceContext
       private EntityManager em;
      
       public String test() {
       return "success";
       }
      
       public void addCategory(String categoryName) {
       em.persist(new QuestionCategory(categoryName));
       }
      
       public void removeCategory(long id, boolean withQuestions) {
       }
      
       public void removeCategory(String categoryName, boolean withQuestions) {
       }
      
       public QuestionCategory getQuestionCategoryByName(String categoryName) {
       return (QuestionCategory)em.createQuery("from QuestionCategory q where q.categoryName='" + categoryName + "'").getSingleResult();
       }
      
       public QuestionCategory getQuestionCategoryById(long id) {
       return (QuestionCategory)em.createQuery("from QuestionCategory q where q.id="+String.valueOf(id)).getSingleResult();
       }
      
       public List<QuestionCategory> getAllQuestionsCategories() {
       return em.createQuery("from QuestionCategory q").getResultList();
       }
      }
      


      So here it is. I`m building it with maven, and while deploying, everything is allright. But when i push the button i get this:

      15:21:35,596 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      javax.faces.FacesException: Error calling action method of component with id controller:_idJsp0
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
       at javax.faces.component.UICommand.broadcast(UICommand.java:106)
       at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
       at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{QuestionCategoryManager.test}
       at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:165)
       at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
       at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
       ... 25 more
      Caused by: javax.faces.el.PropertyNotFoundException: Base is null: QuestionCategoryManager
       at org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:460)
       at org.apache.myfaces.el.MethodBindingImpl.resolveToBaseAndProperty(MethodBindingImpl.java:180)
       at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:114)
       ... 28 more
      


      I don`t know why seam can`t find ejb bean. Is there a way to test if SeamInterceptor is running ?

      JNDI Namespace tells that the bean exists:
      +- Inquisitor (class: org.jnp.interfaces.NamingContext)
       | +- QuestionCategoryManger (class: org.jnp.interfaces.NamingContext)
       | | +- local (proxy: $Proxy191 implements interface com.blstream.inquisitor.ejb3.interfaces.QuestionCategoryManager,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
      


      Can anybody help me ?