[jboss-user] [JBoss Seam] - Seam Problem!!! URGENT, please
argomauro
do-not-reply at jboss.com
Mon Oct 23 05:54:21 EDT 2006
I've create a new seam application that insert in a MysqlDb an Object named "utente" and another named "profilo". I've create a Steteful java class that insert this objects and it's work fine.
Subsequently i've create a page for implement the Login functionality with another Stateful java class and only in this case the application return an error:
Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: managerLogin
| at org.jboss.seam.Component.newInstance(Component.java:735)
| at org.jboss.seam.Component.newInstance(Component.java:1308)
| at org.jboss.seam.Component.getInstance(Component.java:1263)
| at org.jboss.seam.Component.getInstance(Component.java:1246)
| at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:44)
| at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:569)
| at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
| at org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:450)
| at org.apache.myfaces.el.MethodBindingImpl.resolveToBaseAndProperty(MethodBindingImpl.java:180)
| at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:114)
| ... 25 more
| Caused by: javax.naming.NameNotFoundException: ManagerLogin 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.server.NamingServer.lookup(NamingServer.java:270)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jboss.seam.Component.instantiate(Component.java:774)
| at org.jboss.seam.Component.newInstance(Component.java:731)
|
My Stateful class is:
| @Stateful
| @Name("managerLogin")
| @Scope(ScopeType.SESSION)
| public class ManagerLogin implements Serializable {
|
| @In(create=true)
| private EntityManager em;
|
| @In(value = "login")
| private EntityLogin login = new EntityLogin();
|
| @In(value = "utente")
| @Out
| private EntityUtente utente;
|
| @Logger
| private Log log;
|
| public String login() {
| List results = em.createQuery(
| "from utente where username=:username and password=:password")
| .setParameter("username", login.getUsername())
| .setParameter("password", login.getPassword())
| .getResultList();
| if (results.size() == 0) {
| FacesMessages.instance().addFromResourceBundle("LoginNonValido");
| return null;
| } else {
| Contexts.getSessionContext().set("loggedIn", true);
| utente = (EntityUtente) results.get(0);
|
| return "home" ;
| }
| }
|
| public String logout() {
| Contexts.getSessionContext().remove("loggedIn");
| Seam.invalidateSession();
| return "home";
| }
|
| @Remove
| @Destroy
| public void destroy() {
| }
| }
|
My jsp page is:
| <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
| <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
| <html>
| <head>
| <title><h:outputText value="#{messages.Login}" /></title>
|
| </head>
| <body>
| <f:view>
| <h:form>
|
| <h1><h:outputText value="#{messages.Login}" /></h1>
|
|
| <h:outputText value="#{messages.LoginDetails}" />
|
| <table>
| <tr>
| <td><h:inputText value="#{login.username}" id="username" /></td>
| </tr>
| <tr>
| <td><h:inputText value="#{login.password}" id="password" /></td>
| </tr>
|
| <h:commandButton type="submit" value="#{messages.Login}"
| action="#{managerLogin.login}" />
| <h:commandButton type="submit" value="#{messages.Register}"
| action="insertUtente" />
| </h:form>
|
| </f:view>
| </body>
|
| </html>
|
And the login bean is an object but not persistent that contains the user data entry for login:
| @Name("login")
| public class EntityLogin implements Serializable {
|
| private static final long serialVersionUID = 188141350071143953L;
|
| public EntityLogin(String password, String username) {
| this.username = username;
| this.password = password;
| }
|
| public EntityLogin() {
| }
|
| private String username;
|
| private String password;
|
| @NotNull
| @Length(max = 10)
| public String getUsername() {
| return this.username;
| }
|
| public void setUsername(String username) {
| this.username = username;
| }
|
| @Length(max = 15)
| @NotNull
| public String getPassword() {
| return this.password;
| }
|
| public void setPassword(String password) {
| this.password = password;
| }
|
| }
|
The login bean is the new entry in this code but precedently i've create an instance of the user in the ManagerLogin class but i was a different error,anonymous wrote : componet not find ...
An example of the Stateful that work fine:
| @Entity
| @Name("utente")
| @Scope(SESSION)
| @Table(name="utente")
| public class EntityUtente implements Serializable {
|
|
| private static final long serialVersionUID = 188141350071143952L;
|
| public EntityUtente(Integer id, String nome, String cognome,String email,String password,String username)
| {
| this.id = id;
| this.nome = nome;
| this.cognome = cognome;
| this.email = email;
| this.username = username;
| this.password = password;
| }
|
| public EntityUtente(){}
|
| private Integer id;
| private String username;
| private String nome;
| private String cognome;
| private String password;
| private String email;
|
| public void setId(Integer id) {
| this.id = id;
| }
|
| @Id @GeneratedValue
| public Integer getId() {
| return id;
| }
|
| @NotNull
| @Length(max=10)
| public String getUsername() {
| return this.username;
| }
|
| public void setUsername(String username) {
| this.username = username;
| }
|
| public void setNome(String nome) {
| this.nome = nome;
| }
|
| @Length(max=100) @NotNull
| public String getNome() {
| return nome;
| }
|
| public void setCognome(String cognome) {
| this.cognome = cognome;
| }
| @Length(max=100) @NotNull
| public String getCognome() {
| return cognome;
| }
|
|
| @Length(max=15) @NotNull
| public String getPassword() {
| return this.password;
| }
|
| public void setPassword(String password) {
| this.password = password;
| }
|
| public void setEmail(String email) {
| this.email = email;
| }
| @Email
| public String getEmail() {
| return email;
| }
|
| }
|
|
For me it is a incomprensibile error, because others two similar cases work (ManagerUtente,ManagerProfilo)and the login action not.
Thanks for help....
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979977#3979977
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979977
More information about the jboss-user
mailing list