I’m trying to deploy a project in Amazon and I’m going crazy with this.
First, I tried with Ubuntu Linux, and tomcat installation based on several guides I readed. I end with a working Tomcat but my project don’t end working/deploying.
I did all steps, and I ended with an enviroment, my project published, and so on. But I get a
HTTP ERROR 503
Problem accessing /backend/. Reason:
Service Unavailable
As far as I understand Cuba app must use the environment variables configured as explained , right? And the environment has postgres enabled… is what I understood
Well, I tried other several things, and I almost copied the settings of sample linked in the post of my first post. Nothing, and log don’t say anything about database connection. I only see exceptions
BTW, first error is in line 164
Sep 26 19:18:52 ip-172-31-45-138 web: 2020-09-26 19:18:52.332 ERROR [main] com.haulmont.addon.restapi.api.rest.RestAPIDispatcherServlet - Context initialization failed
Sep 26 19:18:52 ip-172-31-45-138 web: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.security.filterChains’: Cannot resolve reference to bean ‘org.springframework.security.web.DefaultSecurityFilterChain#0’ while setting bean property ‘sourceList’ with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.security.web.DefaultSecurityFilterChain#0’: Cannot create inner bean ‘(inner bean)#4939e1d8’ of type [org.springframework.security.web.authentication.www.BasicAuthenticationFilter] while setting constructor argument with key [4]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘(inner bean)#4939e1d8’: Cannot resolve reference to bean ‘clientAuthenticationEntryPoint’ while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘clientAuthenticationEntryPoint’ defined in class path resource [com/haulmont/addon/restapi/rest-dispatcher-spring.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/UnmarshalException
AFAIR something similar happened when tried on a Linux instance directly with tomcat. No database connection errors, just NoClassDefFound exceptions. Tomorrow will try again on Linux instance with tomcat anyway.2-web.stdout.log (104.7 KB)
That is probably true. I just mentioned what is written in the logs:
Sep 26 16:13:12 ip-172-31-45-138 web: Some environment checks failed on core module:
Sep 26 16:13:12 ip-172-31-45-138 web: Exception occurred while connecting to data store _MAIN_
Sep 26 16:13:12 ip-172-31-45-138 web: java.sql.SQLException: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
Regarding the env variables: I guess you can look into the guide on how to deploy to heroku I did some time ago. It also used this exact env variable substitution to define the connection to the DB: Deploy CUBA to Heroku in ten steps - CUBA.Platform
If it does not work at all, you can just switch to the old way (JNDI based). This will work for sure. I also used it quite regularly on AWS with ECS (Fargate) and jetty-env.xml.
CUBA supports Java 8 / Java 11. Which one have you configured in beanstalk?
Good question, don’t remember right now. I will delete the instance and create it again and check all of this. because can’t get it working with tomcat and ubuntu in EC2 either
Ok, one step forward. I changed platform to Corretto 8 running on 64bit Amazon Linux 2/3.1.1, and now seems to “work”, now investigating this new issue.