Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7531363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:09:02+00:00 2026-05-30T05:09:02+00:00

I have created a login page using a nice guide that I found about

  • 0

I have created a login page using a nice guide that I found about Java EE6 and GlassFish3 using netbeans.
After deploying the project when I try to reach the login page I get ‘HTTP Status 403 – Access to the requested resource has been denied’ from GlassFish3 server.

The url I am using is : http://localhost:9999/simplewebapp/admin/admin.jsp
The guide says that I should automatically be redirected to the login page I have created.

Instead I am receiving the above error.
Looking at the glassfish3 log I am getting these two lines when I am entering the above url.

INFO: JACC Policy Provider:Failed Permission Check: context (” simplewebapp/simplewebapp “) , permission (” (javax.security.jacc.WebUserDataPermission /admin/login.jsp GET) “)
INFO: JACC Policy Provider:Failed Permission Check: context (” simplewebapp/simplewebapp “) , permission (” (javax.security.jacc.WebUserDataPermission /admin/login.jsp GET:CONFIDENTIAL) “)

Some more details :

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <security-constraint>
        <display-name>Admin Pages</display-name>
        <web-resource-collection>
            <web-resource-name>Administrative Pages</web-resource-name>
            <description/>
            <url-pattern>/admin/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <description>admin</description>
        </auth-constraint>
    </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>file</realm-name>
        <form-login-config>
            <form-login-page>/login.jsp</form-login-page>
            <form-error-page>/loginerror.jsp</form-error-page>
        </form-login-config>
    </login-config>
    <security-role>
        <description>Administrators</description>
        <role-name>admin</role-name>
    </security-role>
    <security-role>
        <description>Users</description>
        <role-name>user</role-name>
    </security-role>
</web-app>

glassfish-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
  <security-role-mapping>
    <role-name>admin</role-name>
    <group-name>appadmin</group-name>
  </security-role-mapping>
  <class-loader delegate="true"/>
  <jsp-config>
    <property name="keepgenerated" value="true">
      <description>Keep a copy of the generated servlet class' java code.</description>
    </property>
  </jsp-config>
</glassfish-web-app>

What am I doing wrong here?
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:09:04+00:00Added an answer on May 30, 2026 at 5:09 am

    Problem solved.I had to add principal names in glassfish-web.xml and a role-name in web.xml.
    Correct files :

    web-xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <security-constraint>
            <display-name>Admin Pages</display-name>
            <web-resource-collection>
                <web-resource-name>Administrative Pages</web-resource-name>
                <description/>
                <url-pattern>/admin/*</url-pattern>
            </web-resource-collection>
            <auth-constraint>
                <description>admin</description>
                <role-name>AdminRole</role-name>
            </auth-constraint>
        </security-constraint>
        <login-config>
            <auth-method>FORM</auth-method>
            <realm-name>file</realm-name>
            <form-login-config>
                <form-login-page>/login.jsp</form-login-page>
                <form-error-page>/loginerror.jsp</form-error-page>
            </form-login-config>
        </login-config>
        <security-role>
            <description>Administrators</description>
            <role-name>AdminRole</role-name>
        </security-role>
        <security-role>
            <description>Users</description>
            <role-name>UserRole</role-name>
        </security-role>
    </web-app>
    

    glassfish-web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
    <glassfish-web-app error-url="">
      <security-role-mapping>
        <role-name>AdminRole</role-name>
        <principal-name>admin</principal-name>
        <group-name>appadmin</group-name>
      </security-role-mapping>
      <security-role-mapping>
        <role-name>UserRole</role-name>
        <principal-name>user</principal-name>
        <group-name>appuser</group-name>
      </security-role-mapping>
      <class-loader delegate="true"/>
      <jsp-config>
        <property name="keepgenerated" value="true">
          <description>Keep a copy of the generated servlet class' java code.</description>
        </property>
      </jsp-config>
    </glassfish-web-app>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a login page using java swing. and i created jar for
I have created a user login page and am using Forms Authentication. Users are
I have created an app which starts with a login page, after entering some
I have created a login page at www.mywebsite.com/members/login I'm using Zend Framework, Now I
I am using the core Auth component. I have created a user login that
I created a login page in GWT using widgets and RPC. After succesful login,
Just starting out in asp.net. Have just created a login.aspx page in my site
I'm creating a login page. I want to create ASP.NET TextBox controls that have
I have created a new project using devise login according to Ryan Bates' railscast
I have an Image in my login page that I want to show all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.