OHDSI Home | Forums | Wiki | Github

Could not start WebAPI on Tomcat (ATLAS)


(mintmountain89) #1

Hi,

I’ve tried following the instructions to trying to configure the WebAPI but could not get the WebAPI.war file to run on Tomcat. Pl find the error below:

FAIL - Application at context path [/WebAPI] could not be started
FAIL - Encountered exception [org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebAPI]]]

Here I send the script of the error captured in log:
Thank you
Hui Xing

09-Aug-2018 19:00:26.381 SEVERE [main] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebAPI]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:742)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1858)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:772)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1585)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:966)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘shiroFilter’ defined in class path resource [org/ohdsi/webapi/ShiroConfiguration.class]: Unsatisfied dependency expressed through method ‘shiroFilter’ parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flyway’ defined in class path resource [org/ohdsi/webapi/FlywayConfig.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:235)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:702)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:527)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131)
at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5098)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
… 38 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flyway’ defined in class path resource [org/ohdsi/webapi/FlywayConfig.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
… 60 more
Caused by: org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource
at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)
at org.flywaydb.core.Flyway.execute(Flyway.java:1287)
at org.flywaydb.core.Flyway.migrate(Flyway.java:919)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1758)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1695)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
… 73 more
Caused by: org.postgresql.util.PSQLException: Connection to 54.209.111.128:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:239)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:127)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:29)
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.(AbstractJdbc3gConnection.java:21)
at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connection.java:41)
at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:414)
at org.postgresql.Driver.connect(Driver.java:282)
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:310)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203)
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:732)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:664)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:479)
at org.apache.tomcat.jdbc.pool.ConnectionPool.(ConnectionPool.java:154)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131)
at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:50)
… 82 more
Caused by: java.net.ConnectException: Operation timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.postgresql.core.PGStream.(PGStream.java:61)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:121)
… 100 more

09-Aug-2018 19:00:26.382 SEVERE [main] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/Users/tankh/tomcat/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:746)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:986)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1858)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:772)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1585)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:308)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:966)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)


(Vikram) #2

Hi

Have you updated the settings.xml file with your database details including username and password?


(mintmountain89) #3

Hi @vkramdev ! Thanks for the reply

By settings.xml, are you referring to the settings.xml file that was saved in WebAPIConfig folder, i.e.

I had copied and pasted the same text, then changed the port to 5433 (as per PostgreSQL settings (see below) into a notepad and saved as settings.xml inside the WebAPIConfig folder:

Please feel free to let me know if there is something I’m missing out here, thank you!

Regards,
Hui Xing


(Chris Knoll) #4

org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource

that definitely indicates there is a problem connecting to the database. To confirm you built the .war file with the correct credentials, you can look at the WebAPI.war file in /Users/tankh/tomcat/webapps/WebAPI.war, look at the file called ‘application.properties’ under the /WEB-INF/classes folder under the .war root. If that file contains the correct settings for your environment, looking like this:

#Primary DataSource
datasource.driverClassName=${datasource.driverClassName}
datasource.url=${datasource.url}
datasource.username=${datasource.username}
datasource.password=${datasource.password}
datasource.dialect=${datasource.dialect}
datasource.ohdsi.schema=${datasource.ohdsi.schema}
datasource.dialect.source=${datasource.dialect.source}

...

#Flyway database change management.
#DataSource for Change Managment / Migration
flyway.enabled=true
flyway.datasource.driverClassName=${datasource.driverClassName}
flyway.datasource.url=${datasource.url}
flyway.datasource.username=${flyway.datasource.username}
flyway.datasource.password=${flyway.datasource.password}

The values to your server should be replaced with the real values in your war’s /WEB-INF/classes/application.properties file.

As a secondary test, you should try to connect using a JDBC client to your postgresql server using something like ‘SqlWorkbench’. It could be somethign malformed in your jdbc url.

-Chris


(Kwang Soo Jeong) #5
Connection to 54.209.111.128:5432 refused

Hello.

This error appears to be preventing the remote server from accepting the connection. If you have just installed PostgreSQL for the first time, try the following changes in the postgresql.conf file.

listen_addresses = '*'

(mintmountain89) #6

Hi @Chris_Knoll!

Thanks for this. I looked into application.properties’ under the /WEB-INF/classes folder and indeed the values to my server (i.e. port 5433, username = ohdsi_admin_user, etc) are not inside.

However, I had changed it in the settings.xml file of the WebAPIConfig folder before navigating to WebAPI folder and executing the maven code:

where {profile id} is changed to webapi-postgresql

I’m not sure why the settings were not reflected in the WebAPI.war file when it was built. Might it be because I had saved the WebAPIConfig folder in the WebAPI folder instead of the root folder? The maven code couldn’t execute unless I moved the WebAPIConfig folder to the WebAPI folder.

Also, must the WebAPI.war folder be located under tomcat/webapps? Currently it is located in WebAPI/target folder

Thanks much!

Regards,
Hui Xing


(mintmountain89) #7

Thanks @NEONKID, will try it out!

Regards,
Hui Xing


(Chris Knoll) #8

Try without a space between the -P and the profile Id: -Pwebapi-postgresql. Also, @NEONKID did point out that the ip address it’s trying to connect to looks like it might have gotten that setting out of your settings.xml, so I’m a bit confused why you don’t see those settings in your application.prroperties…

As far as the question about the ‘target’ folder, that’s the default location that the MVN command builds into. Then you take the .war file out of /target and use it to deploy to the tomcat instance.

The maven code couldn’t execute unless I moved the WebAPIConfig folder to the WebAPI folder.

Right, I believe you put the WebAPIConfig folder as a subfolder from where you execute the MVN command, and you execute the MVN command from the root of the WebAPI repository.

-Chris


(Vikram) #9

Hi @hui_xing_tan

You may want to refer to this WebAPI PostgreSQL Installation question on the forum. It seems to address the same issue.


(mintmountain89) #10

@Chris_Knoll @vkramdev

Thanks for the helpful advice and links, I tried a couple of things and it works now:

  1. Executing maven command without a space between the -P and the profile Id: -Pwebapi-postgresql
  2. Changes the values to my server from localhost or 54.209.111.128 to 127.0.0.1
  3. Changed the settings in WebAPI/pom.xml file to match those in WebAPIConfig/settings.xml

settings.xml:

<settings>
<profiles>
  <profile>
    <id>webapi-postgresql</id>
    <properties>
      <datasource.driverClassName>org.postgresql.Driver</datasource.driverClassName>
      <datasource.url>jdbc:postgresql://127.0.0.1:5433/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>admin1</flyway.datasource.password>
      <flyway.locations>classpath:db/migration/postgresql</flyway.locations>
      <security.enabled>false</security.enabled>
      <security.token.expiration>43200</security.token.expiration>
      <security.origin>*</security.origin>
      <security.ssl.enabled>false</security.ssl.enabled>
      <security.oauth.callback.ui>http://localhost/atlas/#/welcome</security.oauth.callback.ui>
      <security.oauth.callback.api>http://localhost:8080/WebAPI/user/oauth/callback</security.oauth.callback.api>
      <security.oauth.google.apiKey></security.oauth.google.apiKey>
      <security.oauth.google.apiSecret></security.oauth.google.apiSecret>
      <security.oauth.facebook.apiKey></security.oauth.facebook.apiKey>
      <security.oauth.facebook.apiSecret></security.oauth.facebook.apiSecret>
    </properties> 
  </profile>  
</profiles>
</settings>

pom.xml:



webapi-postgresql

<datasource.driverClassName>org.postgresql.Driver</datasource.driverClassName>
<datasource.url>jdbc:postgresql://127.0.0.1:5433/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>admin1</flyway.datasource.password>
<flyway.schemas>${datasource.ohdsi.schema}</flyway.schemas>
<flyway.placeholders.ohdsiSchema>${datasource.ohdsi.schema}</flyway.placeholders.ohdsiSchema>
<flyway.locations>classpath:db/migration/postgresql</flyway.locations>
<spring.batch.repository.tableprefix>${datasource.ohdsi.schema}.BATCH_</spring.batch.repository.tableprefix>
<hibernate.dialect>org.hibernate.dialect.PostgreSQL9Dialect</hibernate.dialect>
<security.db.datasource.url>${datasource.url}</security.db.datasource.url>
<security.db.datasource.driverClassName>${datasource.driverClassName}</security.db.datasource.driverClassName>
<security.db.datasource.username>${datasource.username}</security.db.datasource.username>
<security.db.datasource.password>${datasource.password}</security.db.datasource.password>
<security.db.datasource.authenticationQuery>select password from ${security.db.datasource.schema}.users_data where
lower(email) = lower(?)</security.db.datasource.authenticationQuery>

After rebuilding the .war file I deployed it on Tomcat and the tables are now showing in PostgreSQL

Not too sure the details behind it though…For example what is the difference between localhost, 54.209.111.128 and 127.0.0.1? And why settings.xml and pom.xml have to match. If anyone can enlighten here I’d be most grateful :smile:

Thanks for all the help
Regards,
Hui Xing


(Chris Knoll) #11

A few things:
You shouldn’t change things directly in pom.xml. The reason for this is that the pom.xml contains the set of default values which should be overriden in settings.xml. If we add new things to pom.xml, you will have conflicts with the edits you made in your pom.xml and the changes we made for a new release. The idea about having a settings.xml document is that it lets you make the changes to the pom.xml values, without changing the pom.xml file. So you might want to try this again, just using the default pom.xml file, with your updates in settings.xml, and see if the maven command properly builds your WebAPI.war file with your settings.

127.0.0.1 is a ‘loopback’ interface and it’s a way of saying ‘myself’ while 54.209.111.128 is a network ip, which goes through a dfferent network layer. The reason one might work over the other is that by default the DB server may allow connections from 127.0.0.1, but not from a network address.

A lot of all this depends on how you installed your software and your network configuration (like firewalls), so I can’t tell you definitively why one configuration may work for you over another.


(Kwang Soo Jeong) #12

More information is needed to resolve this issue.
For example, whether the computer on which PostgreSQL software is currently installed is the same computer that installed ATLAS or not.

If you are on the same computer, you can use 127.0.0.1 or localhost to point to itself, as @Chris_Knoll says. In this case, the connection works smoothly in any network environment.

However, if PostgreSQL and ATLAS are installed on different computers, you will not be able to use 127.0.0.1 or localhost, and you will be affected by your current network environment (firewall, etc.). There are also some additional settings that need to be made.

When I first replied, I thought that ATLAS and PostgreSQL would be installed on different machines, so I advised them to modify the postgresql.conf file. If it is not, this part has no effect.

Please check this point.


(mintmountain89) #13

I see, thanks! I’ve tried to use back the default pom.xml file but the maven command dosen’t build the WebAPI file with the updates in the settings.xml. Instead it uses those in the default pom.xml

Would it be possible to use the WebAPI file built from the pom.xml that was updated or will it cause problems in the future? Thanks!


(mintmountain89) #14

Hi @NEONKID

Ok, I’m installing them on the same machine for now just to test out. By different computers do you mean a computer with the central database server (PostgreSQL, for example) installed and a separate one that’s running the WebAPI on Tomcat?

Thanks!
Hui Xing


(Kwang Soo Jeong) #15

That’s right.

If you want to test WebAPI and DBMS using the same machine, you can write 127.0.0.1 or localhost to the datasource address. In case of pom.xml, it will be used as the basic configuration file of WebAPI.

If you want to use a file other than pom.xml (eg settings.xml or others) as a configuration file, you must use the “-s” option of the mvn command.


(Chris Knoll) #16

You shouldn’t need to do it this way. it’s very odd that the -s option to specify the settings file. You should really keep at this and figure out where the mistake is, because it’s critical that people be able to specify ‘sensitive’ information in a separate file. Maybe pass the full path to the file? If you’re on mac or linux, the file is case-sensitive…

When you run your MVN command, so you see anything in the output (it will be one of the first few lines of output) indicating that it could not read your settings file?


(mintmountain89) #17

@NEONKID @Chris_Knoll

Ah yes, i’ve tried with the -s option and it still uses the pom.xml settings

There some warnings when I built the file, please see below:

[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Expected root element ‘settings’ but found ‘w:wordDocument’ (position: START_TAG seen … w:embeddedObjPresent=“no” w:ocxPresent=“no” xml:space=“preserve”>… @3:543) @ /WebAPI/WebAPIConfig/settings.xml, line 3, column 543
[WARNING]
[INFO] Scanning for projects…
[INFO]
[INFO] --------------------------< org.ohdsi:WebAPI >--------------------------
[INFO] Building WebAPI 1.0.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
Downloading from ohdsi.thirdparty: http://repo.ohdsi.org:8085/nexus/content/repositories/thirdparty/org/ohdsi/sql/SqlRender/1.5.1-SNAPSHOT/maven-metadata.xml
Downloading from ohdsi: http://repo.ohdsi.org:8085/nexus/content/repositories/releases/org/ohdsi/sql/SqlRender/1.5.1-SNAPSHOT/maven-metadata.xml
Downloading from central: http://repo.maven.apache.org/maven2/org/ohdsi/sql/SqlRender/1.5.1-SNAPSHOT/maven-metadata.xml
Downloading from ohdsi.snapshots: http://repo.ohdsi.org:8085/nexus/content/repositories/snapshots/org/ohdsi/sql/SqlRender/1.5.1-SNAPSHOT/maven-metadata.xml
Downloading from redshift: http://redshift-maven-repository.s3-website-us-east-1.amazonaws.com/release/org/ohdsi/sql/SqlRender/1.5.1-SNAPSHOT/maven-metadata.xml
Downloading from odysseus.community.snapshots: http://repo.odysseusinc.com/artifactory/community-libs-snapshot-local/org/ohdsi/sql/SqlRender/1.5.1-SNAPSHOT/maven-metadata.xml
Downloaded from ohdsi.snapshots: http://repo.ohdsi.org:8085/nexus/content/repositories/snapshots/org/ohdsi/sql/SqlRender/1.5.1-SNAPSHOT/maven-metadata.xml (1.2 kB at 1.1 kB/s)
Downloaded from odysseus.community.snapshots: http://repo.odysseusinc.com/artifactory/community-libs-snapshot-local/org/ohdsi/sql/SqlRender/1.5.1-SNAPSHOT/maven-metadata.xml (334 B at 209 B/s)
Downloading from central: http://repo.maven.apache.org/maven2/commons-io/commons-io/maven-metadata.xml
Downloading from ohdsi.thirdparty: http://repo.ohdsi.org:8085/nexus/content/repositories/thirdparty/commons-io/commons-io/maven-metadata.xml
Downloading from ohdsi: http://repo.ohdsi.org:8085/nexus/content/repositories/releases/commons-io/commons-io/maven-metadata.xml
Downloading from ohdsi.snapshots: http://repo.ohdsi.org:8085/nexus/content/repositories/snapshots/commons-io/commons-io/maven-metadata.xml
Downloading from springsource.releases: http://repo.springsource.org/release/commons-io/commons-io/maven-metadata.xml
Downloading from redshift: http://redshift-maven-repository.s3-website-us-east-1.amazonaws.com/release/commons-io/commons-io/maven-metadata.xml
Downloading from odysseus.community.snapshots: http://repo.odysseusinc.com/artifactory/community-libs-snapshot-local/commons-io/commons-io/maven-metadata.xml
Downloaded from central: http://repo.maven.apache.org/maven2/commons-io/commons-io/maven-metadata.xml (783 B at 1.3 kB/s)
Downloading from odysseus.community.releases: http://repo.odysseusinc.com/artifactory/community-libs-release-local/commons-io/commons-io/maven-metadata.xml
Downloading from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/commons-io/commons-io/maven-metadata.xml
Downloading from central: http://repo.maven.apache.org/maven2/org/ohdsi/circe/1.6.0-SNAPSHOT/maven-metadata.xml
Downloading from ohdsi.snapshots: http://repo.ohdsi.org:8085/nexus/content/repositories/snapshots/org/ohdsi/circe/1.6.0-SNAPSHOT/maven-metadata.xml
Downloading from ohdsi.thirdparty: http://repo.ohdsi.org:8085/nexus/content/repositories/thirdparty/org/ohdsi/circe/1.6.0-SNAPSHOT/maven-metadata.xml
Downloading from ohdsi: http://repo.ohdsi.org:8085/nexus/content/repositories/releases/org/ohdsi/circe/1.6.0-SNAPSHOT/maven-metadata.xml
Downloading from redshift: http://redshift-maven-repository.s3-website-us-east-1.amazonaws.com/release/org/ohdsi/circe/1.6.0-SNAPSHOT/maven-metadata.xml
Downloading from odysseus.community.snapshots: http://repo.odysseusinc.com/artifactory/community-libs-snapshot-local/org/ohdsi/circe/1.6.0-SNAPSHOT/maven-metadata.xml
Downloaded from ohdsi.snapshots: http://repo.ohdsi.org:8085/nexus/content/repositories/snapshots/org/ohdsi/circe/1.6.0-SNAPSHOT/maven-metadata.xml (764 B at 1.0 kB/s)
[INFO]
[INFO] — maven-clean-plugin:2.5:clean (default-clean) @ WebAPI —
[INFO] Deleting /WebAPI/target
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ WebAPI —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 534 resources
[INFO] Copying 1 resource
[INFO] Copying 29 resources
[INFO]
[INFO] — maven-compiler-plugin:2.5.1:compile (default-compile) @ WebAPI —
[INFO] Compiling 461 source files to /WebAPI/target/classes
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ WebAPI —
[INFO] Using ‘UTF-8’ encoding to copy filtered resources.
[INFO] Copying 30 resources
[INFO]
[INFO] — maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ WebAPI —
[INFO] Compiling 18 source files to /WebAPI/target/test-classes
[INFO]
[INFO] — maven-surefire-plugin:2.18.1:test (default-test) @ WebAPI —
[INFO] Tests are skipped.
[INFO]
[INFO] — maven-war-plugin:2.2:war (default-war) @ WebAPI —
[INFO] Packaging webapp
[INFO] Assembling webapp [WebAPI] in [/WebAPI/target/WebAPI]
[INFO] Processing war project
[INFO] Copying webapp resources [/WebAPI/src/main/webapp]
[INFO] Webapp assembled in [11719 msecs]
[INFO] Building war: /WebAPI/target/WebAPI.war
[INFO]
[INFO] — miredot-plugin:1.5.1:restdoc (default) @ WebAPI —
[INFO] Building reflective model of API and reading annotations…
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @javax.annotation.PostConstruct()
[WARNING] Unknown annotation on service method: skipped @javax.annotation.PostConstruct()
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @javax.annotation.PostConstruct()
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[class java.lang.Exception], dontRollbackOn=[class org.springframework.dao.EmptyResultDataAccessException])
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=true, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=true, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.context.annotation.Bean(name=[], initMethod=, destroyMethod=(inferred), value=[], autowire=NO)
[WARNING] Unknown annotation on service method: skipped @javax.annotation.PostConstruct()
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=true, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=true, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @javax.transaction.Transactional(value=REQUIRED, rollbackOn=[], dontRollbackOn=[])
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[WARNING] Unknown annotation on service method: skipped @javax.annotation.PostConstruct()
[WARNING] Unknown annotation on service method: skipped @org.springframework.transaction.annotation.Transactional(propagation=REQUIRED, rollbackForClassName=[], readOnly=false, isolation=DEFAULT, transactionManager=, noRollbackFor=[], noRollbackForClassName=[], value=, timeout=-1, rollbackFor=[])
[INFO] Built.
[INFO] Reading javadoc comments from sourcefiles…
[INFO] Read.
[INFO] Merging reflective and javadoc models…
[WARNING] Limited support for jdk8 (@link, @see, @linkplain javadoc tags won’t format properly)
[INFO] Merged.
[INFO] Performing issue analysis…
[INFO] Analysis done.
[INFO] Constructing Html documentation
[WARNING] Could not find html intro file file: miredot.htmlintro.html
[INFO] MireDot: Completed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 56.558 s
[INFO] Finished at: 2018-08-12T13:36:32+08:00
[INFO] ------------------------------------------------------------------------

Thanks
Hui Xing


(Chris Knoll) #18

There’s the problem. It looks like you tried to edit the settings.xml file in a word editor. Don’t do that. just use a plain text file and make it contain only the text starting with <settings>.


(mintmountain89) #19

Ah yes, it works now after pasting the settings it into a text file. The WebAPI built with the settings in settings.xml

Thanks @Chris_Knoll!!


#20

Hi, when I check on the applications.properties in the built .war file in the c:/tomcat/webapps/WebAPI.war it gives me the below, which is not what I have set in my settings.xml in under the WebAPIConfig.What might be the issue kindly?

#Primary DataSource
datasource.driverClassName=org.postgresql.Driver
datasource.url=jdbc:postgresql://54.209.111.128:5432/vocabularyv5
datasource.username=USER
datasource.password=PASS
datasource.dialect=postgresql
datasource.ohdsi.schema=ohdsi
datasource.dialect.source=sql server

#Flyway database change management.
#DataSource for Change Managment / Migration
flyway.enabled=true
flyway.datasource.driverClassName=org.postgresql.Driver
flyway.datasource.url=jdbc:postgresql://54.209.111.128:5432/vocabularyv5
flyway.datasource.username=userWithWritesToOhdsiSchema
flyway.datasource.password=PASS


t