aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes struts and jndi problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "struts and jndi problem" Watch "struts and jndi problem" New topic

struts and jndi problem

shally kumar

Joined: Jul 30, 2008
Posts: 7

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?

I agree. Here's the link:
subject: struts and jndi problem