私は春のセキュリティを使用したいです。しかし、私はSQLExceptionを取得しています。私はまだ解決策が見つかりませんでした。スプリングセキュリティ - 無効な列インデックス例外
マイテーブル構造:
APP_USER(ID_APP_USER、名、パスワード)
APP_ROLE(ID_ROLE、NAME)
APP_USER_ROLE(ID_USER_ROLE、ID_USER、ID_ROLE)
マイSpring設定ファイル:
<!-- enable use-expressions -->
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/admin**" access="hasRole('ROLE_ADMIN')" />
<!-- access denied page -->
<access-denied-handler error-page="/403" />
<form-login
login-page="/login"
default-target-url="/index"
authentication-failure-url="/login?error"
username-parameter="username"
password-parameter="password" />
<logout logout-success-url="/login?logout" />
<!-- enable csrf protection -->
<csrf/>
</http>
<!-- Select users and user_roles from database -->
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query=
"select name as username,password from app_user where name=?"
authorities-by-username-query=
"SELECT app_user.name as username, app_role.name as role
FROM app_user
INNER JOIN app_user_role ON app_user.id_app_user = app_user_role.id_user
INNER JOIN app_role ON app_user_role.id_role = app_role.id_role
WHERE app_user.name = ? " />
</authentication-provider>
</authentication-manager>
そして、私は次のエラー取得しています:
20:36:55.281 [HTTP-NIO-8089-EXEC-10] DEBUGのosjsSQLErrorCodeSQLExceptionTranslator - SQL状態 '99999' と翻訳のSQLException、エラーをコード '17003'、メッセージ[無効な列インデックス]。 SQLは[[PreparedStatementCallback]]タスクの[name =?]というユーザー名からユーザー名、パスワードを選択しました 20:36:55.282 [http-nio-8089-exec-10] DEBUG osswaUsernamePasswordAuthenticationFilter - 認証要求が失敗しました:org.springframework。 security.authentication.AuthenticationServiceException:PreparedStatementCallback; SQLの無効なResultSetアクセス[ユーザー名として名前を選択、app_userからパスワードはどこの名前=?];ネストされた例外はjava.sql.SQLExceptionです。無効な列インデックス 20:36:55.282 [http-nio-8089-exec-10] DEBUG osswaUsernamePasswordAuthenticationFilter - nullを含むようにSecurityContextHolderを更新しました 20:36:55.282 [http-nio- 8089-exec-10] DEBUG osswaUsernamePasswordAuthenticationFilter - 認証失敗ハンドラへの委託org.springframework.se[email protected]2f483b1e 20:36:55.282 [http-nio-8089-exec-10] DEBUG osswaSimpleUrlAuthenticationFailureHandler - リダイレクト何 '/ FNDWEB /ログインエラー?' へのリダイレクト
- DEBUG ossweb.DefaultRedirectStrategy 55.282 [HTTP-NIO-8089-EXEC-10]:?36:エラー 20ログイン/へ間違っている?助けてください:/事前に感謝します。