Using Spring Security Plugin in Grails

14 June 2011 12:37 AM

During my quest on using the Spring Security Plugin in Grails I’ve faced some difficulties.  I’m documenting what I’ve done here to future reference and hoping someone else find it useful.

1. Tutorial

Here’s a good tutorial about how to setup and start with the spring security plugin

http://blog.springsource.com/2010/08/11/simplified-spring-security-with-grails/

And the complete guide about the plugin

http://burtbeckwith.github.com/grails-spring-security-core/docs/manual/guide/single.html

2. Field or property  cannot be found on object of type ‘org.springframework.security.web.access.expression.WebSecurityExpressionRoot’  Caused by: Failed to evaluate expression.  Is ROLE_ prefix mandatory?

According to what I’ve read Spring Security uses two modes.  A traditional mode and a mode based on Spring Expression Language (SpEL).

http://burtbeckwith.github.com/grails-spring-security-core/docs/manual/guide/single.html#5.4%20Using%20Expressions%20to%20Create%20Descriptive,%20Fine-Grained%20Rules

I’m not sure if its possible to specify which mode the plugin will use,  as it’s done in Spring-Security

http://forum.springsource.org/showthread.php?78426-Failed-to-evaluate-expression-sec-intercept-url

But according to this post

http://permalink.gmane.org/gmane.comp.lang.groovy.grails.user/107548

and my experience,  if you intend to work using the traditional config, you have to name your authorities with the prefix “ROLE_”.   If you don’t do so the plugin will assume you’re working with SpEL and try to parse your authority name as an expression,  throwing an exception.

3. UI

I was thinking on how to create the views and controller to support user registration and administration,  when I found out there is a Spring-Security-UI plugin that does this for you.  Here’s an example on how to do this

http://www.objectpartners.com/2011/05/24/customizing-the-grails-spring-security-ui-plugin/

and the complete documentation

http://burtbeckwith.github.com/grails-spring-security-ui/docs/manual/index.html

4.  Installing Spring-Security-UI plugin.  Failed to install plugin [mail-1.0-SNAPSHOT]. Plugin has missing JAR dependencies.

The Spring-Security-UI plugin depends on the Mail plugin which I could not install in my first attempt,  because  it’s dependencies cannot be resolved using the default grails repositories.   So I had to uncomment the mavenCentral()  repository in BuildConfig.groovy,  uninstalled the previous plugin and reinstalled again.   I found the answer in this thread:

http://grails.1312388.n4.nabble.com/spring-security-ui-depending-on-mail-plugin-gt-dependency-resolution-fails-td3238433.html

5. Persistent cookies

To enable persistent cookie support you have to create a specific domain class as explained here

http://burtbeckwith.github.com/grails-spring-security-core/docs/manual/ref/Scripts/s2-create-persistent-token.html

 

That’s all for the moment.  I’ll continue working and updating this post :)

 

Read More

What I’ve learned about GORM

24 March 2011 11:09 PM

I’m starting to learn Grails and I’m working in a project where I have to connect an existing database to Grails by custom mapping. While working on this I’ve had some difficulties and questions, here’s a summary of what I’ve learned about them :)

Problem 1: Is there a tool that generates Groovy classes from existing tables?

Yes. It’s called GRAG and does a pretty decent job.  I still had to tweak somethings by hand,  but GRAG saved me a lot of time :D .

Problem 2: Is the id field mandatory in GORM?  How do I map a table in where the primary key is made of various fields and has no id of its own?

The identification field is mandatory.   Tables with composite keys can be mapped using the  ‘composite’  atributte in this way:

class Person {
  String firstName
  String lastName
  static mapping = {
      id composite:['firstName', 'lastName']
  }
}

http://grails.org/doc/latest/guide/5.%20Object%20Relational%20Mapping%20%28GORM%29.html#5.5.2.5%20Composite%20Primary%20Keys

Problem 3:  I didn’t realize ‘composite’ field’s  parameters were referring to  field names and not column names.

So in my first attempt to create the composite key I did this

class Person {
  String firstName
  String lastName
  static mapping = {
      id composite:['First', 'Last']
  }
}

Assumnig First and last were the names of the columns on the table. (Compare this with the section above)

http://grails.1312388.n4.nabble.com/DataSources-Plugin-with-Read-Only-Database-Unable-to-map-a-composite-key-No-property-found-for-name–td1391729.html

Problem 4:  Domain objects with composite keys must implement serializable

The compiler told me so XD

Problem 5:  ‘properties’  is a reserved word

I couldn’t give the name ‘properties’ to one of my fields.  Apparently it is a reserved word and cannot be used.

I wrote something like this:

class Item {
 
static hasMany = [properties: ItemProperties]
 
}

And the compiler gave me this error:

No such property: id for class: groovy.util.MapEntry

Googling I found this link

http://archive.codehaus.org/lists/org.codehaus.grails.user/msg/84b9b45c0806050258n118a1d66v82b9bdda4e4ed2b1@mail.gmail.com

and rewrote my code to:

class Item {
 
static hasMany = [itemProperties: ItemProperties]
 
}

which runs without problems :)

 

That’s all at the moment.  Hope someone would find this useful.

Read More

World of Warcraft Patch 4.0 Installation Issues

14 October 2010 3:10 AM

I do not play WOW but my brother does. He was getting trouble installing the new patch (4.0).

The symptoms were the following,

1. The Launcher was unable to get the information of the new patch. It showed the normal Lich King display. I checked the log file and it said,

#-----------------------------------------------------------
# System started at 2010-10-13 21:27:03.7500
# system: COMPUTERNAMEHERE
#-----------------------------------------------------------
21:27:03.7656 Launcher version 1.8.0.394
21:27:04.0937 Fetch version information from
us.version.worldofwarcraft.com
(http://206.18.98.54/update/PatchSequenceFile.txt).
21:27:04.5312 Received version information from

http://206.18.98.54/update/PatchSequenceFile.txt.

21:27:04.5312 No update is required.

2. When my brother logged in to his account the game showed him a list of WOW realms all in red (like they were unavailable), after selecting one of those, the game froze with the “Connecting” status.

3. When we tried to run the Repair tool it responded with the following error “Cannot connect to server to download repair information. Please try again later”

So… after looking for a while in the World of Warcraft forums we found the solution in this post.

We only had to download a new Repair tool from here and let it fix it all :D .  Now he’s happily downloading the patch.

I’m pasting the new information found in the log after the fix,  just for reference.

#-----------------------------------------------------------
# System started at 2010-10-13 21:44:10.8883
# system: COMPUTERNAMEHERE
#-----------------------------------------------------------
21:44:11.0156 Launcher version 2.1.1.1462
21:44:11.0156 Found incorrect InstallPath registry key entry for World
of Warcraft ('D:\World of Warcraft\').
21:44:11.0157 Found incorrect GamePath registry key entry for World of
Warcraft ('D:\World of Warcraft\Launcher.exe').
21:44:11.0158 Fixed incorrect InstallPath registry key entry for World
of Warcraft (now 'D:\Copy of World of Warcraft\').
21:44:11.0159 Fixed incorrect GamePath registry key entry for Launcher
(now 'D:\Copy of World of Warcraft\Launcher.exe').
21:44:11.4584 Reverting to old PSF patching system.
21:44:11.6755 Fetch version information from
us.version.worldofwarcraft.com
(http://206.18.98.51/update/PatchSequenceFile.txt).
21:44:12.1748 Fetch version information from
us.version.worldofwarcraft.com
(http://12.129.254.54/update/PatchSequenceFile.txt).
21:44:12.4277 Fetch version information from
us.version.worldofwarcraft.com
(http://12.129.222.52/update/PatchSequenceFile.txt).
21:44:12.6777 Fetch version information from
us.version.worldofwarcraft.com
(http://12.129.254.51/update/PatchSequenceFile.txt).
21:44:12.9155 Received version information from

http://12.129.222.52/update/PatchSequenceFile.txt.

21:44:12.9193 A tools update is required.
21:44:21.7756 Timeout from http://206.18.98.51/update/PatchSequenceFile.txt.
21:44:22.1968 Timeout from http://12.129.254.54/update/PatchSequenceFile.txt.
Read More

RedDwarf Project Configuration (Video)

5 October 2010 1:03 AM

Hello!!

I recently found a compilation of video tutorials  about Project Darkstar here.

The compilation includes a video tutorial of how to setup a project under Netbeans.   This one was very useful to me.  Because the same steps are valid for RedDwarf.

Darkstar: NetBeans Project Configuration from Project Darkstar on Vimeo.

Also there’s a version of how to set up the project under eclipse.

Darkstar Eclipse Project Configuration from Project Darkstar on Vimeo.

Many thanks to “Peter”  who was the person who created the tutorials :D

Tip:  You can watch the videos in HD @ Vimeo

Read More

Some resources for RedDwarf newcomers

20 September 2010 4:42 PM

Hello everyone!  As you may know,  I’m learning how to develop applications for the RedDwarf server.  At the beginning it was very difficult for me because I didn’t know where to start.  But I’m finally understanding :D .

FYI I’m posting some resources that I think are  useful for all the people starting with RedDwarf.

1.  Project Snowman Hands On Lab.   This is a tutorial created by Sun,  specifically designed to teach how to use Project Darkstar.  I think following this tutorial  is one of the best things to do to learn RedDwarf.  By doing it  you can get a pretty good understanding of the basic principles of Darkstar/RedDwarf  and  how everything works.  I found it while searching at the RedWarf forums.

2.  Server Tutorial and Client Tutorial -  Original Version by Sun.  I had some problems when I started reading the tutorials published at RedDwarf’s site because the Server Tutorial referred to a script which I could not find within the downloaded files.  So again, searching in the forums I found this post and the original tutorials.  With those in hand I was able to happily finish what I was doing (that was only trying to run the server XP).

Now whit the help from the information above I can look at the RedDwarf documentation more confidently.  I’m  still learning and I hope to learn more and share with you here. XD.  Meanwhile check out RedDwarf documentation and the forums.  Good Luck!! ;) .

Read More

Installing Jira on Glassfish. A Step by Step Guide.

18 July 2010 7:40 PM

For this installation we will be using:

  • Ubuntu Server 10.04
  • Glassfish V3
  • Jira 4.1.2
  • MySQL 5.1

Glassfish is not officially supported as a Jira Application Server, so we need to make some changes to get it to work. This guide is a compilation of several posts and information I’ve read over the internet.  It’s the first time I work with most of this technologies so what I did was just follow the instructions and do a little of research on my own,  but there are some things I barely understand.  So please  if you know a better way of how to do things, leave a comment,  so we all can learn and improve the guide.

Special thanks to:

  • Jason Lee for this tutorial
  • Michał Lipski for all the information shared here
  • Risky and Jordi for pointing out some mistakes I made

Now, lets start with the tutorial.

First of all,  we need to download  the WAR/EAR version of  Jira.

wget http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-enterprise-4.1.2.tar.gz

Untar the document

tar -xjvf atlassian-jira-enterprise-4.1.2.tar.gz

We will identify the newly created directory:  ./atlassian-jira-enterprise-4.1.2 as $JIRA_ROOT in this tutorial.

Fixing the Seraph Library

We need to change some code in one of Jira’s  libraries called Seraph and create a new jar file for it. I’ve uploaded a copy of the modified jar here, you can use it and skip this section. If you want to do it by yourself follow the incoming instructions.

Get the Seraph code from here:

https://svn.atlassian.com/svn/public/atlassian/seraph/tags/atlassian-seraph-2.1.4

Use your favorite SVN client to get the source. The directory of the project: atlassian-seraph-2.1.4 will be called $SERAPH_ROOT from now on.

To compile it we need to install the maven tool.  For Ubuntu type:

sudo apt-get install maven2

We also need to configure Atlassian Repositories in our maven settings.  To do this edit the file  /etc/maven2/settings.xml and add the following lines within the profiles section 1

<profile>
       <id>AtlassianProfile</id>
       <activation>
         <activeByDefault>true</activeByDefault>
       </activation>
 
       <repositories>
         <repository>
           <id>atlassian-public</id>
           <url>https://m2proxy.atlassian.com/repository/public</url>
           <snapshots>
             <enabled>true</enabled>
             <updatePolicy>daily</updatePolicy>
             <checksumPolicy>warn</checksumPolicy>
           </snapshots>
           <releases>
             <enabled>true</enabled>
             <checksumPolicy>warn</checksumPolicy>
           </releases>
         </repository>
 	      <repository>
 	        <id>atlassian-plugin-sdk</id>
           <url>file://${env.ATLAS_HOME}/repository</url>
           <snapshots>
             <enabled>false</enabled>
           </snapshots>
           <releases>
             <enabled>true</enabled>
             <checksumPolicy>warn</checksumPolicy>
           </releases>
         </repository>
       </repositories>
 
       <pluginRepositories>
         <pluginRepository>
           <id>atlassian-public</id>
           <url>https://m2proxy.atlassian.com/repository/public</url>
           <releases>
             <enabled>true</enabled>
             <checksumPolicy>warn</checksumPolicy>
           </releases>
           <snapshots>
             <checksumPolicy>warn</checksumPolicy>
           </snapshots>
         </pluginRepository>
       </pluginRepositories>
       <properties>
         <downloadSources>true</downloadSources>
         <downloadJavadocs>true</downloadJavadocs>
       </properties>
  </profile>

Now change the method init(), from the file BaseLoginFilter.java located in $SERAPH_ROOT/src/com/atlassian/seraph/filter,  to look like this:  2

public void init(FilterConfig config) {
        //log.warn("LoginFilter.init" + config.getFilterName());
        this.filterConfig = config;
 
        String configFileLocation = null;
 
        if (config.getInitParameter("config.file") != null) {
            configFileLocation = config.getInitParameter("config.file");
            //log.warn("Security config file location: " + configFileLocation);
        }
 
        securityConfig = SecurityConfigFactory.getInstance(configFileLocation);
        config.getServletContext().setAttribute(SecurityConfig.STORAGE_KEY, securityConfig);
        //log.warn("SecurityFilter.init completed successfully.");
    }

Change directory to $SERAPH_ROOT.  A file named pom.xml should be there.  To compile execute

mvn package

This command should build atlassian-seraph-2.1.4.jar inside the $SERAPH_ROOT/target folder.

Create a folder in $JIRA_ROOT/edit-webapp/WEB-INF/ called lib

mkdir $JIRA_ROOT/edit-webapp/WEB-INF/lib

Copy the new seraph library to there

cp $SERAPH_ROOT/target/atlassian-seraph-2.1.4.jar  $JIRA_ROOT/edit-webapp/WEB-INF/lib

The ejb-3_0-api.jar Library

I’m not sure about this step.  But in this bug thread they said its solves a problem.

Download the library ejb-3_0-api.jar

wget http://www.java2s.com/Code/JarDownload/ejb-3_0-api.jar.zip

Unzip and copy ejb-3_0-api.jar to $JIRA_ROOT/edit-webapp/WEB-INF/lib 3

cp ejb-3_0-api.jar $JIRA_ROOT/edit-webapp/WEB-INF/lib

The sun-web file

Classloader Delegation should be switched off for Jira to run properly.  This can be configured in the sun-web.xml  flie. 4

Put this file in $JIRA_ROOT/edit-webapp/WEB-INF/

The file should contain the following text

<?xml version="1.0" encoding="UTF-8"?>
 
<!DOCTYPE sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD 
  Application Server 9.0 Servlet 2.5//EN' 
  'http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd'>
 
<sun-web-app>
  <class-loader delegate="false" />
</sun-web-app>

The Jira user

We will create a user called jira with a home directory in /usr/local/jira

sudo /usr/sbin/useradd --create-home --home-dir /usr/local/jira --shell /bin/bash jira

Before generating the WAR file we need to tell jira where it’s home directory is located and how it will be connected to a database.

Setting Jira Home

Edit the file $JIRA_ROOT/edit-webapp/WEB-INF/classes/jira-application.properties.  Locate the line referring to jira home and change it

jira.home = /usr/local/jira

Setting up the Database Connection

Edit the file $JIRA_ROOT/edit-webapp/WEB-INF/classes/entityengine.xml
In the transaction-factory section change jndi-name from java:comp/env/UserTransaction to UserTransaction.  As follows.

    <transaction-factory class="org.ofbiz.core.entity.transaction.JNDIFactory">
      <user-transaction-jndi jndi-server-name="default" jndi-name="UserTransaction"/>
      <transaction-manager-jndi jndi-server-name="default" jndi-name="UserTransaction"/>
    </transaction-factory>

In the datasource section change to the following

<datasource name="defaultDS" field-type-name="mysql"
helper-class="org.ofbiz.core.entity.GenericHelperDAO"
check-on-start="true"
use-foreign-keys="true"
use-foreign-key-indices="true"
check-fks-on-start="true"
check-fk-indices-on-start="true"
add-missing-on-start="true"
check-indices-on-start="true">
<jndi-jdbc jndi-server-name="default" jndi-name="jdbc/JiraDS"/>
</datasource>

Notice the removal of the line

schema-name="PUBLIC"

And the jndi-name again is changed from java:comp/env/jdbc/JiraDS to only jdbc/JiraDS 5
Later in this tutorial we will create the correspondent DataSource within Glassfish.

Creating the DB and DBuser

We need to create a jira specific database and a database user.  To do this we use MySQL console.

mysql -u root -p

Inside the console type

CREATE DATABASE jiradb CHARACTER SET UTF8;

To create the user and give it the appropriate permissions execute the following

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on  jiradb.* TO 'jirauser'@'localhost' IDENTIFIED BY 'jirauserpasswd';

6

Downloading MySQL Connector For Java

To be able to use MySQL from Java,  as Jira does,  we need a special connector.
Download it from MySQL site

wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.13.tar.gz/from/http://mirror.services.wisc.edu/mysql/

Untar the files

tar -zxvf mysql-connector-java-5.1.13.tar.gz

Copy the required library to your Glassfish external library directory. My GF installation directory is: /usr/local/glassfishv3/glassfish/. I’ll name it $GF_ROOT, so the ext lib directory is in: $GF_ROOT/domains/domain1/lib/ext or the one for your specific domain.

cp mysql-connector-java-5.1.13/mysql-connector-java-5.1.13-bin.jar $GF_ROOT/domains/domain1/lib/ext

Restart Glassfish
Change the working directory to your Glassfish bin folder.

cd $GF_ROOT/bin

Stop and start again the domain

./asadmin stop-domain domain1
./asadmin start-domain domain1

Creating the Data Source on Glassfish

Open your Glassfish web console.  If you left the default port set,  it should be accessible through  http://yoursite:4848,  for example

http://localhost:4848

Inside Glassfish Web Console Select Resources > Connection Pools

Click on new and fill out the form with the following values

Click on next.  In the second step of the Connection Pool creation, scroll down to Additional Properties. Erase all properties loaded by default and leave only the following:


Select the new connection pool and click ping to test it

You should see a “Ping Succeeded” message like this

Now, we need to create a JDBC Resource named JiraDS as we specified in the file entityengine.xml.  To do this,  click in JDBC resources.  And fill out the form with the following information,

Constructing the WAR File and Deploying

Change the current working directory to $JIRA_ROOT,  and execute

./build.sh war

The builder generates two WAR files,  one intended to be used on Tomcat,  and other dist-generic.  We will use the last one.
Copy the WAR file to your Glassfish autodeploy directory.  For example,

cp ./dist-generic/atlassian-jira-4.1.2.war /usr/local/glassfishv3/glassfish/domains/domain1/autodeploy/jira.war

Now Jira should be accessible through   http://yourserver:yourport/jira

http://localhost:8080/jira

About warnings…

Thanks to my new friend Benny Neugebauer I’ve know that Jira has some issues with the OpenJDK. Here’s a post in how to uninstall it and install the Sun version.

http://www.bennyn.de/webanwendungen/virtual-server/openjdk-deinstallieren.html

Also Benny wrote a post in how to properly set the mail.mime.decodeparameters to true. The post can be found here.

http://www.bennyn.de/webanwendungen/virtual-server/mail-mime-decodeparameters-setzen.html

Both posts are in German, but it’s easy to understand what you have to do by reading the commands and files involved. Thank you Benny :) .

Edits

Edit 20100824: Added a copy of the modified atlassian-seraph-2.1.4.jar .
Edit 20100831: Added links about how to solve Jira’s warnings.

<profile>
       <id>AtlassianProfile</id>
       <activation>
         <activeByDefault>true</activeByDefault>
       </activation>

       <repositories>
         <repository>
           <id>atlassian-public</id>
           <url>https://m2proxy.atlassian.com/repository/public</url>
           <snapshots>
             <enabled>true</enabled>
             <updatePolicy>daily</updatePolicy>
             <checksumPolicy>warn</checksumPolicy>
           </snapshots>
           <releases>
             <enabled>true</enabled>
             <checksumPolicy>warn</checksumPolicy>
           </releases>
         </repository>
 	      <repository>
 	        <id>atlassian-plugin-sdk</id>
           <url>file://${env.ATLAS_HOME}/repository</url>
           <snapshots>
             <enabled>false</enabled>
           </snapshots>
           <releases>
             <enabled>true</enabled>
             <checksumPolicy>warn</checksumPolicy>
           </releases>
         </repository>
       </repositories>

       <pluginRepositories>
         <pluginRepository>
           <id>atlassian-public</id>
           <url>https://m2proxy.atlassian.com/repository/public</url>
           <releases>
             <enabled>true</enabled>
             <checksumPolicy>warn</checksumPolicy>
           </releases>
           <snapshots>
             <checksumPolicy>warn</checksumPolicy>
           </snapshots>
         </pluginRepository>
       </pluginRepositories>
       <properties>
         <downloadSources>true</downloadSources>
         <downloadJavadocs>true</downloadJavadocs>
       </properties>
    </profile>
Read More

Project Snowman Installation Guide

9 June 2010 6:15 PM

Today I was trying to install Project Snowman. I downloaded the distribution package, followed the instructions in Snowman’s wiki and got this error:

[java] SEVERE: DataService initialization failed
[java] java.lang.UnsatisfiedLinkError: no libdb_java45 in java.library.path

After founding the library and pasting it in the right folder… another error…

[java] SEVERE: DataService initialization failed
[java] com.sun.sgs.impl.service.data.store.DataStoreException: DataStore initialization failed: Unexpected database exception: com.sleepycat.db.DatabaseException: Bad address: Bad address

So I looked up google,  and found an installation guide for snowman in a cached page from www.timadorus.org.  I’m afraid the cached page could be lost so I’m copying and pasting the guide here. If you know who can be the author please post a comment so I can give him or her credit.

The guide says it’s for Windows XP.  I tried in Windows 7 32 bits and it worked perfectly.
Update 20100913: Today I tried in Windows 7 64 bit and it gives me the following error:

[java] SEVERE: DataStore initialization failed
[java] java.lang.UnsatisfiedLinkError: C:\Users\Alhvi\Desktop\snowman-dist-
0.1\snowman-dist\natives\bdb\win32-x86\libdb_java45.dll: Can't load IA 32-bit .d
ll on a AMD 64-bit platform

Anyway… for the rest of the people who uses a 32 bit Windows Version, or another OS  here is the guide:

Installation Guide for Snowman version 0.1

The game:

Download link: https://project‐snowman.dev.java.net/

Requirements:

Installation process:

Step 1:

Unzip the file snowman-dist.01.zip

Step 2:

After unzipping the file two new folders will be created:
/natives/
/snowman-dist/

To get the client running on Windows XP you have to copy libdb_java45.dll from
Path: /natives/bdb/win32 –x86
to the following folder:
path: /snowman-dist/natives/bdb/win32 –x86/

The next step is to create a new folder named “win32 –x86”.
Path: /snowman-dist/lwjgl-binaries/win32 –x86
Now copy the file “lwjgl.dll” from win32 to your new created folder.
Path: /snowman-dist/natives/lwjgl-binaries/win32

*Step 3:

Change dir to the folder snowman-dist
Path:/snowman-dist/
A file called build.xml should be found there

Step 4:

Open console and enter the following commands:
ant run-single
ant run-client

…and enjoy your snowball fight!!

Step 5:

If the game does not start please check the output for “Bad address” warnings like this:
Notice the missing slashes!
[java] WARNUNG: Database error message: Z:\xp-pro\Desktop\snowman-dist-0.1\
snowman-dist\xp-proDesktopsnowman-dist-0.1snowman-dist  mpsnowman\dsdb: Bad addr

If so open the build.xml file and look for these lines:

com.sun.sgs.app.name=Snowman
com.sun.sgs.app.root=${app.dir}
com.sun.sgs.app.port=${server.port}
com.sun.sgs.impl.service.transport.udp.port=1234
com.sun.sgs.impl.service.data.store.db.environment.class=${bdb.env}

Replace “${app.dir}” with the snowman path. *The line to change should be 168.
Example:
com.sun.sgs.app.root=c:\\snowman-dist\\tmp\\snowman

*Dont forget the double backslashes ;)

*Run again:

ant run-single
ant run-client
Now the game should start without any problems.

Further commands for the console:

ant run-single:         starts a local server
ant run-client:        starts a client
ant run-server:        starts a server
ant run-editor:        starts the editor

Download Source Code:

svn url : https://project-snowman.dev.java.net/svn/project-snowman/trunc

Name: guest
Password: empty

Comment by Alhvi:

After following the guide everything works as it should. The only thing I didn’t knew is that you need to run two clients to be able to play.

Update 20100913: Changed the format to make the guide a little bit more understandable. Added some comments to the post (marked with *). Happy programmers day!! :D

Project Snowman Client

Project Snowman Client

Read More
Page 1 of 212