Exact matches only
Search in title
Search in content
Search in posts
Search in pages
portfolio
Filter by Categories
ADAM
Architecture
Big Data
Bio-IT World
Bioinformatics
Blog
Cases
cBioPortal
Consultancy
CTMM TraIT
Data Curation
Data Management
FAIR
Galaxy
Harry van Haaften
IMI EMIF
IMI ETRIKS
IMI Translocation
Irina Pulyakhina
Janneke Schoots
Jarno van Erp
Jojanneke Blaak
Joris Borgdorff
Kees van Bochove
Maxim Monait
Natalia Boukharov
OMOP and OHDSI
Open source
Peter Kok
Pieter Lukasse
Piotr Zakrzewski
RADAR CNS
Rianne Jansen
Riza Nugraha
Services
Seth Snel
Sjoerd van Hagen
Software Development
Software Engineering
Software licenses
Software licenses
Solutions
Spark
Team
Topics
Translational Research
tranSMART
TranSMART 2.0
Uncategorized
Ward Weistra
Wibo Pipping

@TheHyveNL

Earlier, I blogged about how to set up a tranSMART development environment – this was the GPL 1.0 release which has Oracle as a prerequisite. Nowadays, we have a version that runs on Postgres – it still has some problems, but it is promoted as the current master version.

Recently we had a tranSMART hackathon at Imperial College, organized by Yike Guo c.s. and the eTRIKS project. I was invited to chair this session, even though I am not formally part of eTRIKS, which is just awesome – note how open source community building is not only preached but also practiced by eTRIKS here!

However, at this workshop I found out that many developers who are willing to have a look at tranSMART, are struggling to even get it installed locally. That is a very bad situation, because the entry barrier to the open source community / code should be as low as possible, and I am sure that for many developers, getting it installed and running locally is just the first step to do to get a feeling of what tranSMART is.

So in this blog post, I would like to walk through the steps of installing a local development environment for the current Postgres-based master branch of tranSMART, using an installer that my colleague Pieter Lukasse wrote. I will use the Mac OS X operating system as an example, but the steps are very similar under Linux and even in Windows.

Decide where you want the stuff
I put all my custom applications in a folder called /app, and throughout this example I will use /app/transmart-dev as a base path.

Getting the prerequisites
The README specifies that we have to install a JDK, Git, PostgreSQL, Ant and Grails. Ant is already installed by default on OS X, so is a Java JDK. If you are not using a package manager for OSX yet, I would recommend homebrew – it’s easy to use, flexible, and installs all tools in /usr/local. Using homebrew, we can easily install the other tools:

brew install git postgresql grails

If this is really the first time you install PostgreSQL, then follow the instructions homebrew displays for initializing the database with initdb, and restarting postgresql.
Finally, be sure to set JAVA_HOME, for example in your ~/.profile file. Also, I would recommend setting your JAVA_OPTS and GRAILS_HOME there. My ~/.profile looks like this:

export JAVA_HOME=/Library/Java/Home
export GRAILS_HOME=/app/grails
export JAVA_OPTS="-Xms256m -Xmx1280m -XX:MaxPermSize=850m -XX:MaxHeapFreeRatio=70 -XX:MaxGCPauseMillis=10 -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
export PATH=$JAVA_HOME/bin:$GRAILS_HOME/bin:/usr/local/share/python:$PATH

You can check where javac is located by issuing ls -al `which javac`, it’s probably a symlink to some other symlink. I also use /app/grails as a symlink to the current latest Grails version installed by homebrew.

Downloading and configuring the installer
Now, you are ready to run the installer. Check it out with git:
git checkout https://github.com/thehyve/transmartAppInstaller.git /app/transmart-dev/installer

The next step is to configure the installer using a file called setupTranSMARTDevelopment.properties. We will use the Mac OSX template as a starting point:

cd /app/transmart/installer/scripts
rm setupTranSMARTDevelopment.properties
cp setupTranSMARTDevelopment.properties.mac setupTranSMARTDevelopment.properties

Now, edit this file and configure the properties to match your environment. If you followed these instructions, most properties can actually stay at their defaults. The final step is then to execute the installer. Just to be sure, only do this when you have not yet installed tranSMART yet, because otherwise it will clean and overwrite your current setup.

./startup.sh

This will take a while (can amount to over 2 hours!)

When the installer is finished, you will have the major prerequisites for developing with the Postgres version of tranSMART. So the final step is to checkout the project itself, for example in /app/transmart/app:

git checkout https://github.com/transmart/transmartApp.git /app/transmart-dev/app
cd /app/transmart-dev/app
grails compile

Now you can start your local transmart instance by running i2b2 and tranSMART. One way to do this is opening 2 terminal windows, so you can monitor the output of both tools. These are the commands to run both tools:

cd /app/transmart/jboss
bin/run.sh

cd /app/transmart/app
grails run-app

When both tools are up and running, you should be able to browse your local tranSMART instance at http://localhost:8080/transmart. The next step if that works in then to install at least R and run Rserve, so that you can do some analyses, set up the ETL environment so that you can import your own data, install Solr to get the Search Explorer going, and install PLINK and GenePattern for some omics analyses. But that’s for some other posts.

Finally a word of advice, something I regret not giving during the hackathon because people ran into all kinds of problems with SpringSource STS – if you consider using an IDE to run the tranSMART application, I would highly recommend IntelliJ IDEA Ultimate Edition. You can get a free license for it if you work on open source projects (as is the case with tranSMART). It escapes me how the folks at SpringSource can write great tools like Grails and at the same time come up with an IDE as buggy, slow and hard to configure as SpringSource STS. I have tried it several times and never even got it to run a Grails project correctly. It’s a personal experience, but I’m definitely not the only Grails developer who feels this way.

Of course tranSMART is very much work in progress, in a few days we might not even need the i2b2 binaries anymore as my colleague Gustavo is working, as per our involvement in the CTMM TraIT project, on factoring out the calls to i2b2 to a lean tranSMART Core API and implementing the few calls that were still routed to the i2b2 ONT and CRC cells to a tranSMART implementation. The rationale of this is that the i2b2 schema’s are used all over the tranSMART code anyway, so it doesn’t make too much sense to still depend on the whole i2b2 codebase for these few calls. But again the full story is food for another post.

2 Responses to Set up a tranSMART Postgres development environment

  • Richard

    It might help users to know that you need grails 2.2.0 or later – otherwise it’s a bit annoying to only discover this after the script has run for an hour only to fail.

    I’m having problems starting the transmart app. JBoss starts fine, but when I try to start the transmart app I get the following error:

    | Error 2013-04-24 12:10:11,152 [localhost-startStop-1] ERROR context.GrailsContextLoader – Error initializing the application: Error creating bean with name ‘transactionManagerPostProcessor’: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’: Invocation of init method failed; nested exception is org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]
    Message: Error creating bean with name ‘transactionManagerPostProcessor’: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’: Invocation of init method failed; nested exception is org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]
    Line | Method
    ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
    – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
    | 166 | run in java.util.concurrent.FutureTask
    | 1146 | runWorker in java.util.concurrent.ThreadPoolExecutor
    | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
    ^ 679 | run . . . in java.lang.Thread

    Caused by BeanCreationException: Error creating bean with name ‘transactionManager’: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’: Invocation of init method failed; nested exception is org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]
    ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
    – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
    | 166 | run in java.util.concurrent.FutureTask
    | 1146 | runWorker in java.util.concurrent.ThreadPoolExecutor
    | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
    ^ 679 | run . . . in java.lang.Thread

    Caused by BeanCreationException: Error creating bean with name ‘sessionFactory’: Invocation of init method failed; nested exception is org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]
    ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
    – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
    | 166 | run in java.util.concurrent.FutureTask
    | 1146 | runWorker in java.util.concurrent.ThreadPoolExecutor
    | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
    ^ 679 | run . . . in java.lang.Thread

    Caused by NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]
    ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
    – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
    | 166 | run in java.util.concurrent.FutureTask
    | 1146 | runWorker in java.util.concurrent.ThreadPoolExecutor
    | 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
    ^ 679 | run . . . in java.lang.Thread

    • Kees van Bochove

      Hello Richard,

      Sorry I didn’t see your comment earlier – our spamfilter seems to need work…

      You are right about Grails – actually I modified the installation script so that it doesn’t need Grails anymore, it should only install the dependencies for tranSMART, and Rmodules is part of tranSMART itself.

      About the error you are getting: in 90% of the cases I have seen this error it was caused by tranSMART not reading in the configuration files. Check if they are present in ~/.grails/transmartConfig, and check if the tranSMART startup log has messages like:

      [INFO] Including configuration file [file:/Users/kees/.grails/transmartConfig/Config.groovy] in configuration building.
      [INFO] Including configuration file [file:/Users/kees/.grails/transmartConfig/RModulesConfig.groovy] in configuration building.
      [INFO] Including configuration file [file:/Users/kees/.grails/transmartConfig/DataSource.groovy] in configuration building.

      If the configuration files are read in correctly, but you still get this error, it could also be a syntax error in one of the files (check them in your IDE). Annoyingly, Grails doesn’t display a proper warning message at the default log level if there is one and just ignores the file contents. By the way, it is a good idea anyway to carefully go through the configuration files, e.g. if you are also going to run R analyses you need to make sure all paths are correct.

Leave a Reply

Your email address will not be published. Required fields are marked *

@TheHyveNL