Witam
Piszę aplikację z wykorzystaniem JPA + JSF w środowisku Netbeans. Chcialem zabezpieczyć dostęp do częsci programu za pomocą loginu i hasła. Po przeczytaniu kilku postów na forum wybrałem do tego Spring security. Wzorując się na poniższym tutorialu http://crooveck.blogspot.com/2012/07/spring-security-31-w-akcji.html zabrałem się do pracy. No i gdy po zaimplementowaniu i kliknięciu w przycisk "Run" ukazał mi się taki oto błąd:
FAIL - Deployed application at context path /RaportJEE but context failed to start
C:\Users\Tomek\Documents\NetBeansProjects\RaportJEE\nbproject\build-impl.xml:1183: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 51 seconds)
Spojrzałem co na to logi Tomcata a tam taka oto wiadomość:
INFO: Closing Spring root WebApplicationContext
wrz 11, 2012 5:54:28 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
Poniżej zamieszczam listing pliku web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
>
<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>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-security.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<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>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
Oraz pliku application-security.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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.2.xsd">
<http auto-config="true">
<intercept-url pattern="/solarium.xhtml" access="ROLE_USER"/>
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="admin" password="admin" authorities="ROLE_ADMIN"/>
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
Po usunięciu z pliku web.xml listenera oraz filtrów wszystko działa ok (oczywiście poza uwierzytelnianiem). Może ktoś mnie naprowadzić co robię nie tak??
Bardzo prosze o pomoc siedze na tym caly czas i nie moge znalezdzc rozwiazania;(