0 Replies Latest reply on Dec 18, 2010 2:17 AM by Bhanchand Prasad

    SessionBean visibility: Target Unreachable, identifier 'register' resolved to null

    Bhanchand Prasad Newbie
      Websphere 7.0.13 using RAD 8.0.1
      Seam 2.2 GA


      "Runtime error:
      Caused by: javax.faces.el.EvaluationException: javax.el.PropertyNotFoundException: register.xhtml @18,85 action="#{register.register}": Target Unreachable, identifier 'register' resolved to null"

      Ear deployed with no errors
      register.xhtml
      =========================================
      <h:commandButton type="submit" value="Register" action="#{register.register}"/>



      SessionBean in the EJB Module
      ================================================


      `@Stateless                                                                             
      @Name("register")
      @JndiName("ejblocal:org.RegisterAction")
      public class RegisterAction implements Register
      {

         @In
         private User user;
        
         @PersistenceContext                                                                  
         private EntityManager em;
        
         @Logger                                                                              
         private Log log;
        
         public String register()                                                             
         {
            List existing = em.createQuery(
               "select username from User where username=#{user.username}")                   
               .getResultList();
              
            if (existing.size()==0)
            {
               em.persist(user);
               log.info("Registered new user #{user.username}");                              
               return "/registered.jspx";                                                     
            }
            else
            {
               FacesMessages.instance().add("User #{user.username} already exists");         
               return null;
            }
         }

      }`




      |Components.xml
      ==========================================================
         <!--   <core:init debug="true" jndi-pattern="@jndiPattern@"/>-->
         <core:init jndi-pattern="java:comp/env/#{ejbName}"   debug="true" />

      ejb-jar.xml
      ==========================================================
         <?xml version="1.0" encoding="UTF-8"?>
         <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation=
                  "http://java.sun.com/xml/ns/javaee
                   http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
                  version="3.0">
        
           <interceptors>
             <interceptor>
               <interceptor-class>
                 org.jboss.seam.ejb.SeamInterceptor
               </interceptor-class>
             </interceptor>
           </interceptors>
          
           <assembly-descriptor>
             <interceptor-binding>
               <ejb-name>*</ejb-name>
               <interceptor-class>
                 org.jboss.seam.ejb.SeamInterceptor
               </interceptor-class>
             </interceptor-binding>
           </assembly-descriptor>
          
      </ejb-jar>

      application.xml
      ==============================================================
      <?xml version="1.0" encoding="UTF-8"?>
      <application xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
           version="5">

           <display-name>@earProjectName@</display-name>

           <!-- JBIDE-4166 Workaround - Make sure we deploy this first, since this is referenced in xxx-ejb.jar-->
           <module>
                <ejb>jboss-seam.jar</ejb>
           </module>
           
           <module>
                <web>
                     <web-uri>XyzEAR.war</web-uri>
                     <context-root>/XyzEAR</context-root>
                </web>
           </module>

           <module>
                <ejb>XyzEjb.jar</ejb>
           </module>

      </application>|

      Any ideas? Thanks in advance.

      BP