Я весь день пытался настроить область jdbc для своего веб-приложения, которое работает на tomcat, и я нахожусь в своем уме.
В этой конфигурации, когда я пытаюсь получить доступ к защищенному элементу даже с действительными учетными данными. Это не позволяет мне войти в систему. Ниже приведены подробности
server.xml
<Realm debug="99"
className="org.apache.catalina.realm.JDBCRealm"
driverName="com.jdbc.mysql.Driver"
connectionURL="jdbc:mysql://localhost/HireZilla"
digest="MD5"
connectionName="realm_access" connectionPassword="realmpass"
userTable="user_details" userNameCol="user_name" userCredCol="password"
userRoleTable="user_roles" roleNameCol="role_name"/>
web.xml
<web-app>
----
<security-constraint>
<web-resource-collection>
<web-resource-name>ReqCreation</web-resource-name>
<url-pattern>/jsp/reqs/new_rec.jsp</url-pattern>
<url-pattern>/jsp/reqs/reqcreate</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Director</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
-----
</web-app>
MySQL-таблицы
CREATE TABLE user_details (
user_name varchar(20) NOT NULL PRIMARY KEY,
password varchar(32) NOT NULL
user_access_level tinyint(3) unsigned NOT NULL DEFAULT '0',
user_login_state tinyint(1) NOT NULL DEFAULT '0',
);
CREATE TABLE `role_types` (
`role_name` varchar(20) NOT NULL,
`description` varchar(100) DEFAULT NULL,
PRIMARY KEY (`role_name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `user_roles` (
`user_name` varchar(30) NOT NULL,
`role_name` varchar(20) NOT NULL,
KEY `user_name_constraint` (`user_name`),
KEY `role_name_constraint` (`role_name`),
CONSTRAINT `user_name_constraint` FOREIGN KEY (`user_name`) REFERENCES `user_details`
(`user_name`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `role_name_constraint` FOREIGN KEY (`role_name`) REFERENCES `role_types`
(`role_name`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `role_types` VALUES ('Director','text 1'),('Manager','text 2'),
('Recruiters','text 3');
INSERT INTO `user_details` VALUES
('admin','5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8',3,1);
INSERT INTO `user_roles` VALUES ('admin','Director');
Это информация журнала кота
16 Jul, 2011 9:03:30 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path: /usr/lib/jvm/java-6-
openjdk/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/jvm/java-
6-openjdk/jre/../lib/i386:/usr/lib/jvm/java-6-
openjdk/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk/jre/lib/i386:/usr/lib/xulrunner-
1.9.2.17:/usr/lib/xulrunner-1.9.2.17:/usr/java/packages/lib/i386:/usr/lib/i386-linux-
gnu/jni:/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu:/usr/lib/jni:/lib:/usr/lib
16 Jul, 2011 9:03:30 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property
'source' to 'org.eclipse.jst.jee.server:HireZilla-SVN' did not find a matching property.
16 Jul, 2011 9:03:31 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
16 Jul, 2011 9:03:31 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1177 ms
16 Jul, 2011 9:03:31 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
16 Jul, 2011 9:03:31 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
16 Jul, 2011 9:03:31 PM org.apache.catalina.startup.ContextConfig validateSecurityRoles
INFO: WARNING: Security role name Director used in an <auth-constraint> without being
defined in a <security-role>
16 Jul, 2011 9:03:32 PM com.model.dbchecks.DatabaseConnectHandler get_db_connection
INFO: Database connection established
16 Jul, 2011 9:03:32 PM com.web.listener.LoginListener contextInitialized
INFO: Set the dbconnection in the listener
16 Jul, 2011 9:03:32 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
16 Jul, 2011 9:03:33 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
16 Jul, 2011 9:03:33 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/40 config=null
16 Jul, 2011 9:03:33 PM org.apache.catalina.startup.Catalina start
Я действительно надеюсь, что кто-нибудь сможет пролить свет на эту проблему. Был бы очень благодарен. Заранее спасибо. Я могу предоставить более подробную информацию, если это необходимо.
Сринат