• 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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Tomcat 7: JDBCRealm authentication issue

 
Ranch Hand
Posts: 163
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a peculiar problem. My Context uses a JDBCRealm for authentication. When I put my Context in conf/server.xml, I can login without a problem. But, I'm told this is a bad practice and that I should place my Context in /webapps/Injunction/WEB-INF/META-INF/context.xml.

I've done this. And now my login fails. Same Context. Two different locations.

I've googled left and right but no one else has experienced this issue. I'm using Tomcat 7.0.39. I upgraded to 7.0.55 to see if it would help, but the problem persists.

Here is my Context:



If I can't resolve this problem, I'll have to maintain the Context in the server.xml and manually deploy the webapp. Turns out you can't use the HTML manager gui if you've put the Context in the server.xml.
 
Saloon Keeper
Posts: 28720
211
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
"/webapps/Injunction/WEB-INF/META-INF/context.xml" isn't actually a valid location.

You can put a context file in a webapp's "/META-INF/context.xml" file. Or you can put it in the Tomcat server instance's "conf/Catalina/localhost" directory under the name "xxxxx.xml", where "xxxxx" is the context path name you want to use. Or both, in which case the Catalina/localhost context overrides the WAR's context.xml. Which is useful if you like a default context in the WAR for testing but need to override it with settings specific to production.
 
Bill Clar
Ranch Hand
Posts: 163
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh my stars and garters. I assumed the META-INF directory had to reside under WEB-INF.

Thank you Tim, you are a saint!

 
Tim Holloway
Saloon Keeper
Posts: 28720
211
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
META-INF has uses outside of J2EE, such as for self-executing JAR apps. That's why it's not under WEB-INF. Actually, it's probably subject to the same "invisibility" rules as WEB-INF, but I never thought about that before.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic