wood burning stoves 2.0*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

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


<%@ page language="java" contentType="text/html; charset=UTF-8"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<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?

subject: struts and jndi problem
Similar Threads
Trouble Configuring a Data Source for MySQL using JSTL in JBoss
error: Cannot load JDBC driver class
Query in : JNDI look up of DataSource
Connection Polling in Oracle 10g Using NetBeans ID
Cannot Connect to database using datasource realm