Installing a new version of Open Clinica on an Ubuntu 12.10 desktop installation.
The hope is to then install this on a SuSE machine which already has a number of Open Clinica instances installed.
This involves creating a .war file with an instance specific name, we will use pets.war.
Register at openclinica.com. Download .zip
Looks like the installation notes are based on something other than
the one true distribution; so taking some notes.
You cannot install the default Postgresql. It won't work.
Ensure you have completely removed all traces of Postgresql 9!
The following should show no results:
dpkg -l |grep postgres
Follow the installation of postgresql instructions at
OpenClinica.
sudo chown -R postgres:postgres /opt/PostgreSQL/8.4/
Unpack and copy to expected location:
sudo mv OpenClinica-3.1.3 /usr/local/
sudo ln -s OpenClinica-3.1.3 oc
cd /usr/local/oc
Create database user and database in Postgres:
sudo su postgres
/opt/PostgreSQL/8.4/bin/psql -U postgres -c "CREATE ROLE clinica LOGIN ENCRYPTED PASSWORD 'clinica' SUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE"
/opt/PostgreSQL/8.4/bin/psql -U postgres -c "CREATE DATABASE pets WITH ENCODING='UTF8' OWNER=clinica"
Generate password with Password gorilla, but do not include punctuation.
Change password:
sudo su postgres
/opt/PostgreSQL/8.4/bin/psql -U postgres
ALTER USER clinica WITH PASSWORD 'XXXX';
Undocumented
Create a data directory with the webapp name.
sudo mkdir /usr/share/tomcat7/pets.data
sudo chown tomcat7:tomcat7 /usr/share/tomcat7/pets.data
The way it is recommended you deploy is pretty awful, to paraphrase:
Unzip the .war copy to tomcat webapps directory, edit in place.
This may work on a Wednesday, but is not the right way®.
So what we will do is unpack the .war, stash in git.
then build a new .war.
Ideally this would be by using the Maven War Overlay Plugin,
but we might get it to work by creating the war manually.
cd /usr/local/oc
git init
emacs distribution/OpenClinica/WEB-INF/classes/datainfo.properties
You must modify the following:
dbPass=XXXX
adminEmail=admin@example.com
but you probably also need to setup mail sending.
When you have edited these properties, create a .war file,
which we will call pets.war
cd /usr/local/oc/distribution/OpenClinica/
jar -cvf ../pets.war *
Deploy:
sudo /etc/init.d/tomcat7 stop
sudo cp pets.war /var/lib/tomcat7/webapps/
sudo /etc/init.d/tomcat7 start
At this point you will need to allow yourself to manage Tomcat7, as it comes secured.
Add the following to /etc/tomcat7/tomcat-users.xml.
<role rolename="manager-gui" />
<role rolename="manager-status" />
<role rolename="manager-script" />
<role rolename="manager-jmx" />
<role rolename="admin-gui" />
<role rolename="admin-script" />
<user username="admin" password="admin" roles="manager-gui, manager-status, admin-gui"/>
Unfortunately there is a problem (from localhost.date.log):
Feb 01, 2013 4:16:04 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.akaza.openclinica.dao.core.OCContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/akaza/openclinica/applicationContext-core-db.xml]: Invocation of init method failed; nested exception is liquibase.exception.MigrationFailedException: Migration failed for change set migration/2.5/changeLogCreateTables.xml::1235684743487-0::pgawade (generated):
Reason: liquibase.exception.JDBCException: Error executing SQL DROP LANGUAGE IF EXISTS plpgsql;
CREATE PROCEDURAL LANGUAGE plpgsql;
SET check_function_bodies = false;
SET client_min_messages = error;
SET default_tablespace = '';
SET default_with_oids = true;
SET search_path = public, pg_catalog;
COMMENT ON SCHEMA public IS 'Standard public schema';:
Caused By: Error executing SQL DROP LANGUAGE IF EXISTS plpgsql;
CREATE PROCEDURAL LANGUAGE plpgsql;
SET check_function_bodies = false;
SET client_min_messages = error;
SET default_tablespace = '';
SET default_with_oids = true;
SET search_path = public, pg_catalog;
COMMENT ON SCHEMA public IS 'Standard public schema';:
Caused By: ERROR: cannot drop language plpgsql because extension plpgsql requires it
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.akaza.openclinica.dao.core.OCContextLoaderListener.contextInitialized(OCContextLoaderListener.java:38)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Apparently this can be fixed:
sudo /etc/init.d/tomcat7 stop
sudo su postgres
psql -U postgres
DROP EXTENSION plpgsq;
\q
exit
sudo /etc/init.d/tomcat7 start
At this point I discover that OpenClinica does not work with Postgresql 9.1!!
Blogs are difficult to represent a process.
I have updated the above so you won't encounter this error.
You may well see the following, which is a success message !
SEVERE: Servlet /pets threw load() exception
javax.servlet.ServletException: missing jspFile
at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:123)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
http://localhost:8080/pets/ takes me to a login screen.
You can now login with a username of root and a one time password of 12345678.