Today I added the Robots <META> tag with noindex, nofollow to my HTML error documents.
Tag Archives: error
UnsupportedClassVersionError in Closure
Today while Getting Started with the Closure Compiler Application I ran into the following trouble:
jj5@mercy:~/Desktop/compiler-latest$ java -jar compiler.jar --help Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CommandLineRunner : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find the main class: com.google.javascript.jscomp.CommandLineRunner. Program will exit.
To fix the problem I installed jdk-7:
root@mercy:/home/jj5# apt-get install openjdk-7-dbg openjdk-7-demo openjdk-7-doc openjdk-7-jdk openjdk-7-jre
Fixing mailman can’t discard/defer message via web config
I had a notice from Mailman for one of my lists that there was a message that required administrative attention (i.e. it was spam). The mailman web-interface provides a facility for treating email, however when I went to discard the message it wouldn’t go away. I tried a heap of things and it took a long time to figure out, but eventually I noticed that in the mailman web page the domain name it was using was “intranet.blackbrick.com” whereas that should have been “www.intranet.blackbrick.com”. So I did a little searching about how to configure a list’s base URL and discovered this, which fixed my issue:
/usr/lib/mailman/bin/withlist -l -r fix_url support \ --urlhost=www.intranet.blackbrick.com
Where ‘support’ above is ‘list name’.
Error: post-commit hook failed (exit code 255) with no output
In subversion I was getting the error “post-commit hook failed (exit code 255) with no output” after trying to configure my post-commit hook to send email notifications. At first I thought the problem must have been related to the mailer, but I ran the mail command manually and it worked fine. Eventually I figured out that the problem was that the hooks/post-commit file hadn’t been marked executable. So it was a simple chmod +x to fix the problem.
PHP error handling and reporting
Quick and dirty PHP error handling:
error_reporting( E_ALL | E_STRICT ); ini_set( 'display_errors', 'on' );
MySQL: Error in SQL: Commands out of sync; you can’t run this command now
Today I was programming MySQL via PHP and I received an error “Error in SQL: Commands out of sync; you can’t run this command now”. It turned out the problem was that a previous mulit_query had mysqli_results that hadn’t been freed. This article helped me solve the problem, and now my batch mode SQL processor looks like this:
public function execute_batch( $sql ) { $this->write_count++; if ( ! $this->link->multi_query( $sql ) ) { $this->throw_error( $sql ); } if ( $this->link->more_results() ) { do { $result = $this->link->use_result(); if ( $result instanceof mysqli_result ) { $result->free(); } } while ( $this->link->more_results() && $this->link->next_result() ); } }
This code executes the SQL batch and then frees any mysqli_results that result from the query batch.
phpMyAdmin #1045 Cannot log in to the MySQL server
I was using phpMyAdmin and trying to login to my server with a new user that I’d created called ‘pma’ but I was getting the error “#1045 Cannot log in to the MySQL server”. The ‘pma’ user was also my phpMyAdmin control user and as its login wasn’t working advanced features of phpMyAdmin weren’t functional and I was getting an error letting me know.
I thought maybe the problem was that I’d specified the password for the ‘pma’ user incorrectly so I reset the ‘pma’ user password just to be user:
update user set password=PASSWORD("secret") where user='pma';
But the problem persisted. I had a look in the mysql.user table to see what was in there. The results included the following:
mysql> use mysql; Database changed mysql> select Host, User, Password from user; +-----------+-----------+-------------------------------------------+ | Host | User | Password | +-----------+-----------+-------------------------------------------+ | localhost | | | | % | pma | *BD053A55278DA675E32F28360C759B3FBEE32B3E | +-----------+-----------+-------------------------------------------+
Note the entry on the first line with a blank username. I have no idea how that entry got into my mysql.user table but basically it seems to be interpreted as “any user” at localhost with no password. I didn’t like the look of that so I deleted that entry. After that entry had been deleted the login for my ‘pma’ user started to work.
Apache configuration error: couldn’t check user. No user file?
I was trying to configure Digest authentication in Apache and I was getting Internal Server Error 500 when trying to access my site. The Apache error log reported: “configuration error: couldn’t check user. No user file?”
Turned out the problem was that I hadn’t installed the Digest auth module. So the fix was:
# a2enmod auth_digest # apache2ctl graceful
HTTPS+SSLVerifyClient require in <Directory>+big POST = Apache error
I was configuring MediaWiki to allow uploads and was getting an error in the browser about the POST data being too large (“does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.”). I had a look in the Apache error log and found:
[Thu Feb 23 16:12:45 2012] [error] [client 60.240.67.126] request body exceeds m aximum size (131072) for SSL buffer, referer: https://www.jj5.net/morpheus/Speci al:Upload [Thu Feb 23 16:12:45 2012] [error] [client 60.240.67.126] could not buffer messa ge body to allow SSL renegotiation to proceed, referer: https://www.jj5.net/morp heus/Special:Upload
So I did some research. I found this document, File upload size which suggested editing /etc/php5/apache2/php.ini which I did:
upload_max_filesize = 20M post_max_size = 80M
That didn’t fix the problem though. I found Request entity too large which suggested checking my setting for LimitRequestBody, but that wasn’t the problem either.
Eventually I found Bug 491763 – HTTPS+SSLVerifyClient require in <Directory>+big POST = Apache error which suggested I needed to apply the SSLRenegBufferSize directive which I did like this:
<Location /morpheus> SSLVerifyClient require SSLVerifyDepth 1 SSLRenegBufferSize 20971520 </Location>
And then after restarting Apache the problem was solved.
fail2ban.actions.action: ERROR
Found some discussion on dealing with “fail2ban.actions.action: ERROR” errors from fail2ban. Basically there’s a race condition and a few suggestions to deal with it. One is to modify /usr/bin/fail2ban-client like this:
def __processCmd(self, cmd, showRet = True): beautifier = Beautifier() for c in cmd: time.sleep(0.1) beautifier.setInputCmd(c)
But the other one, that I think I like better, is to edit /etc/fail2ban/actions.d/iptables-multiport.conf to include a call to sleep for a random time up to three seconds:
actionstart = sleep `perl -e 'print rand(3);'` iptables -N fail2ban-<name> iptables -A fail2ban-<name> -j RETURN iptables -I INPUT -p <protocol> -m multiport --dports <port> -j fail2ban-<name>