Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

struts and jndi problem  RSS feed

shally kumar
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have made a web application using struts 1.1. In this I am using tomcat container security check for log in. For this I have REALM tag in META-INF/context.xml. Now I am thinking to use JNDI for connection pooling, so that I can avoid to put database userid and password in struts-config.xml (datasource). Before implementing jndi it was working perfectly and security check as well, but now it always decline to verify the login.

Here is my code for the the following files:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/InformProject" docBase="InformProject">

<Resource name="jdbc/informDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="singh14" password="informPass" driverClassName="com.mysql.jdbc.Driver"

<Realm className="org.apache.catalina.realm.DataSourceRealm" debug="99"
dataSourceName="jdbc/informDB" localDataSource="true"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name"/>


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="" xmlns:xsi="" xsi:schemaLocation="">

<!-- /// jndi /// -->
<description>DB Connection</description>


<%@ page language="java" contentType="text/html; charset=UTF-8"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>inform Login</title>
<form method="POST" action='<%= response.encodeURL("j_security_check") %>' >
Username: <input type="text" name="j_username">
Password: <input type="password" name="j_password">
<input type="submit" value="Login"> <input type="reset">



Can some one help me why it is not working and what is missing?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!