Announcement Announcement Module
Collapse
No announcement yet.
ACEGI with JDBC Authentification: Exception sending context initialized Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ACEGI with JDBC Authentification: Exception sending context initialized

    Hi there,

    I'm trying to start with acegi with jdbc authentification.
    When I start tomcat I get:
    Code:
    11.03.2008 19:43:21 org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    11.03.2008 19:43:22 org.apache.catalina.core.StandardContext listenerStart
    SCHWERWIEGEND: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterInvocationInterceptor' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.acegisecurity.intercept.web.FilterInvocationDefinitionSource] for property 'objectDefinitionSource'; nested exception is java.lang.IllegalArgumentException: You are using the CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON with Ant Paths, yet you have specified an uppercase character in line: /secure*=ROLE_ADMIN /**=ROLE_USER (character 'R')
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:445)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at ....
    
    Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.lang.String] to required type [org.acegisecurity.intercept.web.FilterInvocationDefinitionSource] for property 'objectDefinitionSource'; nested exception is java.lang.IllegalArgumentException: You are using the CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON with Ant Paths, yet you have specified an uppercase character in line: /secure*=ROLE_ADMIN /**=ROLE_USER (character 'R')
    	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
    .....
    Caused by: java.lang.IllegalArgumentException: You are using the CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON with Ant Paths, yet you have specified an uppercase character in line: /secure*=ROLE_ADMIN /**=ROLE_USER (character 'R')
    	at ....
    Here is my application-Context.xml

    Thanks in advance
    Richard

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
    
    	<!-- Datasource -->
    	<bean id="dataSource"
    		class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName">
    			<value>org.postgresql.Driver</value>
    		</property>
    		<property name="url">
    			<value>jdbc:postgresql://localhost/shop</value>
    		</property>
    		<property name="username">
    			<value>postgres</value>
    		</property>
    		<property name="password">
    			<value>password</value>
    		</property>
    	</bean>
    
    	<bean id="jdbcDaoImpl"
    		class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
    
    	<bean id="filterChainProxy"
    		class="org.acegisecurity.util.FilterChainProxy">
    		<property name="filterInvocationDefinitionSource">
    			<value>
    				CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
    				PATTERN_TYPE_APACHE_ANT
    				/**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor
    			</value>
    		</property>
    	</bean>
    
    	<bean id="httpSessionContextIntegrationFilter"
    		class="org.acegisecurity.context.HttpSessionContextIntegrationFilter" />
    
    	<bean id="logoutFilter"
    		class="org.acegisecurity.ui.logout.LogoutFilter">
    		<constructor-arg value="/index.jsp" />
    		<constructor-arg>
    			<list>
    				<ref bean="rememberMeServices" />
    				<bean
    					class="org.acegisecurity.ui.logout.SecurityContextLogoutHandler" />
    			</list>
    		</constructor-arg>
    	</bean>
    
    	<bean id="authenticationProcessingFilter"
    		class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
    		<property name="authenticationManager"
    			ref="authenticationManager" />
    		<property name="authenticationFailureUrl"
    			value="/login.jsp?errorId=1" />
    		<property name="defaultTargetUrl" value="/" />
    		<property name="filterProcessesUrl"
    			value="/j_acegi_security_check" />
    		<property name="rememberMeServices" ref="rememberMeServices" />
    	</bean>
    
    	<bean id="securityContextHolderAwareRequestFilter"
    		class="org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter" />
    
    	<bean id="rememberMeProcessingFilter"
    		class="org.acegisecurity.ui.rememberme.RememberMeProcessingFilter">
    		<property name="authenticationManager"
    			ref="authenticationManager" />
    		<property name="rememberMeServices" ref="rememberMeServices" />
    	</bean>
    
    	<bean id="anonymousProcessingFilter"
    		class="org.acegisecurity.providers.anonymous.AnonymousProcessingFilter">
    		<property name="key" value="changeThis" />
    		<property name="userAttribute"
    			value="anonymousUser,ROLE_ANONYMOUS" />
    	</bean>
    
    	<bean id="exceptionTranslationFilter"
    		class="org.acegisecurity.ui.ExceptionTranslationFilter">
    		<property name="authenticationEntryPoint">
    			<bean
    				class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
    				<property name="loginFormUrl" value="/login.jsp" />
    				<property name="forceHttps" value="false" />
    			</bean>
    		</property>
    		<property name="accessDeniedHandler">
    			<bean
    				class="org.acegisecurity.ui.AccessDeniedHandlerImpl">
    				<property name="errorPage" value="/denied.jsp" />
    			</bean>
    		</property>
    	</bean>
    
    	<bean id="filterInvocationInterceptor"
    		class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
    		<property name="authenticationManager"
    			ref="authenticationManager" />
    		<property name="accessDecisionManager">
    			<bean class="org.acegisecurity.vote.AffirmativeBased">
    				<property name="allowIfAllAbstainDecisions"
    					value="false" />
    				<property name="decisionVoters">
    					<list>
    						<bean class="org.acegisecurity.vote.RoleVoter" />
    						<bean
    							class="org.acegisecurity.vote.AuthenticatedVoter" />
    					</list>
    				</property>
    			</bean>
    		</property>
    		<property name="objectDefinitionSource">
    			<value>
    				CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
    				PATTERN_TYPE_APACHE_ANT /secure/admin/**=ROLE_ADMIN
    				/secure/**=IS_AUTHENTICATED_REMEMBERED
    				/**=IS_AUTHENTICATED_ANONYMOUSLY
    			</value>
    		</property>
    	</bean>
    
    	<bean id="rememberMeServices"
    		class="org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices">
    		<property name="userDetailsService" ref="userDetailsService" />
    		<property name="tokenValiditySeconds" value="1800"></property>
    		<property name="key" value="changeThis" />
    	</bean>
    
    	<bean id="authenticationManager"
    		class="org.acegisecurity.providers.ProviderManager">
    		<property name="providers">
    			<list>
    				<ref local="jdbcAuthenticationProvider" />
    				<bean
    					class="org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider">
    					<property name="key" value="changeThis" />
    				</bean>
    				<bean
    					class="org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider">
    					<property name="key" value="changeThis" />
    				</bean>
    			</list>
    		</property>
    	</bean>
    	
    	<bean id="jdbcAuthenticationProvider"
    		class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    		<property name="usersByUsernameQuery">
    			<value>
    				Select login, password FROM users WHERE login=?
    			</value>
    		</property>
    		<property name="authoritiesByUsernameQuery">
    			<value>
    				SELECT login,authority FROM authorities WHERE login = ?
    			</value>
    		</property>
    	</bean>
    
    	<bean id="daoAuthenticationProvider"
    		class="org.acegisecurity.providers.dao.DaoAuthenti cationProvider">
    		<property name="userDetailsService" ref="userDetailsService" />
    		<property name="passwordEncoder">
    			<bean
    				class="org.acegisecurity.providers.encoding.Plaint extPasswordEncoder" />
    		</property>
    		<property name="saltSource">
    			<bean
    				class="org.acegisecurity.providers.dao.salt.Reflec tionSaltSource">
    				<property name="userPropertyToUse" value="userName" />
    			</bean>
    		</property>
    		<property name="userCache">
    			<bean
    				class="org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache">
    				<property name="cache">
    					<bean
    						class="org.springframework.cache.ehcache.EhCacheFactoryBean">
    						<property name="cacheManager">
    							<bean
    								class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" />
    						</property>
    						<property name="cacheName" value="userCache" />
    					</bean>
    				</property>
    			</bean>
    		</property>
    	</bean>
    	
    	<bean id="loggerListener"
    		class="org.acegisecurity.event.authentication.LoggerListener" />
    
    </beans>

  • #2
    Solved:

    PATTERN_TYPE_APACHE_ANT /secure/admin/**=ROLE_ADMIN

    should be
    PATTERN_TYPE_APACHE_ANT
    /secure/admin/**=ROLE_ADMIN

    :-)

    Comment


    • #3
      It looks like you need a new line between PATTERN_TYPE_APPACHE_ANT and /secure/admin... here:

      Code:
      PATTERN_TYPE_APACHE_ANT /secure/admin/**=ROLE_ADMIN
      Not sure if that's all it will take, but it's a start...

      EDIT: I see you figured it out while I was posting. Glad that's all it was.

      Comment

      Working...
      X