54

I am trying to setup jenkins, but I cant get the authentication to work. I am running jenkins on Tomcat6 on CentOS 6.2. I enable logging in, and everything goes fine until I try to log in. After giving my credential and pressing login, tomcat gives me a error:

"HTTP Status 404 - The requested resource () is not available." on http://myserver:8080/jenkins/j_acegi_security_check

By googling I can find this: https://issues.jenkins-ci.org/browse/JENKINS-3761

Two suggested fixes I have found:

  • Run jenkins on tomcat instead of running the standalone version - I am already doing so.
  • Edit a file: WEB-INF/security/SecurityFilters.groovy - I tried to edit, but I can't get it to change anything

Is there something I could do to make this work?

1
  • FWIW It started happening to me lately that i was redirected to j_acegi_security_check blank page on login attempt, on Chrome and Opera on Windows. Turns out the problem was I had a Fiddler proxy enabled which for some reason was preventing me from logging in.
    – jakub.g
    Apr 13, 2016 at 9:18

10 Answers 10

112

Spent ages wrestling with this one, make sure a Security Realm is set when you are choosing your Authorization method in Jenkins.

That is, in Manage Jenkins → Configure Global Security select an option in the Security Realm list.

For example:

enter image description here

1
  • 2
    Solved my issue, too. I was not understanding what was happening.
    – Lorenzo
    Aug 23, 2018 at 7:16
22

You may have forgotten to select a Security Realm as specified below

https://wiki.jenkins-ci.org/display/JENKINS/Standard+Security+Setup

In case you have locked yourself out, you can revert the Jenkins config.xml file to set <useSecurity>true</useSecurity> node value to false by following instructions here

https://wiki.jenkins-ci.org/display/JENKINS/Disable+security

11

As mentioned on the bug page:

The error was caused by a proxy pass rule "/jenkins http://localhost:9080/jenkins/" which led to the incomming (jenkins) request "/jenkins//j_acegi_security_check" (double //). So the login page was rejected with 404 (while all other pages where served).

Make sure your /jenkins ProxyPass does not end with a trailing slash in the destination URL.

1
  • I don't think that's the only issue, as it was fixed installing jenkins differently. I'm not sure if it even was behind a proxy at that point. EDIT: I'm not 100% certain on that though, comparing the date to a question of mine on serverfault, that could have been it. Can't verify my specific case so won't select the answer, but have an upvote
    – varesa
    Jul 24, 2014 at 13:33
0

I had the same problem with 404 on the "/jenkins/j_acegi_security_check" page.

Using Jenkins with Tomcat, after a lot of tries to solve it, I came to following solution - I´m using 18080 as default port without SSL-redirection. It´s related to the redirection, but in that case (as using Tomcat) it has to be changed in the tomcat-server-configuration:

Look in /conf/server.xml for the following entry:

<Connector port="18080" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="8443" /> 

Just commenting out the redirectPort helped for me:

<Connector port="18080" protocol="HTTP/1.1"
    connectionTimeout="20000" />
0

I had the same HTTP 404 on the "/jenkins/j_acegi_security_check" URI problem .

And the same issue as pointed out by pga above: Tomcat was being started as user root.

This was because I had setup tomcat to restart automatically by creating a startup tomcat script at "/etc/init.d/".

Fixed the issue with:

su - tomcatuser - c /cde/pkgs/../tomcat/start.sh
0

I was facing the same issue on Ubuntu as well as on AIX, where I desperately needed it to work in production settings. I even tried Tomcat and Apache web servers, still the same issue.

Finally changing the class loader as follows made it work in stand-alone mode:

java -jar jenkins.war --httpPort=79802 --preferredClassLoader=java.net.URLClassLoader & 

By the way, this is default settings in standard Jenkins distribution for Ubuntu, from where I got the clue.

Probably the issue is related with packaging, but for now this solution works. Check if this resolves similar issues.

1
  • The machine which had the problem does not exist anymore, but thanks for telling this, as it might be useful in the future.
    – varesa
    Nov 28, 2012 at 17:16
0

My bookmarked jenkins login url was: https://jenkins.foo.com/login?from=%2F

If security is disabled and you hit that url with any credentials or blank ones, it brings up the j_acegi error.

Instead, use https://jenkins.foo.com/ and it will take you straight to the dashboard.

-1

I had the same HTTP 404 on the "/jenkins/j_acegi_security_check" URI.

In my case, Jenkins was running on a Tomcat started by user 'root'. Stopped Tomcat, and started it again by the proper separate application user. Problem solved.

1
  • It could have been running as root, as it was a service installed by yum. I thought I configured it to run as something else though...
    – varesa
    Apr 19, 2013 at 13:40
-1

Seeing vote down: I did the steps again on fresh server. There were ** characters and I removed that

There were missing $sign for tomcat like this $TOMCAT_VERSION

(Both corrected and it is working) (updated on 28.03.2016)

Disable the security as given below:

http://markunsworth.com/2012/02/13/locked-yourself-out-of-jenkins/

Unable to login jenkins, and can't disable login option either Or Locked in login with Jenkins on Tomcat.

http://xx.xxx.xxx.xxx:8080/jenkins/login?from=/jenkins/ and after filling the userId Password, which was not set up at all, will always take to this page

http://xx.xxx.xxx.xxx:8080/jenkins/j_acegi_security_check

HTTP Status 404 - description The requested resource is not available.

I had .war file installed in tomcat It took me long to fix this issue. I had many times completely removed Tomcat, Jenkins all folders .jenkins etc reinstalled and what not...

Remove both Tomcat and Jenkins completely once again...

The solution is proper use of user and group, let us see how to it by running the following commands one by one.

You are logged in with user(e.g. vimal) with sudo permission.

 vimal@h123:~$ sudo apt-get update
 vimal@h123:~$ BASE_USER=vimal
 vimal@h123:~$ sudo chown -Rf $BASE_USER:$BASE_USER /opt/

 vimal@h123:~$ USER=apache-tomcat
 vimal@h123:~$ GROUP=myjenkins
 vimal@h123:~$ TOMCAT_INSTALL_DIR=/opt
 vimal@h123:~$ TOMCAT_VERSION=apache-tomcat-8.0.23
 vimal@h123:~$ TOMCAT_URL=http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.23/bin/apache-tomcat-8.0.23.zip

For TOMCAT_URL, copy the link that you need from archive/src (.zip) of tomcat download site

vimal@h123:~$ mkdir -p $TOMCAT_INSTALL_DIR
vimal@h123:~$ cd $TOMCAT_INSTALL_DIR
vimal@h123:~$ wget $TOMCAT_URL
vimal@h123:~$ unzip -q $TOMCAT_VERSION.zip
vimal@h123:~$ rm $TOMCAT_VERSION.zip

Before running command below you need to have JAVA_HOME set up in like JAVA_HOME="/usr/lib/jvm/java-8-oracle/" by adding this into sudo nano /etc/environment

vimal@h123:~$ sudo chmod +x  $TOMCAT_INSTALL_DIR/$TOMCAT_VERSION/bin/*.sh
vimal@h123:~$ $TOMCAT_INSTALL_DIR/$TOMCAT_VERSION/bin/catalina.sh start
vimal@h123:~$
vimal@h123:~$ cd $TOMCAT_INSTALL_DIR/$TOMCAT_VERSION/webapps/
vimal@h123:~$ wget http://mirrors.jenkins-ci.org/war-stable/latest/jenkins.war

Wait for a couple of minutes till Jenkins is fully loaded. Needs 2GB memory. Try going to the browser on http://xx.xxx.xxx.xxx:8080/jenkins/ and it will work...

Took me one day to find the solution.

-1

Here is how I resolved this issue:

# service tomcat status
tomcat start/running, process 996

# service tomcat stop
tomcat stop/waiting

# service jenkins status
Jenkins Continuous Integration Server is not running

# service jenkins restart
 * Restarting Jenkins Continuous Integration Server jenkins                [ OK ]
# service tomcat start
tomcat start/running, process 3839

# service jenkins status
Jenkins Continuous Integration Server is running with the pid 3694

Refresh your browser and Jenkins should be up and running. Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.