aspose file tools*
The moose likes Tomcat and the fly likes JDBC Realm using tomcat and oracle is not working for second time onwords. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "JDBC Realm using tomcat and oracle is not working for second time onwords." Watch "JDBC Realm using tomcat and oracle is not working for second time onwords." New topic
Author

JDBC Realm using tomcat and oracle is not working for second time onwords.

Nazeer Ahammad
Ranch Hand

Joined: Feb 26, 2012
Posts: 43
Hi all,

I'm trying to execute one simple login authotication program using JDBCRealms. I wrote one program it was asking user name and password when i run first time, next time onwords it was not asking username and password. I restarted tomacat but no use, but if i restart my machine then if i run that application it will ask (Because it is first firm time). i tried using session.invalidate(),session.setMaxAge() and session timeout in dd(deployment discriptor) but i didn't get solution.So please help me how it is storing sessions ? where it is storing sessions? and how can i kill that sessions?

Used softwares:

tomcat 7
JDK 1.6
eclipse ide

used programs and configuration file are below:
---------------------------------------------------------

web.xml
------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>jdbcrealms2</display-name>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>JDBC Realm Example</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>employee</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>

--------------------------------------------
context.xml in meta-inf folder
--------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Realm className="org.apache.catalina.realm.JDBCRealm"
connectionName="root"
connectionPassword="root"
connectionURL="jdbcracle:thin:@blrkec96002d:1521:JDBCRealDemo"
debug="99"
driverName="oracle.jdbc.driver.OracleDriver"
roleNameCol="role_name"
userCredCol="password"
userNameCol="user_name"
userRoleTable="tomcat_users_roles"
userTable="tomcat_users"/>
</Context>

-------------------
index.jsp
-----------------
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home page</title>
</head>
<body>
Index page
Invoke Generic Servlet
</body>
</html>



Thanks and Regards,
Nazeer Ahammad.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

Helpful hint: We have a "Code" button on the message editor. It lays down special text tags that can be used to wrap pre-formatted text such as Java code and XML and make it more readable.

The session information is stored in the TOMCAT_HOME/work directory, I believe. For best results, I like to clean out the work, temp, and logs directory before starting Tomcat. Also, if I am deploying a WAR file, I remove the exploded WAR from the webapps directory, since a newer WAR file will not replace older/obsolete exploded WAR directory.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JDBC Realm using tomcat and oracle is not working for second time onwords.