0
votes

I'm learning AWS right now and therefore now deployed my spring boot app on AWS Elasctic Beanstalk and connected it to my mariaDB Database that I put on AWS RDS. That was successful! I can see the test entries in my database and also the Elastic Beanstalk log file shows me that the Spring app has started and the health check is OK.

But when I click on the link to the App studileih.eu-central-1.elasticbeanstalk.com, I get a 404. I also tried studileih.eu-central-1.elasticbeanstalk.com/5000, since my spring boot app is starting on port 5000 (I changed it from 8080 to 5000 because I think ElasticBeanstalk needs port 5000?) studileih.eu-central-1.elasticbeanstalk.com/allProducts and studileih.eu-central-1.elasticbeanstalk.com/5000/allProducts since /allProducts is the endpoint for my get request.

Elastic Beanstalk Health Check

Jun 12 17:42:41 ip-172-31-14-223 web: .   ____          _            __ _ _
Jun 12 17:42:41 ip-172-31-14-223 web: /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
Jun 12 17:42:41 ip-172-31-14-223 web: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
Jun 12 17:42:41 ip-172-31-14-223 web: \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
Jun 12 17:42:41 ip-172-31-14-223 web: '  |____| .__|_| |_|_| |_\__, | / / / /
Jun 12 17:42:41 ip-172-31-14-223 web: =========|_|==============|___/=/_/_/_/
Jun 12 17:42:41 ip-172-31-14-223 web: :: Spring Boot ::        (v2.2.7.RELEASE)
Jun 12 17:42:41 ip-172-31-14-223 web: 2020-06-12 17:42:41.459  INFO 4050 --- [           main]     
c.e.studileih.StudileihApplication       : Starting StudileihApplication v0.0.1-SNAPSHOT on     
ip-172-31-14-223.eu-central-1.compute.internal with PID 4050 (/var/app/current/application.jar 
started by webapp in /var/app/current)
Jun 12 17:42:41 ip-172-31-14-223 web: 2020-06-12 17:42:41.471  INFO 4050 --- [           main] 
c.e.studileih.StudileihApplication       : No active profile set, falling back to default profiles:   
default
Jun 12 17:42:43 ip-172-31-14-223 web: 2020-06-12 17:42:43.721  INFO 4050 --- [           main] 
.s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT 
mode.
Jun 12 17:42:43 ip-172-31-14-223 web: 2020-06-12 17:42:43.912  INFO 4050 --- [           main] 
 .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 164ms. Found 
2 JPA repository interfaces.
Jun 12 17:42:45 ip-172-31-14-223 web: 2020-06-12 17:42:45.720  INFO 4050 --- [           main] 
o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 5000 (http)
Jun 12 17:42:45 ip-172-31-14-223 web: 2020-06-12 17:42:45.751  INFO 4050 --- [           main] 
o.apache.catalina.core.StandardService   : Starting service [Tomcat]
Jun 12 17:42:45 ip-172-31-14-223 web: 2020-06-12 17:42:45.752  INFO 4050 --- [           main] 
org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.34]
Jun 12 17:42:45 ip-172-31-14-223 web: 2020-06-12 17:42:45.967  INFO 4050 --- [           main] 
o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
Jun 12 17:42:45 ip-172-31-14-223 web: 2020-06-12 17:42:45.970  INFO 4050 --- [           main] 
o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in  
4339 ms
Jun 12 17:42:47 ip-172-31-14-223 web: 2020-06-12 17:42:47.014  INFO 4050 --- [           main] 
o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
Jun 12 17:42:47 ip-172-31-14-223 web: 2020-06-12 17:42:47.140  INFO 4050 --- [           main] 
org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.15.Final
Jun 12 17:42:47 ip-172-31-14-223 web: 2020-06-12 17:42:47.475  INFO 4050 --- [           main] 
o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
Jun 12 17:42:47 ip-172-31-14-223 web: 2020-06-12 17:42:47.742  INFO 4050 --- [           main] 
com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
Jun 12 17:42:47 ip-172-31-14-223 web: 2020-06-12 17:42:47.932  INFO 4050 --- [           main] 
com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
Jun 12 17:42:47 ip-172-31-14-223 web: 2020-06-12 17:42:47.979  INFO 4050 --- [           main] 
org.hibernate.dialect.Dialect            : HHH000400: Using dialect: 
org.hibernate.dialect.MariaDB53Dialect
Jun 12 17:42:48 ip-172-31-14-223 web: 2020-06-12 17:42:48.207  WARN 4050 --- [           main] 
org.hibernate.cfg.AnnotationBinder       : HHH000503: A class should not be annotated with both 
@Inheritance and @MappedSuperclass. @Inheritance will be ignored for: 
com.example.studileih.Entity.BaseEntity.
Jun 12 17:42:49 ip-172-31-14-223 web: 2020-06-12 17:42:49.638  INFO 4050 --- [           main] 
org.hibernate.tuple.PojoInstantiator     : HHH000182: No default (no-argument) constructor for 
class: com.example.studileih.Entity.Country (class must be instantiated by Interceptor)
Jun 12 17:42:49 ip-172-31-14-223 web: 2020-06-12 17:42:49.763  INFO 4050 --- [           main] 
org.hibernate.tuple.PojoInstantiator     : HHH000182: No default (no-argument) constructor for 
class: com.example.studileih.Entity.City (class must be instantiated by Interceptor)
Jun 12 17:42:50 ip-172-31-14-223 web: 2020-06-12 17:42:50.133  INFO 4050 --- [           main] 
o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: 
[org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
Jun 12 17:42:50 ip-172-31-14-223 web: 2020-06-12 17:42:50.142  INFO 4050 --- [           main] 
j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 
'default'
Jun 12 17:42:50 ip-172-31-14-223 web: Hibernate: select `next_val` as id_val from 
`hibernate_sequence` for update
Jun 12 17:42:50 ip-172-31-14-223 web: Hibernate: update `hibernate_sequence` set `next_val`= ? where  
`next_val`=?
Jun 12 17:42:50 ip-172-31-14-223 web: Hibernate: insert into `product` (`created_at`, `updated_at`, 
`available`, `name`, `pic_paths`, `price`, `title`, `type`, `user_id`, `views`, `id`) values (?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?)
Jun 12 17:42:51 ip-172-31-14-223 web: Hibernate: select `next_val` as id_val from 
`hibernate_sequence` for update
[... some more hibernate logs that I deleted for better readablility]
Jun 12 17:42:51 ip-172-31-14-223 web: 2020-06-12 17:42:51.295  WARN 4050 --- [           main]    
JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore,   
database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-
view to disable this warning
Jun 12 17:42:51 ip-172-31-14-223 web: 2020-06-12 17:42:51.592  INFO 4050 --- [           main] 
 o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
Jun 12 17:42:52 ip-172-31-14-223 web: 2020-06-12 17:42:52.069  INFO 4050 --- [           main] 
o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 5000 (http) with context path   
''
Jun 12 17:42:52 ip-172-31-14-223 web: 2020-06-12 17:42:52.078  INFO 4050 --- [           main] 
c.e.studileih.StudileihApplication       : Started StudileihApplication in 11.903 seconds (JVM 
running for 13.534)
Jun 12 17:43:16 ip-172-31-14-223 web: 2020-06-12 17:43:16.252  INFO 4050 --- [nio-5000-exec-1] 
o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
Jun 12 17:43:16 ip-172-31-14-223 web: 2020-06-12 17:43:16.254  INFO 4050 --- [nio-5000-exec-1] 
o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
Jun 12 17:43:16 ip-172-31-14-223 web: 2020-06-12 17:43:16.279  INFO 4050 --- [nio-5000-exec-1] 
o.s.web.servlet.DispatcherServlet        : Completed initialization in 25 ms


----------------------------------------
/var/log/nginx/access.log
----------------------------------------
77.190.237.177 - - [12/Jun/2020:17:34:32 +0000] "GET / HTTP/1.1" 404 306 "-" "Mozilla/5.0 (Windows    
NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:34:33 +0000] "GET /favicon.ico HTTP/1.1" 404 143 
"http://studileih.eu-central-1.elasticbeanstalk.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64)    
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:34:43 +0000] "GET /allproducts HTTP/1.1" 404 306 "-" "Mozilla/5.0     
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97   
Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:35:26 +0000] "GET / HTTP/1.1" 404 306 "-" "Mozilla/5.0 (Windows 
 NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" "-" 
 77.190.237.177 - - [12/Jun/2020:17:35:57 +0000] "GET / HTTP/1.1" 404 306 "-" "Mozilla/5.0 (Windows   
 NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:36:05 +0000] "GET /allproducts HTTP/1.1" 404 306 "-" "Mozilla/5.0     
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97   
Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:43:16 +0000] "GET / HTTP/1.1" 404 306 "-" "Mozilla/5.0 (Windows 
NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:45:13 +0000] "GET / HTTP/1.1" 404 306 "-" "Mozilla/5.0 (Windows 
NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:45:13 +0000] "GET /favicon.ico HTTP/1.1" 404 143 
"http://18.157.145.222/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like   
Gecko) Chrome/83.0.4103.97 Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:45:39 +0000] "GET / HTTP/1.1" 404 306 "-" "Mozilla/5.0 (Windows 
NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:45:54 +0000] "GET / HTTP/1.1" 404 306 "-" "Mozilla/5.0 (Windows 
NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" "-"
77.190.237.177 - - [12/Jun/2020:17:46:13 +0000] "GET /5000 HTTP/1.1" 404 306 "-" "Mozilla/5.0 
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97   
Safari/537.36" "-" 
77.190.237.177 - - [12/Jun/2020:17:47:57 +0000] "GET / HTTP/1.1" 404 306 "-" "Mozilla/5.0 (Windows 
NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" "-"


----------------------------------------
/var/log/nginx/error.log
----------------------------------------
(end of log)
1

1 Answers

0
votes

I thought I had set the security group inbound rules to "Allow All Traffic from Everywhere" already, but that was wrong. After adding them it worked with http://studileih.eu-central-1.elasticbeanstalk.com/allProducts (port 5000 is not needed) It's weird that the HTTP rule wasn't enough tough...:

my security group inbound rules

That's the result directly in the browser:

result