# Hibernate error while installing OpenMRS

**URL:** <https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036>\
**Category:** Ask OpenMRS\
**Created:** [August 24, 2017, 11:54am UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036 "2017-08-24T11:54:44Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 24, 2017, 11:54am UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/1 "2017-08-24T11:54:45Z")

</div>

**Application Name:** Platform **Version Number:** 2.0.5

**Question:** I’m try to install and configure an OpenMRS Platform version 2.0.5 on a Digital Ocean droplet (Ubuntu 16.04.3). I had a server previously running on the same droplet and it was working smoothly. I deleted the previous server recently and wanted to install a new one. I followed the same install steps as before per the installation guide.

However, after completing the Initial setup wizard steps, I get the following error.

HTTP Status 500 - Could not open Hibernate Session; nested exception is org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider]

Stack trace of error from tomcat logs:

> Aug 24, 2017 2:54:22 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [default] in context with path [/openmrs] threw exception org.springframework.dao.DataAccessResourceFailureException: Could not open Hibernate Session; nested exception is org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider] at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.openSession(OpenSessionInViewFilter.java:208) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:139) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:221) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider] at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:201) at org.hibernate.internal.AbstractSessionImpl.getJdbcConnectionAccess(AbstractSessionImpl.java:341) at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.(JdbcCoordinatorImpl.java:114) at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.(TransactionCoordinatorImpl.java:89) at org.hibernate.internal.SessionImpl.(SessionImpl.java:258) at org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1589) at org.hibernate.internal.SessionFactoryImpl.openSession(SessionFactoryImpl.java:999) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.openSession(OpenSessionInViewFilter.java:203) … 32 more

I double checked my openmrs-runtime.properties file. This is what it has,

> #Auto generated by OpenMRS initialization wizard #Thu Aug 24 11:11:21 UTC 2017 encryption.vector=GDL/T4omuNYBG2USCEAorg== connection.url=jdbc:mysql://localhost:3306/openmrs?autoReconnect=true&sessionVariables=default\_storage\_engine=InnoDB&useUnicode=true&characterEncoding=UTF-8 module.allow\_web\_admin=true connection.username=openmrs\_user auto\_update\_database=true encryption.key=6epwP23Kfo5jnLYxyssj3w== connection.password=mvTHKowT4zxJ

I’ve uploaded my server log file below

[openmrs.log.txt](https://talk.openmrs.org/uploads/default/original/2X/8/8988c9c0311dbc8b0e4ff79ec4c7a4514e54942a.txt) (91.9 KB)

Really can’t understand what’s causing this issue or how to fix it. Help is much appreciated!

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [August 24, 2017, 12:09pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/2 "2017-08-24T12:09:20Z")

</div>

Is the legacyui module installed and started?

---

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 24, 2017, 12:37pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/3 "2017-08-24T12:37:13Z")

</div>

I haven’t even got to that point yet. There are no modules in the modules folder of the server

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [August 24, 2017, 12:53pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/4 "2017-08-24T12:53:36Z")

</div>

How exactly are you doing this installation? When i see something like this in your log “java.io.FileNotFoundException: /var/lib/tomcat7/webapps/openmrs/WEB-INF/view/module/webservices/rest/resources.jsp” i get tempted to think that you could still be using an old installation that already had modules expanded in the webapp folder.

---

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 24, 2017, 1:16pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/5 "2017-08-24T13:16:27Z")

</div>

Install steps:

1. Installed all pre-requisites: Java 1.8, Tomcat7, MySql 5.6, Firefox
2. Created a directory /var/lib/OpenMRS and gave ownership of that directory to tomcat7
3. Downloaded the platform v 2.0.5 war file from sourceforge
4. Unzipped the files into a folder called openmrs into my tomcat7 webapps folder (at /var/lib/tomcat7/webapps)
5. Restarted tomcat
6. Checked to see that openmrs was deployed on my tomcat manager console, it was
7. Went to :8080/openmrs
8. Followed initial setup with the following initial conditions:

> OpenMRS 2.0.5 Installation Wizard

> Review All required input has been collected and is ready to be processed. Click the “finish” button to create tables, data, etc. This could take up to several minutes. When complete you will be taken to the OpenMRS main screen. Database Database connection jdbc:mysql://localhost:3306/@DBNAME@?autoReconnect=true&sessionVariables=default\_storage\_engine=InnoDB&useUnicode=true&characterEncoding=UTF-8 Database name openmrs Create database Yes Create database user account Yes Create tables Yes Add demo data No Implementation information Implementation name Intelehealth AFI testing env Implementation ID AFI\_TEST Implementation pass phrase

> Implementation description

> Runtime properties Enable uploading modules from the web interface Yes Update the database automatically on start up when a new release is deployed Yes Runtime properties file path /var/lib/OpenMRS/openmrs-runtime.properties

The wizard was able to successfully create a database and database tables.

The following files and directories were created in my /var/lib/OpenMRS directory,

> activemq-data  
> liquibaseUpdateLogs.txt  
> modules  
> openmrs-runtime.properties  
> person\_images chartsearch  
> lucene  
> openmrs.log  
> owa

Note: Modules folder is empty.

After these steps are completed by the wizard, I get this error.

---

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 24, 2017, 1:43pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/6 "2017-08-24T13:43:52Z")

</div>

Usually once the wizard completes its steps a screen saying that openmrs has been successfully installed and that no UI module was found. At this point I put the module omod files into the directory

I am not getting to that screen at all.

---

<div class="post-metadata">

**Author:** ![tendomart](https://talk.openmrs.org/user_avatar/talk.openmrs.org/tendomart/32/6753_2.png) [@tendomart](https://talk.openmrs.org/u/tendomart)\
**Post date:** [August 24, 2017, 1:56pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/7 "2017-08-24T13:56:25Z")

</div>

@ngoel2 you mechanicallly dropped the omods into the installation?

---

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 24, 2017, 2:03pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/8 "2017-08-24T14:03:53Z")

</div>

Clarification:

After completing install steps mentioned above, the wizard runs through its steps and usually reaches this screen

 ![](https://talk.openmrs.org/uploads/default/original/2X/2/26c9de816608c81db838b09f07d406a14046c9c1.png)

After this screen is reached I mechanically drop the omod files into the installation and restart tomcat. However, I got this error before I dropped the modules in. So at the point the error occured, there were no modules in the server’s modules folder.

---

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 24, 2017, 2:19pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/9 "2017-08-24T14:19:39Z")

</div>

UPDATE: After you mentioned about installing and starting the legacy UI module, I dropped all default ref app 2.6 distro modules into the modules folder, including the legacy UI module.

Here are the steps I followed:

1. dropped all omod files into /var/lib/OpenMRS/modules
2. restarted tomcat
3. reloaded [ip-address]:8080/openmrs

Now I get this error:

> The following error occurred at startup: Unable to start OpenMRS. Error thrown was: org.openmrs.module.ModuleException: Unable to initialize servlet: org.openmrs.web.dwr.OpenmrsDWRServlet@3f70456d Module: legacyui org.openmrs.module.ModuleException: Unable to start OpenMRS. Error thrown was: org.openmrs.module.ModuleException: Unable to initialize servlet: org.openmrs.web.dwr.OpenmrsDWRServlet@3f70456d Module: legacyui at org.openmrs.web.WebDaemon.startOpenmrs(WebDaemon.java:65) at org.openmrs.web.Listener.contextInitialized(Listener.java:196) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1259) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1998) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: javax.servlet.ServletException: org.openmrs.module.ModuleException: Unable to initialize servlet: org.openmrs.web.dwr.OpenmrsDWRServlet@3f70456d Module: legacyui at org.openmrs.web.Listener.startOpenmrs(Listener.java:276) at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42) Caused by: org.openmrs.module.ModuleException: Unable to initialize servlet: org.openmrs.web.dwr.OpenmrsDWRServlet@3f70456d Module: legacyui at org.openmrs.module.web.WebModuleUtil.loadServlets(WebModuleUtil.java:478) at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:709) at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:637) at org.openmrs.web.Listener.startOpenmrs(Listener.java:268) … 1 more Caused by: javax.servlet.ServletException: java.io.IOException: Missing config file: ‘/WEB-INF/dwr-modules.xml’ at org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:90) at org.openmrs.web.dwr.OpenmrsDWRServlet.init(OpenmrsDWRServlet.java:46) at org.openmrs.module.web.WebModuleUtil.loadServlets(WebModuleUtil.java:474) … 4 more Caused by: java.io.IOException: Missing config file: ‘/WEB-INF/dwr-modules.xml’ at org.directwebremoting.impl.DwrXmlConfigurator.setServletResourceName(DwrXmlConfigurator.java:83) at org.directwebremoting.impl.ContainerUtil.configureFromInitParams(ContainerUtil.java:296) at org.directwebremoting.impl.ContainerUtil.configureContainerFully(ContainerUtil.java:412) at org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:79) … 6 more

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [August 24, 2017, 2:52pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/10 "2017-08-24T14:52:59Z")

</div>

Can you check to see if that file really does not exist? Or does it exist but a permission restriction.

---

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 24, 2017, 3:44pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/11 "2017-08-24T15:44:43Z")

</div>

The file ‘dwr-modules.xml’ does not exist at /WEB-INF

Only the following files exist in that directory:

> bundledModules classes lib openmrs\_static\_content-servlet.xml view web.xml

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [August 25, 2017, 7:30am UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/12 "2017-08-25T07:30:58Z")

</div>

Can you ensure that this process or tomcat has permission to create files in that directory?

---

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 25, 2017, 10:22am UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/13 "2017-08-25T10:22:27Z")

</div>

Yes it does. I had given ownership of that directory to tomcat.

UPDATE: I thought it may be a permissions problem with the application directory since I was running the application at /var/lib/OpenMRS. So I followed this Talk post and redeployed the application at /usr/share/tomcat7/.OpenMRS.

> [@What's the recommended OpenMRS application directory?](https://talk.openmrs.org/t/whats-the-recommended-openmrs-application-directory/3461):
>
> Hi there, I am installing openmrs 1.11.4 on tomcat7 OS: Ubuntu 14.04 64bit Java: Open JDK 1.7.0\_85 Tomcat: 7 (package 7.0.52-1ubuntu0.3) Mysql: 5.5.46 In the install guide [https://wiki.openmrs.org/display/docs/Step+3+-+Install+Tomcat](https://wiki.openmrs.org/display/docs/Step+3+-+Install+Tomcat) it says to create /usr/share/tomcat6/.OpenMRS for user tomcat6. I did the same just for tomcat7, but then openmrs wizard does not let me install because it cannot find the openmrs-runtime.properties. I now create /var/lib/OpenMRS for user tomcat7 and installat…

This took care of a lot of the warnings I was getting in my log files where openmrs kept looking for files in the /usr/share/tomcat7 directory, not finding them and falling back to the /var/lib directory.

But it did not solve the problem. I am still getting the same error.

I’m wondering what I’m doing wrong!

Directory permissions:

> /usr/share/tomcat7# ls -l -a

> drwxr-xr-x 6 root root 4096 Aug 24 15:13 . drwxr-xr-x 134 root root 4096 Aug 18 04:24 … drwxr-xr-x 2 root root 4096 Aug 7 16:50 bin -rw-r–r-- 1 root root 39 Feb 18 2016 defaults.md5sum -rw-r–r-- 1 root root 1958 Feb 18 2016 defaults.template drwxr-xr-x 2 root root 4096 Aug 7 16:50 lib -rw-r–r-- 1 root root 53 Feb 18 2016 logrotate.md5sum -rw-r–r-- 1 root root 118 Feb 18 2016 logrotate.template **\> drwxr-xr-x 9 tomcat7 tomcat7 4096 Aug 24 17:10 .OpenMRS** drwxr-xr-x 4 root root 4096 Aug 7 16:52 skel

---

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 26, 2017, 2:02am UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/14 "2017-08-26T02:02:04Z")

</div>

Still facing this problem!!! @dkayiwa - any suggestions??

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [August 26, 2017, 5:11pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/15 "2017-08-26T17:11:48Z")

</div>

Do you think you can get some time and ping me on IRC?

---

<div class="post-metadata">

**Author:** ![ngoel2](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ngoel2/32/1990_2.png) [@ngoel2](https://talk.openmrs.org/u/ngoel2)\
**Post date:** [August 28, 2017, 1:41pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/16 "2017-08-28T13:41:43Z")

</div>

@dkayiwa - I was able to fix the issue, it turned out to be a permissions problem after all.

I had downloaded the ref app distro omod files from sourceforge as a zip file and used the sudo command to unzip them into the OpenMRS server’s modules folder. Because I had used sudo, the ownership of the omod files was root and not tomcat7. Running chown and assigning the ownership to tomcat7 solved the error.

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [August 28, 2017, 1:55pm UTC](https://talk.openmrs.org/t/hibernate-error-while-installing-openmrs/13036/17 "2017-08-28T13:55:46Z")

</div>

@ngoel2 Excellent! Thanks for diving into it and reporting back. 🙂
