aspose file tools*
The moose likes Tomcat and the fly likes Tomcat with more than one Applications in WEBAPPS folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat with more than one Applications in WEBAPPS folder" Watch "Tomcat with more than one Applications in WEBAPPS folder" New topic
Author

Tomcat with more than one Applications in WEBAPPS folder

carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

Hi i have an application in the tomcat webapps folder which authorises using FORM based Authentication and i added the username and roles in the tomcat-users.xml file and the container authenticates and authorises the user logged in. Now i am adding another application in the webapps folder which works using JDBC realm where i created tables containig username and password and roles in oracle database, after i configure my server.xml file so that the new application uses these tables to authenticate and authorise users , will this effect my old application how will the container recognise this new application is to be work using JDBC realm and the old one to work with memory realm?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42634
    
  65
The Tomcat docs indicate that it is possible to set up realms per context (by nesting the Realm element inside of the Context element). Have you tried that?

(Note that the default configuration of server.xml has a Realm element inside the Engine element, which will cause all web apps to use the same Realm; you'll need to change that.)


Ping & DNS - my free Android networking tools app
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

I changed my server.xml and added the realm in the context element under the engine element



My Application URL is http://localhost:8080/BillingSystem


and in the web.xml i added





And my login.html contains



Now when i click the login button without providing the username and password the control does not goes to the error.html file ... Also i want to know that the configuration of the realm for the context is correct or i am missing out something.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

My login/loginfail pages are JSPs, not HTML.

Customer surveys are for companies who didn't pay proper attention to begin with.
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

But in the other application i used it as html and it worked fine....
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Well, the other thing I do is define the realm in each context. A quick re-read of your initial message gives me the impression that you're activating 2 different realms at the server engine level and expecting magic to connect the right webapp to the right realm. There isn't any magic, so you'd need to define the realm for the context of the webapp rather than in server.xml.
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

define the realm for the context of the webapp rather than in server.xml.



How do i do this stuffing the Context element in the Engine element and giving the path of the application is not enough where am i breaking the link?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21



This is all there is. Nothing in server.xml, nothing under Engine. I just put this file under the name TOMCAT_HOME/conf/Catalina/localhost/jtaonthemove.xml
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

My application name is BillingSystem and it is under

C:\Tomcat 5.5\webapps\BillingSystem

Now i created a file called BillingSystem.xml and its path is C:\Tomcat 5.5\conf\catalina\localhost\BillingSystem.xml

Now can you please tell me what values should Context path,docbase and Resource name should contain

the file BillingSystem.xml contains


carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

Context element with realm placed inside Engine element in server.xml file should work i dont no where am i doing wrong
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Tomcat with more than one Applications in WEBAPPS folder