Category: General |
Posted by: JohnHaselden
Another update that's slightly off the 'Seam' topic, but it's useful information anyway. This post is going to take you through installing Subversion (SVN) onto Linux (Ubuntu 8.10 server) and use a database running under PostgreSQL 8.3 for authentication.
First up, install Ubuntu. I'll leave that one up to you to figure out, but I did not install the LAMP server option, just the PostgreSQL option as I don't need MySQL on this server.
From this point, we need to update our repositories for apt-get.
You can just run a sudo su to just log in as root.
Once that has completed, it's time to install the SVN server, apache, libapache2-svn and the libapache2-mod-auth-pgsql modules
and give apache a nudge to restart with the modules
OK, so let's do some work with PostgreSQL. First we need a database to store the SVN access details in. This database will have two tables, svnuser and svngroups. The first table will store the details of the user; login name, password, first name, surname and an email address along with an ID.
Let's create the database and the user for that database. Using psql as the postgres user:
Now quit psql and check that the above user works.
You're probably wondering why I'm specifying the loopback IP address as the host of the target database. Well, if you have a look at your pg_hba.conf file (under /etc/postgresql/8.3/main) and scroll to the bottom of the file, you will see that there are different rules for authenticating users connecting to the database depending on where they come from. By specifiying the IP address, you force PostgreSQL to perform MD5 authentication with the password you enter when trying to login rather than expecting ident or sameuser to work. If you don't want to do this repeatedly, then change 'ident sameuser' to 'md5' and restart PostgreSQL using /etc/init.d/postgresql restart.
Now you're on the database, let's set up our two tables.
Now, we are going to have a group for the admins who will have access to every project and one group per project. Let's create a admin first.
OK, let's set up repository. I have placed the repositories under /var/svn so move to that directory after you have created it. Once there, let's set up the repository as root.
Now, I want to be able to log into this repository using the user we have just created over HTTP (using WebDAV) so let's do that.
Still as root, cd to /etc/apache2/mods-available and move dav_svn.conf and dav_svn.load to /etc/apache2/mods-enabled, then copy 000_auth_pgsql.load to /etc/apache2/mods-enabled/auth_pgsql.load. You can use the contents of dav_svn.conf to work out what's going on, but I usually clear this file and start from fresh.
Add the following to the file:
And restart apache.
Now, from a remote machine and using a browser go to:
http://<your server hostname or IP address>/test/svn
You should be prompted to enter a user name and password for authentication so enter the username and password you inserted into the svnuser record and then you will see the 0 revision of your test repository.
First up, install Ubuntu. I'll leave that one up to you to figure out, but I did not install the LAMP server option, just the PostgreSQL option as I don't need MySQL on this server.
From this point, we need to update our repositories for apt-get.
sudo apt-get update
You can just run a sudo su to just log in as root.
Once that has completed, it's time to install the SVN server, apache, libapache2-svn and the libapache2-mod-auth-pgsql modules
sudo apt-get install subversion
sudo apt-get install apache2
sudo apt-get install libapache2-svn
sudo apt-get install libapache2-mod-auth-pgsql
and give apache a nudge to restart with the modules
/etc/init.d/apache2 restart
OK, so let's do some work with PostgreSQL. First we need a database to store the SVN access details in. This database will have two tables, svnuser and svngroups. The first table will store the details of the user; login name, password, first name, surname and an email address along with an ID.
Let's create the database and the user for that database. Using psql as the postgres user:
create database svnusers;
create user svnuseradmin with password '<your password>';
grant all privileges on database svnusers to svnuseradmin;
Now quit psql and check that the above user works.
psql -U svnuseradmin -W -h 127.0.0.1 svnusers
You're probably wondering why I'm specifying the loopback IP address as the host of the target database. Well, if you have a look at your pg_hba.conf file (under /etc/postgresql/8.3/main) and scroll to the bottom of the file, you will see that there are different rules for authenticating users connecting to the database depending on where they come from. By specifiying the IP address, you force PostgreSQL to perform MD5 authentication with the password you enter when trying to login rather than expecting ident or sameuser to work. If you don't want to do this repeatedly, then change 'ident sameuser' to 'md5' and restart PostgreSQL using /etc/init.d/postgresql restart.
Now you're on the database, let's set up our two tables.
create table svnuser(
login varchar(20) primary key,
password varchar(60) not null,
firstname varchar(100) not null,
surname varchar(100) not null,
email varchar(255) not null);
create index svnuser_login_idx on svnuser (login);
create table svngroups (
login varchar(20) not null constraint svngroups_login_fk references svnuser (login),
svngroup varchar(50) not null);
create index svngroups_login_idx on svngroups(login);
alter table svngroups add constraint svngrousp_login_svngroup_unique unique (login, svngroup);
Now, we are going to have a group for the admins who will have access to every project and one group per project. Let's create a admin first.
insert into svnuser values (
'<your username>',
md5('<your password>'),
'<your first name>',
'<your surname>',
'<your email address>');
insert into svngroups values ('<your username>', 'admin');
OK, let's set up repository. I have placed the repositories under /var/svn so move to that directory after you have created it. Once there, let's set up the repository as root.
svnadmin create test
Now, I want to be able to log into this repository using the user we have just created over HTTP (using WebDAV) so let's do that.
Still as root, cd to /etc/apache2/mods-available and move dav_svn.conf and dav_svn.load to /etc/apache2/mods-enabled, then copy 000_auth_pgsql.load to /etc/apache2/mods-enabled/auth_pgsql.load. You can use the contents of dav_svn.conf to work out what's going on, but I usually clear this file and start from fresh.
Add the following to the file:
<Location /test/svn>
DAV svn
SVNPath /var/svn/test
# Turn BASIC auth off and point it at a blank file,
# or you get a whole bunch of garbage in the logs
AuthBasicAuthoritative Off
AuthType Basic
AuthName "Test SVN Repository"
AuthUserFile "/dev/null"
Auth_PG_hash_type md5
Auth_PG_host localhost
Auth_PG_port 5432
Auth_PG_user svnuseradmin
Auth_PG_pwd <your password>
Auth_PG_database svnusers
Auth_PG_pwd_table svnuser
Auth_PG_uid_field login
Auth_PG_pwd_field password
Auth_PG_grp_table svngroups
Auth_PG_cache_passwords on
Auth_PG_grp_user_field login
Auth_PG_grp_group_field svngroup
Require group test admin
</Location>
And restart apache.
Now, from a remote machine and using a browser go to:
http://<your server hostname or IP address>/test/svn
You should be prompted to enter a user name and password for authentication so enter the username and password you inserted into the svnuser record and then you will see the 0 revision of your test repository.
15/02: PayAtThePump Android
Category: JBoss Seam |
Posted by: JohnHaselden
Not really Seam news, but hey, it's Java and it's using a Seam back-end. However, PayAtThePump is now available on the Google Android platform through the Android Market!
If you're on Android in the UK or the US, go and check it out and let us know what you think. It's free!
If you're on Android in the UK or the US, go and check it out and let us know what you think. It's free!
15/02: RESTEasy problems
Category: JBoss Seam |
Posted by: JohnHaselden
Well, not so much problems, but a problem - I can't persist!
Having decided to use RESTEasy on a project we're currently working on rather than using the hand-rolled implementation of REST we were using previously. For read operations, this isn't a problem - however I'm not able to persist any updates.
This is becoming such a problem that I'm getting really, really close to ripping out the update part and going back to the hand-rolled solution just for this area as too much time has been invested to get to this point to revert every other retrieval mechanism. Plus that part works reasonably well (although returning XML doesn't seem as simple as it should be).
If anyone else has some insight into this particular problem, please let me know before I spend a couple of days implementing a replacement solution.
Some background: we're using POJOs, Seam 2.1.0 SP1 and PostgreSQL on JBoss 4.2.3. The persist call grabs the next value from hibernate_sequence but doesn't write anything else into the logs. The one class we're trying to persist has the @ID as a long, one String and a Float object.
Having decided to use RESTEasy on a project we're currently working on rather than using the hand-rolled implementation of REST we were using previously. For read operations, this isn't a problem - however I'm not able to persist any updates.
This is becoming such a problem that I'm getting really, really close to ripping out the update part and going back to the hand-rolled solution just for this area as too much time has been invested to get to this point to revert every other retrieval mechanism. Plus that part works reasonably well (although returning XML doesn't seem as simple as it should be).
If anyone else has some insight into this particular problem, please let me know before I spend a couple of days implementing a replacement solution.
Some background: we're using POJOs, Seam 2.1.0 SP1 and PostgreSQL on JBoss 4.2.3. The persist call grabs the next value from hibernate_sequence but doesn't write anything else into the logs. The one class we're trying to persist has the @ID as a long, one String and a Float object.
Category: JBoss Seam |
Posted by: JohnHaselden
Hot on the heels of the CR2 release a few days ago, the Seam team have released the GA version of 2.1.1. There aren't many bugs from the CR2 release so I thought I would actually list all the bugs for once
Also just released is the Reference Implementation of Web Beans 1.0.0 (Alpha 1) over here. I have been keeping an eye on the Web Beans stuff that's out there and that keeps popping up on the blogs and it is looking very interesting. Hopefully I will have a little time over the holidays to have a quick look at it... although I have promised myself that I will get two iPhone applications finished and look at Android (and read a couple of books and implement some new cool features on Pay At The Pump...) so there may be a blog posting about WB in the new year.
- [JBSEAM-3682] - empty data for date type throws exception in JXLHelper.createCell
- [JBSEAM-3802] - Seamspace example - pages.xml is not a valid xml document
- [JBSEAM-3803] - Openid example - typo in faces-config.xml
- [JBSEAM-3817] - logLevel is not the correct name for the attribute, log-level is
- [JBSEAM-3819] - grammar in http://docs.jboss.com/seam/latest/reference/en-US/html/tutorial.html
- [JBSEAM-3830] - e:cell doesn't support null values
- [JBSEAM-3834] - ClassCastException in Cell Column With Empty Date
- [JBSEAM-3843] - Seamspace example - pages.xml uses logLevel attribute
Also just released is the Reference Implementation of Web Beans 1.0.0 (Alpha 1) over here. I have been keeping an eye on the Web Beans stuff that's out there and that keeps popping up on the blogs and it is looking very interesting. Hopefully I will have a little time over the holidays to have a quick look at it... although I have promised myself that I will get two iPhone applications finished and look at Android (and read a couple of books and implement some new cool features on Pay At The Pump...) so there may be a blog posting about WB in the new year.
21/12: JBoss Tools 3.0.0.CR1
Category: JBoss Seam |
Posted by: JohnHaselden
The latest CR release of JBoss Tools is available for download. There are a whole bunch of bug fixes and new features in this release - too many for me to list in detail.
I had upgraded to the latest version of JBoss tools prior to this release and it is much improved over the version I was previously using: much more stable. One of the major issues I had was that preview in the JSF editing view usually didn't show anything, however has been considerably better with the more recent release. Although I have had issues when using f:selectItems with preview. There is a resolved bug regarding f:selectItem (singular) so I think I may grab this release and see if my issue is resolved.
I had upgraded to the latest version of JBoss tools prior to this release and it is much improved over the version I was previously using: much more stable. One of the major issues I had was that preview in the JSF editing view usually didn't show anything, however has been considerably better with the more recent release. Although I have had issues when using f:selectItems with preview. There is a resolved bug regarding f:selectItem (singular) so I think I may grab this release and see if my issue is resolved.
10/12: Seam 2.1.1.CR2
Category: JBoss Seam |
Posted by: JohnHaselden
The latest version of Seam (2.1.1.CR2) is up over in the usual place. From the release notes there are a couple of AS 5 related bugs, an upgrade to RichFaces, and a couple of NPE / missing reference bugs.
21/11: JBoss Seam 2.1.1.CR1
Category: JBoss Seam |
Posted by: JohnHaselden
The first release candidate for Seam 2.1.1 is up over on sourceforge. There's the usual raft of bug fixes and new features listed in the release notes. One exiting new feature for me is support for OpenID.
20/11: Hibernate Search 3.1.0.CR1
Category: JBoss Seam |
Posted by: JohnHaselden
The fine folks over at Hibernate have released the first release candidate for Hibernate Search 3.1.0 over here. The main work in this release is to bring Hibernate Search into line with Lucene's new features and a few performance tweaks.
06/11: Seam 2.1.0 Security Features
Category: JBoss Seam |
Posted by: JohnHaselden
Over on Shane Bryzak's blog there is a post with a very good run down of the new security features in Seam 2.1.0 along with an example of how to use the features.
Category: JBoss Seam |
Posted by: JohnHaselden
Over on JSF Central, there is an interview with Pete Muir about the Seam 2.1 release. The mp3 of the interview is also available.


