4 Replies Latest reply on Sep 17, 2008 12:21 PM by nimo stephan

    Could not Instantiate seam component

    swathi samala Newbie

      09:57:56,125 WARN  [lifecycle] Could not instantiate Seam component: createUser
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: createUser
           at org.jboss.seam.Component.newInstance(Component.java:1986)
           at org.jboss.seam.Component.getInstance(Component.java:1876)
           at org.jboss.seam.Component.getInstance(Component.java:1843)
           at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
           at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
           at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
           at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
           at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
           at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
           at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
           at org.jboss.el.parser.AstValue.getTarget(AstValue.java:34)
           at org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
           at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
           at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
           at javax.faces.component.UICommand.broadcast(UICommand.java:383)
           at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
           at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
           at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
           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.MultipartFilter.doFilter(MultipartFilter.java:85)
           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:141)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           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:230)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           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:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Unknown Source)
      Caused by: javax.naming.NameNotFoundException: loan not bound
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
           at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
           at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
           at javax.naming.InitialContext.lookup(Unknown Source)
           at org.jboss.seam.Component.instantiateSessionBean(Component.java:1290)
           at org.jboss.seam.Component.instantiate(Component.java:1276)
           at org.jboss.seam.Component.newInstance(Component.java:1970)
           ... 60 more
      09:57:56,125 WARN  [lifecycle] executePhase(INVOKE_APPLICATION 5,com.sun.faces.context.FacesContextImpl@199d183) threw exception
      javax.faces.FacesException: Could not instantiate Seam component: createUser
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:105)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
           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.MultipartFilter.doFilter(MultipartFilter.java:85)
           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:141)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           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:230)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           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:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Unknown Source)
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: createUser
           at org.jboss.seam.Component.newInstance(Component.java:1986)
           at org.jboss.seam.Component.getInstance(Component.java:1876)
           at org.jboss.seam.Component.getInstance(Component.java:1843)
           at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
           at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
           at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
           at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
           at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
           at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
           at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
           at org.jboss.el.parser.AstValue.getTarget(AstValue.java:34)
           at org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
           at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
           at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
           at javax.faces.component.UICommand.broadcast(UICommand.java:383)
           at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
           at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
           at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
           ... 40 more
      Caused by: javax.naming.NameNotFoundException: loan not bound
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
           at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
           at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
           at javax.naming.InitialContext.lookup(Unknown Source)
           at org.jboss.seam.Component.instantiateSessionBean(Component.java:1290)
           at org.jboss.seam.Component.instantiate(Component.java:1276)
           at org.jboss.seam.Component.newInstance(Component.java:1970)
           ... 60 more
      09:57:56,140 ERROR [ExceptionFilter] handling uncaught exception
      javax.servlet.ServletException: Could not instantiate Seam component: createUser
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
           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.MultipartFilter.doFilter(MultipartFilter.java:85)
           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:141)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           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:230)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           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:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Unknown Source)
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: createUser
           at org.jboss.seam.Component.newInstance(Component.java:1986)
           at org.jboss.seam.Component.getInstance(Component.java:1876)
           at org.jboss.seam.Component.getInstance(Component.java:1843)
           at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
           at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
           at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
           at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
           at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
           at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
           at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
           at org.jboss.el.parser.AstValue.getTarget(AstValue.java:34)
           at org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
           at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
           at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
           at javax.faces.component.UICommand.broadcast(UICommand.java:383)
           at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
           at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
           at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
           ... 37 more
      Caused by: javax.naming.NameNotFoundException: loan not bound
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
           at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
           at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
           at javax.naming.InitialContext.lookup(Unknown Source)
           at org.jboss.seam.Component.instantiateSessionBean(Component.java:1290)
           at org.jboss.seam.Component.instantiate(Component.java:1276)
           at org.jboss.seam.Component.newInstance(Component.java:1970)
           ... 60 more


      XHTML:
      -----------
      <!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:messages styleClass="message"/>
         
          <h:form id="newUser">
         
              <rich:panel>
                  <f:facet name="header">New User</f:facet>
         
                  <div class="dialog">
                      <h:panelGrid columns="2"  rowClasses="prop" columnClasses="name,value">
                          <h:outputLabel for="userName">Username</h:outputLabel>
                          <h:inputText id="userName"
                                    value="#{newUser.userName}"/>
                          <h:outputLabel for="password">Password</h:outputLabel>
                          <h:inputSecret id="password"
                                      value="#{newUser.password}"/>
                          <h:outputLabel for="confirmPassword">Confirm Password</h:outputLabel>
                          <h:inputSecret id="confirmPassword"
                                      value="#{newUser.confirmPassword}"/>
                          <h:outputLabel for="mobileNumber">Mobile Number</h:outputLabel>
                          <h:inputText id="mobileNumber"
                                    value="#{newUser.emailId}"/>                    
                          <h:outputLabel for="emailId">EmailId</h:outputLabel>
                          <h:inputText id="emailId"
                                    value="#{newUser.emailId}"/>
                      </h:panelGrid>
                  </div>
                                             
              </rich:panel>
                 
              <div class="actionButtons">
                  <h:commandButton value="save" action="#{createUser.save}"/>
              </div>
               
          </h:form>

      </ui:define>
      </ui:composition>


      Action Class:
      ------------------
      package com.manam.loan.session;

      import java.io.Serializable;
      import java.util.List;

      import javax.ejb.Stateful;
      import javax.ejb.Stateless;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;

      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.faces.FacesMessages;
      import org.jboss.seam.log.Log;
      import org.jboss.seam.security.Identity;

      import com.manam.loan.entity.NewUser;

      @Stateless

      @Name("createUser")
      public class SaveAction implements Serializable {
           @In
           private NewUser newUser;
           @PersistenceContext
           private EntityManager em;
           
           public String save()
           {
           NewUser existing =(NewUser)em.createQuery(
           "select username from newUser where username=#{user.userName}")
           .getResultList();
           if (((List) existing).size()==0)
           {
           em.persist(newUser);
           
           return "/newUser.xhtml";
           }
           else
           {
           FacesMessages.instance().add("User #{user.userName} already exists");
           return null;
          }
          }
      }
           
           
           

        • 1. Re: Could not Instantiate seam component
          swathi samala Newbie
          Actually I have created a xhtml in richfaces which should take the input and save those values to the database,but I get this exception I don't know how to solve. I am pretty sure it is a dumb mistake, but I can't see it.
          I get the same error extending EntityQuery too.
          Any ideas?

          Here is persistence.xhtml:
          ------------------------------
          <?xml version="1.0" encoding="UTF-8"?>
          <!-- Persistence deployment descriptor for dev profile -->
          <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                       version="1.0">
                      
             <persistence-unit name="loan" transaction-type="JTA">
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <jta-data-source>java:/loanDatasource</jta-data-source>
                <properties>
                   <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                   <property name="hibernate.show_sql" value="true"/>
                   <property name="hibernate.cache.use_second_level_cache" value="false"/>
                   <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
                </properties>
             </persistence-unit>
             
          </persistence>

          Here is coponents.xml:
          ----------------------
          <?xml version="1.0" encoding="UTF-8"?>
          <components xmlns="http://jboss.com/products/seam/components"
                      xmlns:core="http://jboss.com/products/seam/core"
                      xmlns:persistence="http://jboss.com/products/seam/persistence"
                      xmlns:drools="http://jboss.com/products/seam/drools"
                      xmlns:bpm="http://jboss.com/products/seam/bpm"
                      xmlns:security="http://jboss.com/products/seam/security"
                      xmlns:mail="http://jboss.com/products/seam/mail"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xsi:schemaLocation=
                          "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                           http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
                           http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd
                           http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd
                           http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                           http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
                           http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">

             <core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>
              
             <core:manager concurrent-request-timeout="500"
                           conversation-timeout="120000"
                           conversation-id-parameter="cid"
                           parent-conversation-id-parameter="pid"/>
             
             <persistence:managed-persistence-context name="entityManager"
                                               auto-create="true"
                                    entity-manager-factory="#{loanEntityManagerFactory}"/>

             <persistence:entity-manager-factory name="loanEntityManagerFactory"
                                persistence-unit-name="loan"/>
            
             <drools:rule-base name="securityRules">
                 <drools:rule-files><value>/security.drl</value></drools:rule-files>
             </drools:rule-base>

             <security:identity authenticate-method="#{authenticator.authenticate}"
                                     security-rules="#{securityRules}"
                                        remember-me="true"/>
                                       
             <event type="org.jboss.seam.security.notLoggedIn">
                 <action execute="#{redirect.captureCurrentView}"/>
             </event>
             <event type="org.jboss.seam.security.loginSuccessful">
                 <action execute="#{redirect.returnToCapturedView}"/>
             </event>
            
             <mail:mail-session host="localhost" port="2525" username="test" password="test" />
                 
             <!-- For use with jBPM pageflow or process management -->
             <!-- 
             <bpm:jbpm>
                <bpm:process-definitions></bpm:process-definitions>
                <bpm:pageflow-definitions></bpm:pageflow-definitions>
             </bpm:jbpm>
             -->
               
          </components>



          If any ideas please let me know
          • 2. Re: Could not Instantiate seam component
            Daniel Hinojosa Master

            Well you are getting a JNDI exception, that means that the @tokens@ in components.xml...


            <core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>
            



            are not being replaced, or are being replaced but not correctly.


            Take a look at your build.xml file, and there should be something in the war packaging where the following is called


            <filterset>
                <filter token="debug" value="${debug}"/>
                <filter token="jndiPattern" value="${project.name}/#{ejbName}/local"/>
            </filterset>
            



            Make sure that it is indeed being set up right.  If you are using seam-gen's build format, then looking at exploded-archives/PROJECT_NAME.war/META-INF/components.xml should show the correct JNDI location to the local bean for your favorite container.

            • 3. Re: Could not Instantiate seam component
              swathi samala Newbie

              Thank you Daniel. that error is rectified but its not working due to null pointer exception in action class.

              • 4. Re: Could not Instantiate seam component
                nimo stephan Master

                Try to use this:


                @In
                private EntityManager entityManager;




                instead of this:



                 @PersistenceContext
                 private EntityManager em;



                and ensure, that your



                 @In
                 private NewUser newUser;



                newUser-Instance is also declared in your relevant entity Bean with:



                @Name("newUser")
                @Entity
                ...