Jimmy Añazco created SEAM-143:
---------------------------------
Summary: javax.servlet.ServletException: WELD-000052 Cannot return null from
a non-dependent producer method: [method] @Produces @LoggendIn @RequestScoped @Named
public edu.unl.sbe.securiy.Account.getLogger
Key: SEAM-143
URL:
https://issues.jboss.org/browse/SEAM-143
Project: Seam 3 Distribution
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Environment: Seam 3, Jboss 7.2
Reporter: Jimmy Añazco
My application has this problem when multiple users use the application multiple times on
the intranet but locally localhost bone runs without any problem on my machine some ideas
please?
Please any idea about. Here the code
package edu.unl.sbe.security;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.TransactionAttribute;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import edu.unl.sbe.cdi.LoggedIn;
import edu.unl.sbe.cdi.Web;
import edu.unl.sbe.model.profile.Profile;
import edu.unl.sbe.profile.ProfileService;
import edu.unl.sbe.security.authorization.SecurityRules;
import org.jboss.seam.security.Identity;
/**
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter,
III</a>
* @adapter <a href="mailto:jimmy.anazco@gmail.com">Jimmy Alexander
Añazco</a>
*
*/
@Named("account")
@RequestScoped
public class Account implements Serializable
{
private static final long serialVersionUID = 8474539305281711165L;
@Inject
@Web
private EntityManager em;
@Inject
private Identity identity;
@Inject
private ProfileService ps;
@PostConstruct
public void init()
{
ps.setEntityManager(em);
}
Profile loggedIn = new Profile();
@Produces
@LoggedIn
@RequestScoped
@Named("userProfile")
public Profile getLoggedIn()
{
if (identity.isLoggedIn() && !loggedIn.isPersistent())
{
try {
loggedIn = ps.getProfileByIdentityKey(identity.getUser().getKey());
}
catch (NoResultException e) {
throw e;
}
}
else if (!identity.isLoggedIn())
{}
return loggedIn;
}
@TransactionAttribute
public void saveAjax()
{
Profile current = getLoggedIn();
ps.save(current);
}
@TransactionAttribute
public void displayBootcampAjax()
{
Profile current = getLoggedIn();
current.setShowBootcamp(true);
ps.save(current);
}
@TransactionAttribute
public void dismissBootcampAjax()
{
Profile current = getLoggedIn();
current.setShowBootcamp(false);
ps.save(current);
}
public void setEntityManager(final EntityManager em)
{
this.em = em;
ps.setEntityManager(em);
}
public String accesoSistema(Identity role){
SecurityRules security=new SecurityRules();
if(security.isAdmin(identity)){
return "Admin";
}
else if(security.isBecas(identity)){
return "Becas";
}
else if(security.isPsicopedagogico(identity)){
return "Psicopedagogico";
}
else if (security.isDirector(identity)){
return "Director";
}
return "Estudiante";
}
public boolean accesoSistemaSBE(final String grupoIden) {
SecurityRules s = new SecurityRules();
if (SecurityRules.ADMIN.equals(grupoIden)) {
return s.isAdmin(identity);
} else if (SecurityRules.BECAS.equals(grupoIden)) {
return s.isBecas(identity);
} else if (SecurityRules.PSICOPEDAGOGICO.equals(grupoIden)) {
return s.isPsicopedagogico(identity);
} else if (SecurityRules.DIRECTOR.equals(grupoIden)) {
return s.isDirector(identity);
}
return false;
}
public String loadPages() {
if (identity.isLoggedIn()) {
return null;
}
return "/pages/login.xhtml";
}
//Metodo Agregado para cambio de contraseña
public Long getLoggedId() {
Long id = new Long(0);
if (identity.isLoggedIn()) {
try {
loggedIn = ps.getProfileByIdentityKey(identity.getUser().getKey());
if (loggedIn != null) {
id = loggedIn.getId();
return id;
}
} catch (NoResultException e) {
throw e;
}
} else if (!identity.isLoggedIn()) {
}
return id;
}
}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)