Java SpringBean工厂无法看到类
我正在开发一个使用JSF(Mojarra)来控制de MVC流的应用程序,但我还想将Spring安全性集成到其自动识别和授权过程中 然而,我遇到了一个问题,SpringbeanFactory无法实例化我构建的用于自定义登录等的类。从那以后,这个系统甚至都不会上线 stacktrace以以下内容开始:Java SpringBean工厂无法看到类,java,jsf,spring-security,weld,Java,Jsf,Spring Security,Weld,我正在开发一个使用JSF(Mojarra)来控制de MVC流的应用程序,但我还想将Spring安全性集成到其自动识别和授权过程中 然而,我遇到了一个问题,SpringbeanFactory无法实例化我构建的用于自定义登录等的类。从那以后,这个系统甚至都不会上线 stacktrace以以下内容开始: java.lang.ClassNotFoundException: com.tfduque.fieldAssist.manager.LoginBean 然后 org.springframework
java.lang.ClassNotFoundException: com.tfduque.fieldAssist.manager.LoginBean
然后
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.tfduque.fieldAssist.manager.LoginBean] for bean with name 'authenticationEntryPoint' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: com.tfduque.fieldAssist.manager.LoginBean
等等
()
这就是我的文件夹的组织方式(如果有必要):
我的应用程序上下文(用于spring安全配置):
我认为这些都是理解问题所需要的。请在线发布stacktrace。我觉得里面有很多相关的信息。请分析它是的,它指出BeanFactory找不到类。它似乎在试图指出一个可能不存在的目录。我不知道为什么。对我来说,fodler结构还可以……试着使用实现此功能的其他类:不要对其进行注释。在spring中,您可以对bean声明使用xml或注释,但不要对同一个bean混合使用它们。登录bean没有标记为服务,只是一个命名资源,用于从xhtml页面进行访问并由控制器进行解析。如果不是通过spring安全性的东西,它会起作用。您告诉spring使用
LoginBean
类作为身份验证入口点来创建服务bean。除此之外,还可以使用JSF注释将此类用作托管bean(@Named
)。两件事都使用一个类有意义吗?
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.1.xsd">
<http pattern="/login*" security="none" />
<http pattern="/css/**" security="none" />
<http pattern="/images/**" security="none" />
<http pattern="/javascript/**" security="none" />
<http pattern="/Secured/**" create-session="stateless"
use-expressions="true">
<intercept-url pattern="/**" access="isFullyAuthenticated()" />
<http-basic />
</http>
<http auto-config="true" use-expressions="true"
access-decision-manager-ref="accessDecisionManager">
<intercept-url pattern="/**" access="isFullyAuthenticated()" />
<form-login login-page="/login.xhtml" login-processing-url="/j_login"
authentication-failure-url="/login.xhtml" always-use-default-target="false"
default-target-url="/" />
<logout invalidate-session="true" logout-success-url="/login.xhtml"
logout-url="/j_logout" delete-cookies="JSESSIONID" />
</http>
<authentication-manager>
<authentication-provider user-service-ref="authenticationEntryPoint">
<password-encoder hash="md5" />
</authentication-provider>
</authentication-manager>
<beans:bean id="appUserDetailsService"
class="com.tfduque.fieldAssist.security.AppUserDetailsService" />
<beans:bean id="authenticationEntryPoint"
class=" com.tfduque.fieldAssist.manager.LoginBean">
<beans:property name="loginFormUrl" value="/Login.xhtml" />
<beans:property name="redirectStrategy" ref="jsfRedirectStrategy" />
</beans:bean>
</beans:beans>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<!-- Listeners -->
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<resource-env-ref>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>
<!-- Security -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
@Named("login")
@RequestScoped
public class LoginBean {
public String doLogin() throws IOException, ServletException {
[...]
}