Skip to content

Full installation for developers

drierat edited this page Mar 20, 2013 · 69 revisions

(this page is under construction)

Notice this is a big project, so there are lots of different modules, libraries, dependencies, etc. That makes it a bit complicated to configure. Here you can find the steps to prepare everything you need to develop new plugins and/or services.

A. github register and new stable branch fork

  1. If you do not have a github user, go to the github site and register.
  2. Once registered, go to the kPAX repo. This is the repo of the current stable branch of the kPAX project. Create a new branch from this one by forking it. That will be your work branch.
  3. Install github (local) in your computer. Follow the instructions in the github help page. Do not forget to add your SSH key to github.
  4. Clone the repo from the "Git bash" just installed, following these instructions (notice that you only need to execute the first steps). This will bring a copy of the project to your hard disk allowing to work locally.

B. Java-based programming infrastructure

  1. Download and install [Java SE Development kit 6] (http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html). There are some installation instructions (for Windows).
  2. Download and install eclipse (or another IDE/editor. Notice that the present documentation is prepared for eclipse). Do not forget to configure the environment variables after the installation (See Step 7).
  3. Download and install maven 3.0.3 or later. Follow the instructions in the maven installation web.
  4. Download and install jBoss 4.2.3. Notice that this is not the latest version of jBoss. The zip file can be unziped wherever you want. Then, from eclipse (or other) configure it following these instructions. Do not worry about the Prerequisites. Only follow the "Create a localhost-only server configuration in Eclipse" section. Try to start the jBoss server. If your PC is too slow, you will need to increase the Start timeout in the Overview dialog of the jBoss local server you just created.
  5. Open a command window and, having moved to the Java project root, execute the command "mvn install" to get all the necessary libraries for the platform right operation.
  6. If everything went right, execute "mvn eclipse:eclipse" in order to make eclipse correctly detect all the variables.
  7. In eclipse, create the M2_REPO variable. To do that, go to Project properties --> Java build path --> Add variable --> Create a new variable with name M2_REPO with the repository route (for instance /user/juanfra/.m2/repository/)
  8. Modify tag \Users\juanfrasr\servidor\jboss-4.2.3-1.GA\server\default\deploy to the path where your server is located. This has to be done in the pom.xml file.
  9. Execute "mvn -Denv=local clean package". Notice that this step has to be repeated every time the developer wants to compile.
  10. Add mysql connector/j library to JBoss. This step needs to be done since no other process will take care of it so download the current version of it for your platform (see: http://www.mysql.com/downloads/connector/j/) and copy the contained compressed jar (i.e.: mysql-connector-java-5.1.19-bin.jar) to the directory: $JBOSS_HOME/server/default/lib, in this way the server will have access to the mysql connection once the application has been deployed.

C. WAMP structure

  1. Install a WAMP infrastructure (e.g. WAMP, XAMPP, etc.).

D. MySQL database

  1. Create a kPAX database and a user with all grant privileges in it.
  2. Use the script in the folder doc/sql in the k-pax project to create an empty database.
  3. Once the database has been created, edit the file srvKpax-ds.xml and include the database configuration (host, port, user, password), and store this file where the application is deployed, for instance /home/server/jboss/server/default/deploy/*

E. elgg code

  1. Download elgg code (version 1.8.X) from the elgg download page.
  2. Save the content in the www folder of the wamp/xammp server.
  3. Start the wamp/xammp server and all services.
  4. Create an empty database for elgg (in a browser, go to http://localhost/phpmyadmin).
  5. Activate the "rewrite_module" (Apache) and the "php_openssl" (PHP) in wampserver.
  6. During the installation (next step) you will be asked for a temporal folder. Create it where you prefer, in the hard disk. Furthermore, create the 'elgg' database and a user with full privileges.
  7. Install elgg from http://localhost/elgg-1.8.X/install.php (write the corresponding version in your path). In the "Requirements check" step, check that the httpd.conf file has got the AllowOverrride set to ALL.
  8. Go to localhost/FOLDERNAME (for instance http://localhost/elgg) and copy mod folder's content from elgg project.
  9. Activate the apiadmin 1.8b1, kpax and likeskpax modules in the elgg Administration page Important notes:
    • the apiadmin 1.8b1 delivered in mods-kpax is broken, there is a new version in the author's page but it has not been tested in this environment. The code can be edited following instructions for a workaround.
    • deactivate "likes" (Elgg module) before activating likeskpax module or you will get a blank page in admin from which it is difficult to recover.
  10. Now, create a key pair in API administration. Include it in the following files:
    • /www/elgg/mod/kpax/lib/kpaxSrv.php -> $apikey = "YOUR KEY";
    • /src/main/java/uoc/edu/svrKpax/util/ConstantsKPAX.java -> public final static String ELGG_API_KEY ="YOUR KEY";
  11. Remember to compile the Java code by executing "mvn -Denv=local clean package".

Troubleshooting:

Once everything has been set up, the Jboss server can throw errors at startup similar to:

18:59:55,739 ERROR [STDERR] 24-abr-2012 18:59:55 com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
  uoc.edu.svrKpax.rest
18:59:55,788 ERROR [STDERR] 24-abr-2012 18:59:55 com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
  class uoc.edu.svrKpax.rest.Jsonp
  class uoc.edu.svrKpax.rest.User
  class uoc.edu.svrKpax.rest.Games
18:59:55,789 ERROR [STDERR] 24-abr-2012 18:59:55 com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
18:59:55,864 ERROR [STDERR] 24-abr-2012 18:59:55 
com.sun.jersey.server.impl.application.WebApplicationImpl _initiate

These errors are Jersey framework configuration related and can be safely ignored.

Other troubles can arise in a Mac computer environment:

JDK 1.6 related, if running Maven you get the message:
	[WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
		    
	then use the solution outlined in the message and the fourth comment on the link:
	http://bruehlicke.blogspot.com.es/2009/11/missing-rtjar-mac-os-x-using-proguard.html
	    
Jboss manual start related. If on start you get the message:
	$ ./run.sh
	./run.sh: line 89: ulimit: open files: cannot modify limit: Invalid argument
	run.sh: Could not set maximum file descriptor limit: unlimited
	  
	then a possible workaround is to execute
	$ sysctl -n kern.maxfilesperproc
	10240 
	       
	and change line 89 of run.sh, where it says:
	MAX_FD="unlimited"
		 
	by
	MAX_FD="10240" (where 10240 is the number obtained in the previous step) 
	    
	More info in: https://issues.jboss.org/browse/JBAS-4948
Clone this wiki locally