Development Java

class Foo is public, should be declared in a file named

When working with Java you might encounter this error. The reason for this is that you have tried to declare a public class in a file with a different name. Each java file can only contain one public java class, which is named the same as the java file itself. If you need another class inside your other class you should looking into private inner classes.

Development Java Linux Red Hat Software

jpackages error: Missing Dependency: /usr/bin/rebuild-security-providers

Jpackages on Red Hat has a nifty bug that causes dependency errors.

Luckily, somebody has created a fix as a rpm package 🙂

rpm -ivh jpackage-utils-compat-el5-0.0.1-1.noarch.rpm

And then jpackages works.


Tips for implementing a custom JAAS login module for Jetty

1) jetty-web.xml

You can gather all specific settings for Jetty in the file WEB-INF/jetty-web.xml, remember to also specify paths for the role principals if you use your own classes for that.

Example jetty-web.xml file:

<!-- Jetty specific config file -->

<!-- Tell jetty where to find login config -->
<Call name="setProperty">

<!-- Bug fix for Jetty to properly handle login config in a per-project setup -->
<Set name="serverClasses">
	<Array type="java.lang.String">

<!-- Create login realm -->
<Get name="securityHandler">
	<Set name="userRealm">
			<Set name="name">*NAME OF YOUR REALM*</Set>
			<Set name="LoginModuleName">*NAME OF YOUR LOGIN CLASS*</Set>
			<Set name="roleClassNames">
				<Array type="java.lang.String">

2) Adding roles to a user in commit

When you want to give a user roles(like admin, moderator etc), you can add those to the user when he or she is authenticated and commit is called upon:

	public boolean commit() throws LoginException {
		MyUserPrincipal user = new MyUserPrincipal("username");

		//Add logged in user as first principal

		//Add roles for the logged in user
		subject.getPrincipals().add( new MyGroupPrincipal("admin") );
		subject.getPrincipals().add( new MyGroupPrincipal("moderator") );

Debugging GWT: Did you forget to inherit a required module?

You will receive this error if you are using classes in your GWT project that GWT does not have access to. Make sure that you have added something like this in your gwt.xml file, within your module element:

    <source path="" />

Eclipse Workspace In Use Or Cannot Be Created

You may recieve the error message “Eclipse Workspace In Use Or Cannot Be Created” From Eclipse when trying to start up Eclipse, this typically means that Eclipse is already running.  If you have not started Eclipse, try to locate Eclipse in your operating systems task manager and kill it. You can also consider killing any java processes running if you cant find any Eclipse processes.

Development Linux

SVN gives “attempt to write a readonly database” error

You can get a meeting with this error message when trying to commit something to a SVN repo, this is caused by wrong permissions on a file on the SVN server. The file “rep-cache.db” will most likely have wrong permissions like the group not having write access to the file. A simple chmod g+w on the file will be enough for the error message not appearing again.


HttpClient: Target host must not be null, or set in parameters

If you have the following code failing:

HttpGet httpget = new HttpGet(“”);

Then the error is pretty easy to solve:
The problem is that you have not added a protocol to the URL, so change it to:

HttpGet httpget = new HttpGet(“”);

And then it will work as wanted.


java.util.concurrent.CopyOnWriteArrayList not found in

Simply said: You are most likely trying to run a java app on a too old version of Java, try upgrading to java 1.6 and see if that helps.


PHP GeoIP: Required database not available at /usr/share/GeoIP/GeoIP.dat

This error is most likely caused by you missing the GeoIP.dat file. Simply download it from and place it in /usr/share/GeoIP/ (or another path if that is the case)

cd /usr/share/GeoIP/
gunzip  GeoIP.dat.gz

And that should be enough, no restart of any service is needed 🙂

Java no segments* file found (Solr)

You will receive that error from Solr when you (for example) have removed the index data, but not the index folder itself. Simply remote the folder that are supposed to contain the index data, and Solr will then recreate the folder, and the data when you start a indexing job. 🙂

Development Java

The hierarchy of the type Foo is inconsistent

You can get the error:

The hierarchy of the type *classname* is inconsistent

If you are trying to compile a class that requires another class not available. Normally due to compilation errors in the dependent classes. So fix the classes needed by the main class and try again.

PHP Ubuntu

sh: phpize: not found

When using pecl, or something else that require phpize, you may get a warning saying that phpize is not found, even when you have PHP installed on your server.  In order to use phpize you need to install the PHP development packages, normally named php-devel.

For Debian/Ubuntu, you can fix this by running:

sudo apt-get install php5-dev