1 2 Previous Next 16 Replies Latest reply on Nov 13, 2006 2:43 PM by Maurice Zeijen

    Base is null Error.

    Omar Abou Mrad Newbie

      Greetings,

      I'm building a simple Seam application from scratch. However i've ran into an error when trying to access a method in a session bean. Sadly i was unable to debug the error granted i'm fairly new to JBoss Seam.

      The application merely retrieves data from the database and lists them using jsf DataTable.

      Here's a detailed list of the data i currently have:

      application.xml

       <display-name>Phone Directory</display-name>
       <module>
       <web>
       <web-uri>phonedir.war</web-uri>
       <context-root>/phonedir</context-root>
       </web>
       </module>
       <module>
       <ejb>phonedir.ejb3</ejb>
       </module>
       <module>
       <java>jboss-seam.jar</java>
       </module>
      </application>
      


      components.xml
      <?xml version="1.0" encoding="utf-8"?>
      <components>
       <component name="org.jboss.seam.core.init">
       <property name="jndiPattern">phonedir/#{ejbName}/local</property>
       </component>
      </components>
      


      ejb-jar.xml
      <ejb-jar>
       <assembly-descriptor>
       <interceptor-binding>
       <ejb-name>*</ejb-name>
       <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
       </interceptor-binding>
       </assembly-descriptor>
      </ejb-jar>
      


      faces-config.xml
      <faces-config>
      <lifecycle>
      <phase-listener>org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener</phase-listener>
      </lifecycle>
      </faces-config>
      


      persistence.xml
      <persistence>
       <persistence-unit name="userDatabase">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/PhonedirDS</jta-data-source>
       <properties>
       <property name="hibernate.hbm2ddl.auto" value="update"/>
       </properties>
       </persistence-unit>
      </persistence>
      


      web.xml
      <web-app version="2.4"
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
       http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
       <!-- Seam -->
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
       <!-- MyFaces -->
       <listener>
       <listener-class>
       org.apache.myfaces.webapp.StartupServletContextListener
       </listener-class>
       </listener>
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!-- Faces Servlet Mapping -->
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
      </web-app>
      


      Contact entity bean
      @Entity
      @Name("contact")
      @Table(name="phonedir")
      public class Contact implements Serializable {
       private int id;
       private String fullName;
       private String telephone;
       private String extension;
       private String company;
       private String switchBoard;
      
       @Id @GeneratedValue
       public int getId(){
       return id;
       }
      
       public void setId(int id){
       this.id = id;
       }
      
       public String getFullName(){
       return fullName;
       }
      
       public void setFullName(String fullName){
       this.fullName = fullName;
       }
      
       public String getTelephone(){
       return telephone;
       }
      
       public void setTelephone(String telephone){
       this.telephone = telephone;
       }
      
       public String getExtension(){
       return extension;
       }
      
       public void setExtension(String extension){
       this.extension = extension;
       }
      
       public String getCompany(){
       return company;
       }
      
       public void setCompany(String company){
       this.company = company;
       }
      
       public String getSwitchboard(){
       return switchBoard;
       }
      
       public void setSwitchboard(String switchboard){
       this.switchBoard = switchboard;
       }
      }
      


      Local interface ContactManager
      @Local
      public interface ContactManager {
       public String getAllContacts();
      }
      


      Stateless bean
      @Stateless
      @Name("contactManager")
      @Interceptors(SeamInterceptor.class)
      public class ContactManagerBean implements ContactManager{
       @Out
       private List <Contact> allContacts;
      
       @PersistenceContext
       private EntityManager em;
      
       public String getAllContacts(){
       System.out.println("Inside method");
       allContacts = em.createQuery("from Contact c").getResultList();
       return null;
       }
      }
      


      jsf page (omitted headers)
      <f:view>
       <head>
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       <title></title>
       </head>
       <body>
       <h:form>
       <h:commandButton type="submit" value="fetch" action="#{contactManager.getAllContacts}"/>
       </h:form>
       <f:subview id="allContacts" rendered="#{!empty(allContacts)}">
       <f:verbatim>
       <p>List of Contacts:</p>
       </f:verbatim>
       ------- 1
       <h:dataTable value="#{allContacts}" var="contact">
       <h:column>
       <h:outputText value="#{contact.fullName}"/>
       </h:column>
       </h:dataTable>
       ------- 2
       </f:subview>
      
       </body>
      </f:view>
      


      -------------

      Packaging and deploying the application generates no header. Loading the initial page as well generates no errors. However upon clicking the button. The following error is generated: (Note that the debug statement does not print hence the method was not invoked to begin with.)


      12:05:37,605 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      javax.faces.FacesException: Error calling action method of component with id _idJsp0:_idJsp1
      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 #{contactManager.getAllContacts}
      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:71)
      at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
      at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:71)
      at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
      ... 25 more
      Caused by: javax.faces.el.PropertyNotFoundException: Base is null: contactManager
      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)
      ... 30 more


      Please advise.



        • 1. Re: Base is null Error.
          Omar Abou Mrad Newbie

          Additional Information:
          [Server] Release ID: JBoss [Zion] 4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)

          • 2. Re: Base is null Error.
            Omar Abou Mrad Newbie

            Forgot to add that i'm using JBoss Seam 1.1.0 BETA1

            • 3. Re: Base is null Error.
              Jack Tirus Newbie

              Dear xterm,

              I just saw your blog.. I am really sorry I wasn't able to reply earlier. Well I did my best to help you but couldn't find any answer so I want to consolidate you in this period hoping that someone can answer you asap.

              Best Regards,
              John

              • 4. Re: Base is null Error.
                Omar Abou Mrad Newbie

                Thank you John,

                If you happen to have any idea i might try, please dont hesistate to reply.

                • 5. Re: Base is null Error.
                  Pete Muir Master

                  For some reason the contactManager component is being found. Does the contactManager component get found when Seam starts?

                  Btw the spec changed - the ejb3 archive should actually be .jar not .ejb3

                  • 6. Re: Base is null Error.
                    Omar Abou Mrad Newbie

                    Dear Mr. petemuir,

                    I've changed the .ejb3 file back to .jar

                    Here's an exerpt upon loading Jboss, which includes the Seam initialization:

                    18:07:40,393 INFO [Initialization] initializing Seam
                    18:07:40,443 INFO [Component] Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Init
                    18:07:40,489 INFO [Component] Component: expressions, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Expressions
                    18:07:40,495 INFO [Component] Component: org.jboss.seam.core.pages, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Pages
                    18:07:40,510 INFO [Component] Component: events, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Events
                    18:07:40,513 INFO [Component] Component: org.jboss.seam.core.conversationEntries, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationEntries
                    18:07:40,532 INFO [Component] Component: org.jboss.seam.core.manager, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.core.Manager
                    18:07:40,548 INFO [Component] Component: switcher, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.Switcher
                    18:07:40,554 INFO [Component] Component: redirect, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.Redirect
                    18:07:40,558 INFO [Component] Component: httpError, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.HttpError
                    18:07:40,562 INFO [Component] Component: userPrincipal, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.UserPrincipal
                    18:07:40,588 INFO [Component] Component: isUserInRole, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.IsUserInRole
                    18:07:40,591 INFO [Component] Component: conversation, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.Conversation
                    18:07:40,599 INFO [Component] Component: conversationList, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationList
                    18:07:40,604 INFO [Component] Component: conversationStack, scope: PAGE, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationStack
                    18:07:40,613 INFO [Component] Component: facesContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.FacesContext
                    18:07:40,617 INFO [Component] Component: pageContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.PageContext
                    18:07:40,621 INFO [Component] Component: eventContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.EventContext
                    18:07:40,637 INFO [Component] Component: sessionContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.SessionContext
                    18:07:40,641 INFO [Component] Component: applicationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.ApplicationContext
                    18:07:40,645 INFO [Component] Component: conversationContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.ConversationContext
                    18:07:40,652 INFO [Component] Component: businessProcessContext, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.BusinessProcessContext
                    18:07:40,656 INFO [Component] Component: locale, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.Locale
                    18:07:40,660 INFO [Component] Component: messages, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.Messages
                    18:07:40,664 INFO [Component] Component: theme, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.theme.Theme
                    18:07:40,668 INFO [Component] Component: themeSelector, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.theme.ThemeSelector
                    18:07:40,691 INFO [Component] Component: interpolator, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.Interpolator
                    18:07:40,696 INFO [Component] Component: facesMessages, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.FacesMessages
                    18:07:40,727 INFO [Component] Component: resourceBundle, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.ResourceBundle
                    18:07:40,735 INFO [Component] Component: localeSelector, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.LocaleSelector
                    18:07:40,739 INFO [Component] Component: uiComponent, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.core.UiComponent
                    18:07:40,744 INFO [Component] Component: param, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.core.RenderParameters
                    18:07:40,747 INFO [Component] Component: org.jboss.seam.core.safeActions, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.SafeActions
                    18:07:40,752 INFO [Component] Component: org.jboss.seam.remoting.messaging.subscriptionRegistry, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.remoting.messaging.SubscriptionRegistry
                    18:07:40,758 INFO [Component] Component: org.jboss.seam.remoting.remotingConfig, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.remoting.RemotingConfig
                    18:07:40,761 INFO [Component] Component: org.jboss.seam.core.persistenceContexts, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.PersistenceContexts
                    18:07:40,764 INFO [Component] Component: currentDate, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.framework.CurrentDate
                    18:07:40,933 INFO [Component] Component: currentTime, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.framework.CurrentTime
                    18:07:40,944 INFO [Component] Component: currentDatetime, scope: STATELESS, type: JAVA_BEAN, class: org.jboss.seam.framework.CurrentDatetime
                    18:07:41,408 INFO [Component] Component: org.jboss.seam.securityManager, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.security.SeamSecurityManager
                    18:07:41,418 INFO [Component] Component: org.jboss.seam.core.exceptions, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Exceptions
                    18:07:41,424 INFO [Component] Component: pojoCache, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.PojoCache
                    18:07:41,446 INFO [Lifecycle] starting up: applicationContext
                    18:07:41,446 INFO [Lifecycle] starting up: isUserInRole
                    18:07:41,447 INFO [Lifecycle] starting up: userPrincipal
                    18:07:41,447 INFO [Lifecycle] starting up: sessionContext
                    18:07:41,448 INFO [Lifecycle] starting up: facesContext
                    18:07:41,448 INFO [Lifecycle] starting up: businessProcessContext
                    18:07:41,448 INFO [Lifecycle] starting up: eventContext
                    18:07:41,449 INFO [Lifecycle] starting up: expressions
                    18:07:41,449 INFO [Lifecycle] starting up: pageContext
                    18:07:41,450 INFO [Lifecycle] starting up: conversationContext
                    18:07:41,450 INFO [Initialization] done initializing Seam
                    


                    • 7. Re: Base is null Error.
                      Pete Muir Master

                      Ah. From the problems FAQ
                      ---------------------------------
                      My component isn't being found (methods on the page don't get called, the constructor isn't called, the page appears to just refresh in the browser)

                      Seam probably hasn't found the component. Check in your log file, you should see something like

                      [Scanner] scanning: /C:/java/jboss-4.0.4/server/default/tmp/deploy/tmp27153jboss-seam-todo.ear-contents/jboss-seam-todo.jar
                      [Component] Component: login, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.example.todo.Login
                      [Component] Component: todoList, scope: EVENT, type: JAVA_BEAN, class: org.jboss.seam.example.todo.TodoList

                      if you don't make sure you have seam.properties in the root of the archive in which your seam components reside.

                      • 8. Re: Base is null Error.
                        Omar Abou Mrad Newbie

                        Just noticed the following:

                        18:15:57,763 INFO [Ejb3Configuration] found EJB3 Entity bean: Contact
                        18:15:57,764 WARN [Ejb3Configuration] Persistence provider caller does not implements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
                        


                        Would this be affecting anything?

                        • 9. Re: Base is null Error.
                          Omar Abou Mrad Newbie

                          Thank you petemuir,

                          I'll try to fix what i missed.

                          • 10. Re: Base is null Error.
                            Omar Abou Mrad Newbie

                            Dear petemuir,

                            Adding seam.properties to the root of the ejb archive has fixed my problem. Thank you.

                            I left this file out of the archive since i saw the content was commented out (When i generated the seam application using Hibernate Tools).

                            I still however, dont understand why seam would check for this file even if there's no content to be parsed.

                            Regards,

                            x

                            • 11. Re: Base is null Error.
                              Gavin King Master

                              Because Java provides no way to scan for classes in the classpath (this is a JVM limitation), but *does* provide a way to ask for all resources with a particular name.

                              • 12. Re: Base is null Error.
                                Omar Abou Mrad Newbie

                                Thank you sir.

                                • 13. Re: Base is null Error.
                                  Fady Matar Novice

                                  Gavin, what if you embed the seam.properties file within jboss-seam.jar and leave it blank, then the users would update it in their application (override) if required?

                                  • 14. Re: Base is null Error.
                                    Gavin King Master

                                    That would only work if the user was to package his classes into jboss-seam.jar.

                                    1 2 Previous Next