craigl
Nov 3rd, 2004, 09:20 AM
Hello,
I'm new to acegi and spring so I'm probably doing something stupid. I hope someone reading this can point out what it is. I'm trying to use acegi to protect webservices that are provided with Apache-Axis.
I've tried to follow the examples as close as possible but everytime I deploy my war file I get the following exception:
java.lang.IllegalStateException: Root context attribute is not of type WebApplicationContext: org.springframework.web.context.support.XmlWebAppl icationContext:
displayName=[Root XmlWebApplicationContext]; startup date=[Wed Nov 03 08:10:42 MST 2004]; root of ApplicationContext hierarchy; config locations=[/WEB-INF/classes/securityApplicationContext.xml];
at org.springframework.web.context.support.WebApplica tionContextUtils.getWebApplicationContext(WebAppli cationContextUtils.java:64)
I can tell my web.xml file is being loaded and parsed but for some reason acegi/spring is unhappy with my securityApplicationContext.xml file.
I've attached both my web.xml and my securityApplicationContext.xml. Any help that can be provided would be appreciated.
Craig Lindley
Here is my web.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<display-name>Cassatt Collage Webservices</display-name>
<!-- XML file that defines the root application context -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/securityApplicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>
org.apache.axis.transport.http.AxisServlet
</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>AdminServlet</servlet-name>
<display-name>Axis Admin Servlet</display-name>
<servlet-class>
org.apache.axis.transport.http.AdminServlet
</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>init</param-name>
<param-value>lazy</param-value>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<!-- Loads root application context of this web app at startup -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListe ner</listener-class>
</listener>
</web-app>
here is my securityApplicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- =================== SECURITY SYSTEM DEFINITIONS ================== -->
<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
<property name="providers">
<list><ref bean="CassattAuthenticationProvider"/></list>
</property>
</bean>
<bean id="CassattAuthenticationProvider" class="com.cassatt.blt.security.CassattAuthenticationProv ider"/>
<bean id="authorizationManager" class="net.sf.acegisecurity.vote.AffirmativeBased">
<property name="allowIfAllAbstainDecisions"><value>false</value></property>
<property name="decisionVoters">
<list><ref bean="CassattAuthorizationVoter"/></list>
</property>
</bean>
<bean id="CassattAuthorizationVoter" class="com.cassatt.blt.security.CassattAuthorizationVoter"/>
<!-- ===================== HTTP REQUEST SECURITY ==================== -->
<bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter">
<property name="filterSecurityInterceptor"><ref bean="filterInvocationInterceptor"/></property>
</bean>
<bean id="filterInvocationInterceptor" class="net.sf.acegisecurity.intercept.web.FilterSecurityI nterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref bean="authorizationManager"/></property>
</bean>
</beans>
I'm new to acegi and spring so I'm probably doing something stupid. I hope someone reading this can point out what it is. I'm trying to use acegi to protect webservices that are provided with Apache-Axis.
I've tried to follow the examples as close as possible but everytime I deploy my war file I get the following exception:
java.lang.IllegalStateException: Root context attribute is not of type WebApplicationContext: org.springframework.web.context.support.XmlWebAppl icationContext:
displayName=[Root XmlWebApplicationContext]; startup date=[Wed Nov 03 08:10:42 MST 2004]; root of ApplicationContext hierarchy; config locations=[/WEB-INF/classes/securityApplicationContext.xml];
at org.springframework.web.context.support.WebApplica tionContextUtils.getWebApplicationContext(WebAppli cationContextUtils.java:64)
I can tell my web.xml file is being loaded and parsed but for some reason acegi/spring is unhappy with my securityApplicationContext.xml file.
I've attached both my web.xml and my securityApplicationContext.xml. Any help that can be provided would be appreciated.
Craig Lindley
Here is my web.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<display-name>Cassatt Collage Webservices</display-name>
<!-- XML file that defines the root application context -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/securityApplicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>
org.apache.axis.transport.http.AxisServlet
</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>AdminServlet</servlet-name>
<display-name>Axis Admin Servlet</display-name>
<servlet-class>
org.apache.axis.transport.http.AdminServlet
</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>init</param-name>
<param-value>lazy</param-value>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<!-- Loads root application context of this web app at startup -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListe ner</listener-class>
</listener>
</web-app>
here is my securityApplicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- =================== SECURITY SYSTEM DEFINITIONS ================== -->
<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
<property name="providers">
<list><ref bean="CassattAuthenticationProvider"/></list>
</property>
</bean>
<bean id="CassattAuthenticationProvider" class="com.cassatt.blt.security.CassattAuthenticationProv ider"/>
<bean id="authorizationManager" class="net.sf.acegisecurity.vote.AffirmativeBased">
<property name="allowIfAllAbstainDecisions"><value>false</value></property>
<property name="decisionVoters">
<list><ref bean="CassattAuthorizationVoter"/></list>
</property>
</bean>
<bean id="CassattAuthorizationVoter" class="com.cassatt.blt.security.CassattAuthorizationVoter"/>
<!-- ===================== HTTP REQUEST SECURITY ==================== -->
<bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter">
<property name="filterSecurityInterceptor"><ref bean="filterInvocationInterceptor"/></property>
</bean>
<bean id="filterInvocationInterceptor" class="net.sf.acegisecurity.intercept.web.FilterSecurityI nterceptor">
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
<property name="accessDecisionManager"><ref bean="authorizationManager"/></property>
</bean>
</beans>