facebook

j_security_check is not available

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #248772 Reply

    SEanLon11
    Member

    I am using Tomcat 5, and am trying to connect to a secure area, but I continuously get the error provided below when I try to login from my “secure/signin.jsp” page. I know not to access my siginin.jsp page directly, and I do not think that is my error, but if anyone has any ideas, I am all ears.

    
    The requested resource (/card/secure/j_security_check) is not available.
    

    I am trying to simply sign into the secure area. Here is my webapps/card/web-inf/web.xml file:

    
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    
    <web-app>
      <security-constraint>
        <web-resource-collection>
          <web-resource-name>card</web-resource-name>
          <!-- Define the context-relative URL(s) to be protected -->
          <url-pattern>/secure/*</url-pattern>
          <http-method>POST</http-method>
          <http-method>GET</http-method>
          <http-method>DELETE</http-method>
          <http-method>PUT</http-method>
        </web-resource-collection>
        <auth-constraint>
          <role-name>user</role-name>
          <role-name>admin</role-name>
        </auth-constraint>
      </security-constraint>
    
      <!-- Default login configuration uses form-based authentication -->
      <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>card</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>
        <role-name>user</role-name>
        <role-name>admin</role-name>
      </security-role>
    
    </web-app>
    

    My tomcat-users.xml is as follows:

    
    <!--
      NOTE:  By default, no user is included in the "manager" role required
      to operate the "/manager" web application.  If you wish to use this app,
      you must define such a user - the username and password are arbitrary.
    -->
    <tomcat-users>
      <user name="root" password="3335rocks" roles="admin,manager" />
      <user name="tomcat" password="tomcat" roles="tomcat" />
      <user name="role1"  password="tomcat" roles="role1"  />
      <user name="both"   password="tomcat" roles="tomcat,role1" />
      
    </tomcat-users>
    
    

    I’m not sure what else you may need to look at, but if anyone needs something else, please let me know.

    Thanks in advance,
    Sean

    #248890 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev.

    Sean,
    Isn’t the j_security_check the container security? If it’s barfing on not-found, I wonder if your Tomcat install is OK? Have you tried this same code with a fresh unzip of Tomcat and see if it works there?

    #257408 Reply

    jCoder1973
    Member

    I struck this with Eclipse. Eclipse doesn’t ‘see’ tomcat server.xml. Copy the relevant realm detail (jdbc/jndi etc) into your context.xml file under your projects META-INF directory (create it if you don’t have one yet).

    Example of my Context.xml file:

    <?xml version=”1.0″ encoding=”UTF-8″?>

    <Context>
    <!– Conection pool resource –>
    <Resource name=”jdbc/QuoteDB” auth=”Container”
    type=”javax.sql.DataSource”
    username=”dude” password=”guessme”
    driverClassName=”com.mysql.jdbc.Driver”
    url=”jdbc:mysql://localhost:3306/MyDb”
    maxActive=”8″
    maxIdle=”4″
    removeAbandoned=”true”
    removeAbandonedTimeout=”60″
    logAbandoned=”true” />
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <WatchedResource>META-INF/context.xml</WatchedResource>
    <!– Link to the user database we will get roles from –>
    <Realm className=”org.apache.catalina.realm.JDBCRealm”
    driverName=”com.mysql.jdbc.Driver”
    connectionURL=”jdbc:mysql://localhost:3306/MyDb”
    connectionName=”dude”
    connectionPassword=”guessme”
    userTable=”users” userNameCol=”UserName”
    userCredCol=”Password”
    userRoleTable=”userrole” roleNameCol=”RoleName” />

    </Context>

    By the way you need to have a Context.xml for connection pooling – again the server.xml drama.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: j_security_check is not available

You must be logged in to post in the forum log in