OHDSI Home | Forums | Wiki | Github

Issues with WebAPI Installation -

We were following the installation guide laid down at http://www.ohdsi.org/web/wiki/doku.php?id=documentation:software:webapi:webapi_installation_guide

However, we faced an issue while deploying the webapi in tomcat. [Tomcat V 8.5]. We built the code using Maven 3.2.2

Error Log from TomCat -

Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘CDMResultsService’: Injection of
autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: private org.ohdsi.webapi.source.SourceRepository
org.ohdsi.webapi.service.AbstractDaoService.sourceRepository; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘sourceRepository’: Cannot create inner
bean ‘(inner bean)#229f3d21’ of type
[org.springframework.orm.jpa.SharedEntityManagerCreator] while setting
bean property ‘entityManager’; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name ‘(inner bean)#229f3d21’: Cannot resolve reference to bean
‘entityManagerFactory’ while setting constructor argument; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘entityManagerFactory’ defined in class
path resource [org/ohdsi/webapi/DataAccessConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at
org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:117)
at
org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:108)
at
org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:68)
at
org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
… 10 more
Caused by: org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private
org.ohdsi.webapi.source.SourceRepository
org.ohdsi.webapi.service.AbstractDaoService.sourceRepository; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘sourceRepository’: Cannot create inner
bean ‘(inner bean)#229f3d21’ of type
[org.springframework.orm.jpa.SharedEntityManagerCreator] while setting
bean property ‘entityManager’; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name ‘(inner bean)#229f3d21’: Cannot resolve reference to bean
‘entityManagerFactory’ while setting constructor argument; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘entityManagerFactory’ defined in class
path resource [org/ohdsi/webapi/DataAccessConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
at
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
… 29 more
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘sourceRepository’: Cannot create inner
bean ‘(inner bean)#229f3d21’ of type
[org.springframework.orm.jpa.SharedEntityManagerCreator] while setting
bean property ‘entityManager’; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name ‘(inner bean)#229f3d21’: Cannot resolve reference to bean
‘entityManagerFactory’ while setting constructor argument; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘entityManagerFactory’ defined in class
path resource [org/ohdsi/webapi/DataAccessConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1469)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1127)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1051)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
… 31 more
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘(inner bean)#229f3d21’: Cannot resolve
reference to bean ‘entityManagerFactory’ while setting constructor
argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name ‘entityManagerFactory’ defined in class path resource
[org/ohdsi/webapi/DataAccessConfig.class]: Bean instantiation via
factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at
org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:634)
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:299)
… 44 more
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘entityManagerFactory’ defined in class
path resource [org/ohdsi/webapi/DataAccessConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
… 52 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed
to instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
… 61 more
Caused by: org.hibernate.HibernateException: Access to
DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
at
org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:104)
at
org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:71)
at
org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:205)
at
org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
at
org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845)
at
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844)
at
org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
at
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
at
org.ohdsi.webapi.DataAccessConfig.entityManagerFactory(DataAccessConfig.java:93)
at
org.ohdsi.webapi.DataAccessConfig$$EnhancerBySpringCGLIB$$c94537c.CGLIB$entityManagerFactory$2()
at
org.ohdsi.webapi.DataAccessConfig$$EnhancerBySpringCGLIB$$c94537c$$FastClassBySpringCGLIB$$9af4fcb0.invoke()
at
org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at
org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at
org.ohdsi.webapi.DataAccessConfig$$EnhancerBySpringCGLIB$$c94537c.entityManagerFactory()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
… 62 more

27-Dec-2016 17:45:45.839 SEVERE [localhost-startStop-2]
org.apache.catalina.startup.HostConfig.deployWAR Error deploying web
application archive C:\Program Files\Apache Software Foundation\Tomcat
8.5\webapps\WebAPI.war
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebAPI]]
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Can you please assist in resolving this issue?

Access to DialectResolutionInfo cannot 
be null when 'hibernate.dialect' not set 

Usually comes from a bad connection string to your database. Please verify your settings that they can connect to the database. If you have a tool (ex: SQL Workbench) that can connect to the database server using JDBC connection strings, you should test your settings using this.

Hi Chrsiknoll,
I am also facing same issue.
I can connect with database using jdbc with sql workbench. And also i make sure connection via python jdbc as well. PFB

from sqlalchemy import create_engine
engine = create_engine(‘postgresql://ohdsi_admin_user:admin1@localhost/OHDSI’)
result = engine.execute(“select * from test”)
for row in result:
… print row

(1, u’Mahesh’)
Best Regards,
Mahesh Sankaran

Can you please post the following info from your settings.xml file that you created from the webAPI install instructions. Example from the instructions this:

<profiles>
  <profile>
    <id>webapi-postgresql</id>
    <properties>
      <datasource.driverClassName>org.postgresql.Driver</datasource.driverClassName>
      <datasource.url>jdbc:postgresql://localhost:5432/OHDSI</datasource.url>
      <datasource.username>ohdsi_app_user</datasource.username>
      <datasource.password>app1</datasource.password>
      <datasource.dialect>postgresql</datasource.dialect>
      <datasource.ohdsi.schema>webapi</datasource.ohdsi.schema>
      <flyway.datasource.driverClassName>${datasource.driverClassName}</flyway.datasource.driverClassName>
      <flyway.datasource.url>${datasource.url}</flyway.datasource.url>
      <flyway.datasource.username>ohdsi_admin_user</flyway.datasource.username>
      <flyway.datasource.password>!PASSWORD!</flyway.datasource.password>
      <flyway.locations>classpath:db/migration/postgresql</flyway.locations>
    </properties> 
  </profile>  
</profiles>

Next, please execute the following statements as your ohdsi admin account:

CREATE TABLE webapi.TEST_TABLE  (
	TEST_ID BIGINT  NOT NULL PRIMARY KEY ,
	TEST_NAME VARCHAR(100) NOT NULL
) 

Note, this assumes your webapi schema is set to ‘webapi’. change the above query to the correct schema.

If this command completes successfully, you can drop the table:

DROP TABLE webapi.TEST_TABLE

Please report any errors you receive. Also, when you post your information please surround your information with 3 ` marks so that the content is easier to read (it will make a formatted code block which makes XML reading easier, and any error messages you recieve). Thank you!

-Chris

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Hi Chris_Knoll,

Thanks for quick reply!
I am able to create webapi.TEST_TABLE I dont see any error while creating table.
Following is my settings.xml file.



webapi-postgresql

org.postgresql.Driver
jdbc:postgresql://localhost/OHDSI
ohdsi_app_user
app1
postgresql
webapi
${datasource.driverClassName}
${datasource.url}
ohdsi_admin_user
admin1
classpath:db/migration/postgresql
 
 

Best Regards,
Mahesh Sankaran

Your settings look correct, and if you can create the test table, then the account has permissions.

I forgot to ask this as a follow up test: can you use the ‘ohdsi_app_user’ to connect to the database via JDBC and then attempt to query your created webapi.TEST_TABLE like so:

SELECT * FROM webapi.TEST_TABLE

This will confirm the ohdsi_app_user configuration. Could you completely clear out your tomcat log, restart the service, and attach the entire log to a post (or host on a google drive and share the link) so that I can see if there’s anything that is happening during startup that looks out of the ordinary.

-Chris

Hi Chris,

As you mentioned, Now i tried select query with ohdsi_app_user, It is working fine.
And then i cleared tomcat logs and restarted tomcat service.
Please find the logs from below URL.

https://drive.google.com/file/d/0B2uffhQK0RUcUzhZUmtyeEhPUDA/view

Best Regards,
Mahesh Sankaran

So was the fix to add the settings tag to settings.xml or did you still need to add values to application.properties?

I’d just like to understand what part of the instructions weren’t clear so that we can avoid others having this issue.

t