在eclipse中无法使用tomcat设置jdbc域

时间:2011-07-16 16:02:07

标签: eclipse tomcat jdbc jdbcrealm

我一直在努力为我在tomcat上运行的Web应用程序设置一个jdbc领域,而我的智慧结束了。

在此配置中,当我尝试使用有效凭据访问安全元素时。它不让我登录。以下是详细信息

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');

这是tomcat日志信息

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

我真的希望有人能对这个问题有所了解。真的很感激。提前致谢。如果需要,我可以提供更多细节。

斯里纳

0 个答案:

没有答案
相关问题