• 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

How to use DataSourceRealm?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to build an access control mechanism for a JSF web application on Tomcat 6. Since I already have a database with users, I was going for a DataSourceRealm.
First, I've created another table called user_roles that has only two columns: useraname and role.
Then, I've added the following rows:



Next, I edited conf/server.xml to contain this:


and I edited my web.xml to contain this:


No exceptions are raised during Tomcat startup. Now, when I try to access the app through http://localhost:8080/Test/, the login dialog pops up but no matter what I type in - nothing happens. usertest/usertest doesn't work.
I tried shuting down MySQL to see if an exception would be raised when I attempt to login, but everything seems the same. So, it must something in my server.xml is wrongly configured but I don't know what.
Please guys, give it a shot. I'd be very, very grateful.
[ November 19, 2008: Message edited by: Veggen Skrikk ]
 
Marshal
Posts: 26750
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Veggen Skrikk", please check your private messages for an important administrative matter.
 
Bojan Tomic
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried this exact same configuration with JDBCRealm, and it works fine, so the error must be in the DataSource configurations, but I still can't discover it.

I hope this helps...
 
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I face the same problem now. JDBCRealm works, but DataSourceRealm not.
@Bojan, did you happen to fix it?

Thanks!
 
Sudharsan Govindarajan
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Figured it out. I had to set

localDataSource="true"

in the Realm definition
 
Bojan Tomic
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't fixed it. I'll try your solution.
Thanks for posting it.
 
Your mother was a hamster and your father was a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic