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 🙂

wget http://plone.lucidsolutions.co.nz/linux/centos/images/jpackage-utils-compat-el5-0.0.1-1.noarch.rpm
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 -->
<Configure>
 
<!-- Tell jetty where to find login config -->
<Call name="setProperty">
	<Arg>java.security.<strong>auth</strong>.login.config</Arg>
	<Arg>WEB-INF/login.config</Arg>
</Call>
 
<!-- Bug fix for Jetty to properly handle login config in a per-project setup -->
<Set name="serverClasses">
	<Array type="java.lang.String">
		<Item>-org.mortbay.jetty.plus.jaas.</Item>
		<Item>org.mortbay.jetty</Item>
		<Item>org.slf4j.</Item>
	</Array>
</Set>
 
<!-- Create login realm -->
<Get name="securityHandler">
	<Set name="userRealm">
		<New>
			<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">
					<Item>*PATH TO YOUR ROLE PRINCIPAL CLASS*</Item>
				</Array>
			</Set>
		</New>
	</Set>
</Get>
</Configure>

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
		subject.getPrincipals().add(user);
 
		//Add roles for the logged in user
		subject.getPrincipals().add( new MyGroupPrincipal("admin") );
		subject.getPrincipals().add( new MyGroupPrincipal("moderator") );
	}

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.

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.

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 Maxmind.com and place it in /usr/share/GeoIP/ (or another path if that is the case)

cd /usr/share/GeoIP/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip  GeoIP.dat.gz

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

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