Pessoal, estou tentando utilizar EJB para realizar acessar o BD para pegar as roles do Spring Security
Segue o erro que estou tendo
Deployment Error for module: bpp: Erro durante a implantação: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginDetailsService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [br.com.gd.bpp.facade.LoginFacade] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.ejb.EJB(beanName=, mappedName=, beanInterface=class java.lang.Object, description=, name=, lookup=)}
Segue as classes:
[code]
@Service
public class LoginDetailsService implements UserDetailsService {
private static Logger logger;
static {
try {
logger = Logger.getLogger( LoginDetailsService.class );
} catch (Exception e) {
e.printStackTrace( System.err );
}
}
@EJB
private LoginFacade loginFacade;
@Override
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException, DataAccessException {
logger.info("-----------------------------------------------------------------------------------");
LoginVO loginVO = new LoginVO();
loginVO.setEmail(email);
loginVO.setSenha(request().getParameter("j_password").toCharArray());
loginVO.setIp(request().getRemoteAddr());
loginVO.setDataCriacao(new Date());
loginVO.setSessaoAtual(request().getRequestedSessionId());
logger.info(" Requisicao para logar: " + loginVO.getEmail() + " IP: "+ loginVO.getIp());
Usuario u = null;
try{
u = loginFacade.logarUser(loginVO);
}catch (EJBException e) {
logger.error(" Causa: "+e.getCause().getMessage());
logger.info("-----------------------------------------------------------------------------------");
throw new EmptyResultDataAccessException( e.getCause().getMessage(),1);
}
sessao().setAttribute("usuarioLogado", u);
logger.info("-----------------------------------------------------------------------------------");
return u.getUser();
}
private static HttpSession sessao(){
return request().getSession(true);
}
private static HttpServletRequest request(){
ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
return attr.getRequest();
}
}[/code]
[code]
@Stateless
public class LoginFacade extends AbstractFacade {
@PersistenceContext(unitName = “com.br.bpp”)
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public LoginFacade() {
super(LoginFacade.class);
}
public Usuario logarUser(LoginVO loginVO) {
System.out.println("lretornou lll");
return null;
}
}[/code]
E o ApplicationContext-security.xml
[code]
<?xml version="1.0" encoding="UTF-8"?><b:beans xmlns=“http://www.springframework.org/schema/security”
xmlns:b=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xmlns:context=“http://www.springframework.org/schema/context”
xmlns:util=“http://www.springframework.org/schema/util”
xsi:schemaLocation=“http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd”>
<!-- habilita a configuração por annotations -->
<context:annotation-config />
<!-- define os pacotes/subpacotes que onde serão procurados beans do spring -->
<context:component-scan base-package="br.com.gd.*" />
<global-method-security secured-annotations="enabled" />
<http>
<form-login
login-page="/login.jsf"
always-use-default-target="true"
authentication-success-handler-ref="myAuthenticationSuccessHandler"
authentication-failure-handler-ref="myExceptionMappingAuthenticationFailureHandler" />
<logout invalidate-session="true" success-handler-ref="myLogoutSuccessHandler" />
<session-management session-fixation-protection="none">
<concurrency-control error-if-maximum-exceeded ="false" max-sessions="1"/>
</session-management>
<intercept-url pattern="/**" requires-channel="https"/>
<port-mappings>
<port-mapping http="80" https="443"/>
</port-mappings>
<remember-me />
<access-denied-handler ref="myAccessDeniedHandlerImpl" />
<custom-filter before="FILTER_SECURITY_INTERCEPTOR" ref="filterSecurityInterceptor" />
</http>
<b:bean id="filterSecurityInterceptor" class="br.com.gd.bpp.security.MyFilterSecurityInterceptor">
<b:property name="authenticationManager" ref="authenticationManager"/>
<b:property name="accessDecisionManager" ref="accessDecisionManager"/>
<b:property name="securityMetadataSource" ref="securityMetadataSource" />
<b:property name="validateConfigAttributes" value="true" />
</b:bean>
<authentication-manager alias="authenticationManager" >
<authentication-provider user-service-ref="loginDetailsService">
<password-encoder hash="md5"/>
</authentication-provider>
</authentication-manager>
<b:bean id="securityMetadataSource" class="br.com.gd.bpp.security.MySecureResourceFilter" />
<b:bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
<b:property name="decisionVoters">
<b:list>
<b:bean class="org.springframework.security.access.vote.RoleVoter" />
<b:bean class="org.springframework.security.access.vote.AuthenticatedVoter" />
</b:list>
</b:property>
</b:bean>
</b:beans>[/code]
Alguém poderia ajudar, por favor