Avatar of Effin_Ell
Effin_Ell

asked on 

AD User account 404 error in Tomcat

I am encountering HTTP Status 404 - Not Found  accessing a http://localhost:8080/sample/ application.
Description: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

I can only assume it is caused by my Apache Tomcat configuration, because I am yet to get it working. I am running version Apache Tomcat/7.0.91 on Redhat 7 in AWS. I have installed and integrated Winbind and the OS is happily talking to my AD domain example.com. It can see groups and users and I have masked the domain format 'example/user1' so it appears as 'user1'.

I have downloaded and installed sample.war from https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/ into my tomcat installation /usr/local.tomcat7/webapps/ directory.

My  /usr/local/tomcat7/conf/server.xml configuration looks like this:
<!-- <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
-->
<Realm className="org.apache.catalina.realm.JNDIRealm"
   debug="99"
   connectionURL="ldap://example.com:389"
   authentication="simple"
   referrals="follow"
   connectionName="cn=user1,ou=users,ou=lab,dc=example,dc=com"
   connectionPassword="**********"
   userSearch="(sAMAccountName={0})"
   userBase="dc=example,dc=com"
   userSubtree="true"
   roleSearch="(member={0})"
   roleName="cn"
   roleSubtree="true"
   roleBase="ou=users,ou=lab,dc=example,dc=com"
  />

Open in new window


My /usr/local/tomcat7/webapps/sample/WEB-INF/web.xml file looks like this:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <display-name>Hello, World Application</display-name>
    <description>
        This is a simple web application with a source code organization
        based on the recommendations of the Application Developer's Guide.
    </description>

    <servlet>
        <servlet-name>HelloServlet</servlet-name>
        <servlet-class>mypackage.Hello</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>HelloServlet</servlet-name>
        <url-pattern>/hello</url-pattern>
    </servlet-mapping>

 <security-constraint>
   <web-resource-collection>
     <web-resource-name>Entire Application</web-resource-name>
     <url-pattern>/*</url-pattern>
   </web-resource-collection>
 </security-constraint>
 <login-config>
   <auth-method>BASIC</auth-method>
   <realm-name>Tomcat Manager Application</realm-name>
 </login-config>

 
    <security-constraint>
        <display-name>All Users</display-name>
        <web-resource-collection>
            <web-resource-name>All Users</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>User</role-name>
        </auth-constraint>
    </security-constraint>

    <security-constraint>
        <display-name>Admin Users</display-name>
        <web-resource-collection>
            <web-resource-name>Admin Users</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>Admin</role-name>
        </auth-constraint>
    </security-constraint>

    <security-role>
        <description>Webapp Admins</description>
        <role-name>Admin</role-name>
        <group-name>Domain Admins</group-name>
    </security-role>

    <security-role>
        <description>Webapp Users</description>
        <role-name>User</role-name>
        <group-name>Domain Users</group-name>
    </security-role>

</web-app>

Open in new window


I have reviewed the tomcat logs and see no SEVERE error logs, just INFO/WARNING level information. Could someone shed any light on where I am going wrong?
HTML* Active Directory Federation Services (ADFS)JSP* TomcatApache Web Server

Avatar of undefined
Last Comment
gsk
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of gsk
gsk

Hi Effin,

First of all please  note that 404 error occurs because tomcat is not able to find war of the project.Please delete work folder from tomcat
server. Tomcat folder provides default jsp examples and servlets. please run those.also check whether your port is 8080 or 8000.

proper mapping for servlets should be there in web.xml

please check these first,we will see other things later.
thanks
Active Directory
Active Directory

Active Directory (AD) is a Microsoft brand for identity-related capabilities. In the on-premises world, Windows Server AD provides a set of identity capabilities and services, and is hugely popular (88% of Fortune 1000 and 95% of enterprises use AD). This topic includes all things Active Directory including DNS, Group Policy, DFS, troubleshooting, ADFS, and all other topics under the Microsoft AD and identity umbrella.

86K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo