Hello,
I have tried to deploy the war file on jelastic cloud and getting following error
HTTP Status 404 – Not Found
Type Status Report
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
Apache Tomcat/9.0.56
My server environment is
Tomcat - 9.0.56 Openjdk - 17.0.1
Postgre SQL - 12.6
I have gone through the documentation and forum and incorporated following;
In application.properties file
main.datasource.url = xxxx
main.datasource.username = xxxxx
main.datasource.password =xxxxxx
spring.datasource.driver-class-name=org.postgresql.Driver
my application.java file is
package com.company.stscmms;
import com.google.common.base.Strings;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.context.event.EventListener;
import org.springframework.core.env.Environment;
import org.springframework.context.annotation.PropertySource;
import javax.sql.DataSource;
@SpringBootApplication
@PropertySource("file:application.properties")
public class StscmmsApplication extends SpringBootServletInitializer {
@Autowired
private Environment environment;
public static void main(String[] args) {
SpringApplication.run(StscmmsApplication.class, args);
}
@Bean
@Primary
@ConfigurationProperties("main.datasource")
DataSourceProperties dataSourceProperties() {
return new DataSourceProperties();
}
@Bean
@Primary
@ConfigurationProperties("main.datasource.hikari")
DataSource dataSource(DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
@EventListener
public void printApplicationUrl(ApplicationStartedEvent event) {
LoggerFactory.getLogger(StscmmsApplication.class).info("Application started at "
+ "http://localhost:"
+ environment.getProperty("local.server.port")
+ Strings.nullToEmpty(environment.getProperty("server.servlet.context-path")));
}
}
and in build.gradle file
plugins {
id 'io.jmix' version '1.1.3'
id 'java'
id 'war'
}
Please guide
thanks