I am trying to set up a seam project that uses EJB3 annotations on the entities , JSF for the views, and Hibernate as the persistence manager (Hibernate Sessions).
I am able to compile and deploy without errors; I am even able to invoke pages in my app without exceptions. However, it does not seem that Seam is doing what I expect (possibly I have misconfigured something). What I am trying to do is create the skeleton of a simple login process. I have provided here, the User entity, and the SimpleLogin POJO I created to perform the login process: @Entity | @Table(name="user", | uniqueConstraints = [EMAIL PROTECTED](columnNames={"a_number"})} | ) | @EntityListeners(BaseEntity.class) | @Name("user") | @Scope(ScopeType.SESSION) | public class User extends BaseEntity implements Serializable { | | private final Log log = LogFactory.getLog(User.class); | | private static final long serialVersionUID = -795127549881852884L; | | private String aNumber; | private Set<Link> links; | | public User() { log.info("new User()"); } | | @Column(name = "a_number",unique = true,insertable=true,nullable=false,updatable=false,length=12) | public String getaNumber() { return aNumber; } | public void setaNumber(String aNumber) { this.aNumber = aNumber; log.info("User.setaNumber("+aNumber+")"); } | | @OneToMany(cascade= CascadeType.ALL, mappedBy="user", fetch = FetchType.EAGER) | public Set<Link> getLinks() { return links; } | public void setLinks(Set<Link> links) { this.links = links; } | | } | and here is the SimpleLogin POJO: @Name(value = "simpleLogin") | @Scope(ScopeType.EVENT) | public class SimpleLogin { | | @In(required = true) @Out | private User user; | | @In(create=true) | private Session appssoDB; | | @In(create=true) | private FacesMessages facesMessages; | | public String login() { | final User u = (User)appssoDB.createQuery("from User where aNumber=:aNumber") | .setParameter("aNumber",user.getaNumber()) | .uniqueResult(); | if (user == null) { | facesMessages.add("Invalid A Number"); | return "login"; | } else { | return "loggedIn"; | } | } | } | now here is a page that I borrowed from one of the Seam examples and adapted to use these beans: <h:form> | <div id="document"> | <div id="container"> | <div id="sidebar"> | <fieldset> | <div> | <h:outputLabel for="username">Login Name</h:outputLabel> | <h:inputText id="username" value="#{user.aNumber}" style="width: 175px;" /> | </div> | <div class="errors"><h:messages globalOnly="true"/></div> | <div class="buttonBox"><h:commandButton action="#{simpleLogin.login}" value="Account Login" class="button" /></div> | <div class="notes"><h:commandLink action="register">Register User</h:commandLink> | Ask for Help</div> | </fieldset> | </div> | <div id="footer">Created with JBoss Seam, Facelets, and JSF 1.1.01 Ref. Impl.</div> | </div> | </div> | </h:form> | <ui:debug hotkey="D"/> | #{conversation.id} | When I deploy the app, I get the following (relevant snippets?) in the server console: | 11:19:32,743 INFO [ServletContextListener] Welcome to Seam 1.0 rc1 | 11:19:32,758 INFO [Initialization] initializing Seam | ... | ... | ... | 11:19:35,868 INFO [User] new User() | 11:19:35,915 INFO [User] new User() | 11:19:35,915 INFO [User] User.setaNumber(null) | 11:19:36,040 INFO [SessionFactoryObjectFactory] Factory name: java:/appssoSessionFactory | 11:19:36,040 INFO [NamingHelper] JNDI InitialContext properties:{} | 11:19:36,055 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: java:/appssoSessionFactory | ... | ... | There are no exceptions in the deployment and it appears from the lines above that Seam is started and hibernate is aware of my User class. So I invoke my main.seam page.. everthing displays 'just fine' no exceptions - I get conversation.id = 1, which I take to mean that seam is participating in the request processing successfully. Here is the server.log contents that I see when I invoke main.seam | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.lifecycle.LifecycleImpl] execute([EMAIL PROTECTED]) | 2006-04-24 11:31:30,167 DEBUG [org.jboss.seam.contexts.Lifecycle] >>> Begin web request | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.lifecycle.RestoreViewPhase] Entering RestoreViewPhase | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.application.ViewHandlerImpl] URL pattern of the FacesServlet executing the current request .jsf | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.application.ViewHandlerImpl] viewId after appending the context suffix /main.xhtml | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.application.StateManagerImpl] Begin restoring view in session for viewId /main.xhtml | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.application.StateManagerImpl] Restoring view from session for viewId /main.xhtml | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.application.StateManagerImpl] End restoring view in session for viewId /main.xhtml | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.lifecycle.RestoreViewPhase] New request: creating a view for /main.jsf | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.application.ViewHandlerImpl] Created new view for /main.jsf | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.application.ViewHandlerImpl] Locale for this view as determined by calculateLocale en | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.application.ViewHandlerImpl] RenderKitId for this view as determined by calculateRenderKitId HTML_BASIC | 2006-04-24 11:31:30,167 DEBUG [com.sun.faces.lifecycle.RestoreViewPhase] Exiting RestoreViewPhase | 2006-04-24 11:31:30,167 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.manager | 2006-04-24 11:31:30,183 DEBUG [org.jboss.seam.core.Manager] No stored conversation | 2006-04-24 11:31:30,183 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.init | 2006-04-24 11:31:30,183 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] After restore view, conversation context: ConversationContext(3) | 2006-04-24 11:31:30,183 DEBUG [com.sun.faces.lifecycle.LifecycleImpl] Skipping rest of execute() because of a reload | 2006-04-24 11:31:30,183 DEBUG [com.sun.faces.lifecycle.LifecycleImpl] render([EMAIL PROTECTED]) | 2006-04-24 11:31:30,183 DEBUG [org.jboss.seam.Component] instantiating Seam component: facesMessages | 2006-04-24 11:31:30,183 DEBUG [com.sun.faces.lifecycle.RenderResponsePhase] Entering RenderResponsePhase | 2006-04-24 11:31:30,183 DEBUG [com.sun.faces.lifecycle.RenderResponsePhase] About to render view /main.jsf | 2006-04-24 11:31:30,183 DEBUG [com.sun.faces.application.ViewHandlerImpl] URL pattern of the FacesServlet executing the current request .jsf | 2006-04-24 11:31:30,183 DEBUG [com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer] component.getValue() returned null | 2006-04-24 11:31:30,183 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: user | 2006-04-24 11:31:30,183 DEBUG [org.jboss.seam.Component] seam component not found: user | 2006-04-24 11:31:30,183 DEBUG [com.sun.faces.application.ApplicationImpl] Couldn't find a factory for user | 2006-04-24 11:31:30,183 DEBUG [com.sun.faces.el.VariableResolverImpl] resolveVariable: Resolved variable:null | 2006-04-24 11:31:30,183 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name | 2006-04-24 11:31:30,183 DEBUG [com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer] component.getValue() returned null | 2006-04-24 11:31:30,199 DEBUG [com.sun.faces.application.ViewHandlerImpl] URL pattern of the FacesServlet executing the current request .jsf | 2006-04-24 11:31:30,199 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: user | 2006-04-24 11:31:30,199 DEBUG [org.jboss.seam.Component] seam component not found: user | 2006-04-24 11:31:30,199 DEBUG [com.sun.faces.application.ApplicationImpl] Couldn't find a factory for user | 2006-04-24 11:31:30,199 DEBUG [com.sun.faces.el.VariableResolverImpl] resolveVariable: Resolved variable:null | 2006-04-24 11:31:30,199 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: conversation | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.Component] instantiating Seam component: conversation | 2006-04-24 11:31:30,214 DEBUG [com.sun.faces.application.ApplicationImpl] Couldn't find a factory for conversation | 2006-04-24 11:31:30,214 DEBUG [com.sun.faces.el.VariableResolverImpl] resolveVariable: Resolved variable:null | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam component | 2006-04-24 11:31:30,214 DEBUG [com.sun.faces.lifecycle.RenderResponsePhase] Exiting RenderResponsePhase | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.contexts.Lifecycle] After render response, destroying contexts | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying event context | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.contexts.Contexts] destroying: org.jboss.seam.core.manager | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying conversation context | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.contexts.Contexts] destroying: facesMessages | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.contexts.Contexts] destroying: conversation | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing server-side conversation context | 2006-04-24 11:31:30,214 DEBUG [org.jboss.seam.contexts.Lifecycle] <<< End web request | Then, I type in a value for the user.aNumber field and click my 'Account Login' button - here is the server log: | 2006-04-24 11:34:32,938 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000 | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.lifecycle.LifecycleImpl] execute([EMAIL PROTECTED]) | 2006-04-24 11:34:37,110 DEBUG [org.jboss.seam.contexts.Lifecycle] >>> Begin web request | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.lifecycle.RestoreViewPhase] Entering RestoreViewPhase | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.application.ViewHandlerImpl] URL pattern of the FacesServlet executing the current request .jsf | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.application.ViewHandlerImpl] viewId after appending the context suffix /main.xhtml | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.application.StateManagerImpl] Begin restoring view in session for viewId /main.xhtml | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.application.StateManagerImpl] Restoring view from session for viewId /main.xhtml | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.application.StateManagerImpl] End restoring view in session for viewId /main.xhtml | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.lifecycle.RestoreViewPhase] New request: creating a view for /main.jsf | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.application.ViewHandlerImpl] Created new view for /main.jsf | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.application.ViewHandlerImpl] Locale for this view as determined by calculateLocale en | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.application.ViewHandlerImpl] RenderKitId for this view as determined by calculateRenderKitId HTML_BASIC | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.lifecycle.RestoreViewPhase] Exiting RestoreViewPhase | 2006-04-24 11:34:37,110 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.manager | 2006-04-24 11:34:37,110 DEBUG [org.jboss.seam.core.Manager] No stored conversation | 2006-04-24 11:34:37,110 DEBUG [org.jboss.seam.contexts.Contexts] found in application context: org.jboss.seam.core.init | 2006-04-24 11:34:37,110 DEBUG [org.jboss.seam.jsf.SeamPhaseListener] After restore view, conversation context: ConversationContext(4) | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.lifecycle.LifecycleImpl] render([EMAIL PROTECTED]) | 2006-04-24 11:34:37,110 DEBUG [org.jboss.seam.Component] instantiating Seam component: facesMessages | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.lifecycle.RenderResponsePhase] Entering RenderResponsePhase | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.lifecycle.RenderResponsePhase] About to render view /main.jsf | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.application.ViewHandlerImpl] URL pattern of the FacesServlet executing the current request .jsf | 2006-04-24 11:34:37,110 DEBUG [com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer] component.getValue() returned null | 2006-04-24 11:34:37,110 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: user | 2006-04-24 11:34:37,110 DEBUG [org.jboss.seam.Component] seam component not found: user | 2006-04-24 11:34:37,125 DEBUG [com.sun.faces.application.ApplicationImpl] Couldn't find a factory for user | 2006-04-24 11:34:37,125 DEBUG [com.sun.faces.el.VariableResolverImpl] resolveVariable: Resolved variable:null | 2006-04-24 11:34:37,125 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name | 2006-04-24 11:34:37,125 DEBUG [com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer] component.getValue() returned null | 2006-04-24 11:34:37,125 DEBUG [com.sun.faces.application.ViewHandlerImpl] URL pattern of the FacesServlet executing the current request .jsf | 2006-04-24 11:34:37,125 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: user | 2006-04-24 11:34:37,125 DEBUG [org.jboss.seam.Component] seam component not found: user | 2006-04-24 11:34:37,125 DEBUG [com.sun.faces.application.ApplicationImpl] Couldn't find a factory for user | 2006-04-24 11:34:37,125 DEBUG [com.sun.faces.el.VariableResolverImpl] resolveVariable: Resolved variable:null | 2006-04-24 11:34:37,125 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] could not resolve name | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: conversation | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.Component] instantiating Seam component: conversation | 2006-04-24 11:34:37,141 DEBUG [com.sun.faces.application.ApplicationImpl] Couldn't find a factory for conversation | 2006-04-24 11:34:37,141 DEBUG [com.sun.faces.el.VariableResolverImpl] resolveVariable: Resolved variable:null | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to seam component | 2006-04-24 11:34:37,141 DEBUG [com.sun.faces.lifecycle.RenderResponsePhase] Exiting RenderResponsePhase | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.contexts.Lifecycle] After render response, destroying contexts | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying event context | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.contexts.Contexts] destroying: org.jboss.seam.core.manager | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying conversation context | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.contexts.Contexts] destroying: facesMessages | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.contexts.Contexts] destroying: conversation | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing server-side conversation context | 2006-04-24 11:34:37,141 DEBUG [org.jboss.seam.contexts.Lifecycle] <<< End web request | When I look at the server console for both requests - I see no indication that a new User class has been created and that it's setaNumber() method has been invoked. I studied the example code and the seam documentation carefully w.r.t. setting up a Seam application for Hibernate in a Java EE environment - nothing stands out. I am using JBoss 4.0.4.CR2 with EJB installed. Any help in understanding why my named components are not being 'associated' with the page is appreciated. Thanks. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3938968#3938968 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3938968 ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user