JDBC Realm HTTP 403 problem


I have successfully implemented JDBC Realm for authentication. I can add new users and passwords to the tables in the MySQL database and assign roles which i have populated in the database (from the tomcat-users.xml, i just populated those roles that were present in the tomcat-users.xml) .

I had earlier used tomcat-users.xml file for authentication which contains the roles and users. What i tried to do was add new roles in the database and create users and assign those roles to the users. It gives me HTTP 403 error.

In other words, creating new users and passwords and assigning existing roles works. But if i create a new role in the Database, and assign it to a new users, it fails to enter.

The error looks like this:
HTTP Status 403 - Access to the requested resource has been denied


type Status report

message Access to the requested resource has been denied

description Access to the specified resource (Access to the requested resource has been denied) has been forbidden.


Apache Tomcat/5.0.28

Please help!!!!!!!!!!!!!!!!!!!!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You also need to set up resources acess in your web.xml correctly after you set up JDBC realm.
especially looking for sth like this:

                <description> accessible by authenticated users of the tomcat role</description>
                <description>These roles are allowed access</description>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
geek4uAuthor Commented:
I absolutely understood where the problem is!! Thanks for the help!!

Can i ask you some more help??

How can we set the web.xml in such a way that the <role-name> value is taken from the database??

In detail, I have an appication running on struts and performs JDBC Realm authentication (programmed by me). I need also to add new user roles on the fly i.e., i have created JSP from where admin can add new user role (into the database) and also assign controls (acl.xml). Everything is done, but just because i need to add the role-name in the web.xml this will not work. Do you know how i can do it???

I hope i am clear!!

geek4uAuthor Commented:
The problem i am trying to avoid is "Every time i make an entry to web.xml, i need to restart the server" which we cannot afford when the system goes into production.

Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

>>How can we set the web.xml in such a way that the <role-name> value is taken from the database??
     web.xml is static so I am afraid you can not do it on the fly.
     But good news is that you can programtically do it if you want. Use: HttpServletRequest.isUserInRole(<role>)
geek4uAuthor Commented:

I am using it to get authorization!!

But i need to put in the role-names in web.xml and not restart the server or any other way around!!
web.xml only reads during web app initiation. Sorry, no way around. Refer to specification, the only choice is using isUserInRole which should be sufficient.

geek4uAuthor Commented:
Can you explain it lil bit more clearly?? Thanks
what I mean is that programmtic authentication and authorizatio such as  isUserInRole is your only way.

You can not change web.xml on the fly. It is static.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.