• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Tomcat with more than one Applications in WEBAPPS folder

 
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.)
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Saloon Keeper
Posts: 28323
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My login/loginfail pages are JSPs, not HTML.
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But in the other application i used it as html and it worked fine....
 
Tim Holloway
Saloon Keeper
Posts: 28323
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28323
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Context element with realm placed inside Engine element in server.xml file should work i dont no where am i doing wrong
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic