###前提・実現したいこと
Javaのサーブレット、JSPを使用して作成したウェブサイトにBasic認証を設定したいです。
Basic認証ではJDBCレルムを使用してユーザー管理を行いたいです。
開発環境はeclipseとtomcat8、DBはderbyを使用しております。
tomcatのserver.xmlにはJDBCRealm用のものを記載しておりますが、
サーバーを起動する際にエラーが発生しており、
サーバーは起動しますが、認証を行う際に例外が発生しております。
お分かりの方はお助けいただけると幸いです。
###発生している問題・エラーメッセージ
//サーバー起動時 重大: データベース接続オープン中に例外が発生しました //認証入力時 重大: 認証実行中の例外です 重大: 認証実行中の例外です
###server.xml該当箇所ソースコード
<!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack --> <Realm className="org.apache.catalina.realm.LockOutRealm"> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <!-- <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> --> <Realm className="org.apache.catalina.realm.JDBCRealm" driverName="org.apache.derby.jdbc.ClientDriver" connectionURL="jdbc:derby://localhost:/sampleDB" userTable="accounttable" userNameCol="user_name" userCredCol="user_pass" userRoleTable="roletable" roleNameCol="role" /> </Realm>
###web.xml記載内容
<security-constraint> <web-resource-collection> <web-resource-name>User Basic Auth</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>sample</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>User Basic Auth</realm-name> </login-config> <security-role> <role-name>sample</role-name> </security-role> </web-app>
###試したこと
derbyでは使えないのかと思い、MySQLでも試してみましたが、同様のエラーが発生してしまいました。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/06/29 02:55
2017/06/29 11:34