Announcement Announcement Module
Collapse
No announcement yet.
SQLException with Error code '17059' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQLException with Error code '17059'

    Hi,

    I'm new with SpringSecurity, but I found some strange behavior...

    My applicationContext.xml has something like this:

    Code:
        <s:http auto-config="true" use-expressions="true">
            <s:intercept-url pattern="/test.jsf" access="hasRole('ROLE_USER')"/>
            <s:form-login login-page="/login.jsf" authentication-failure-url="/login.jsf?erro=true" />
        </s:http>
        
        <s:authentication-manager>
            <s:authentication-provider>
                <s:jdbc-user-service data-source-ref="dataSource"
                   users-by-username-query="SELECT cd_user as username, ds_pass as password, 'true' as enable FROM dbacp.users WHERE cd_user=?"
                   authorities-by-username-query="SELECT cd_user as username, 'ROLE_USER' as authority FROM dbacp.users WHERE cd_user=?"
                />
            </s:authentication-provider>
        </s:authentication-manager>
    
    	<bean id="dataSource"
    		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url" value="${${s.mode}.datasource.url}" />
    		<property name="username" value="${${s.mode}.datasource.user}" />
    		<property name="password" value="${${s.mode}.datasource.pass}" />
    	</bean>

    When I try to access test.jsf, it sends me to login.jsf... Ok so far...

    When I fill login form with a username that doesn't exists, it work as it shoulds:

    Code:
    2012-02-08 16:22:41 [DEBUG] (JdbcUserDetailsManager) Query returned no results for user 'ghost'
    2012-02-08 16:22:41 [DEBUG] (DaoAuthenticationProvider) User 'ghost' not found
    But, when I fill with a valid username it returns this error:

    Code:
    2012-02-08 16:23:46 [DEBUG] (SQLErrorCodeSQLExceptionTranslator) Unable to translate SQLException with Error code '17059', will now try the fallback translator
    2012-02-08 16:23:46 [DEBUG] (UsernamePasswordAuthenticationFilter) Authentication request failed: org.springframework.security.authentication.AuthenticationServiceException: PreparedStatementCallback; uncategorized SQLException for SQL [SELECT cd_user as username, ds_pass as password, 'true' as enable FROM dbacp.users WHERE cd_user=?]; SQL state [null]; error code [17059]; Fail to convert to internal representation; nested exception is java.sql.SQLException: Fail to convert to internal representation
    2012-02-08 16:23:46 [DEBUG] (UsernamePasswordAuthenticationFilter) Updated SecurityContextHolder to contain null Authentication
    2012-02-08 16:23:46 [DEBUG] (UsernamePasswordAuthenticationFilter) Delegating to authentication failure handlerorg.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler@188e490


    Some advice?

    thanks...

  • #2
    Never mind

    I replaced 'true' as enable with 1 as enabled, and it works..

    Comment

    Working...
    X