FAIL - Application at context path could not be started <SpringBoot> - java

My Spring Boot application was working, this is the main class.
#SpringBootApplication
public class BwsApplication {
private ConfigClass config;
private static final Logger log = LoggerFactory.getLogger(Logs.class);
public BwsApplication(ConfigClass configClass) {
config = configClass;
}
public static void main(String[] args) {
SpringApplication.run(BwsApplication.class, args);
}
#PostConstruct
private void postConstruct() {
Connection con = null;
try {
con = config.getConnection();
} catch (SQLException e) {
log.error(e.toString());
}
QuartzApp qa = new QuartzApp(config);
qa.excecution();
}
}
As it was configured I was able to generate a jar with maven and it worked correctly but now I need to generate a WAR file because the application will have to run as a service inside a tomcat server.
It is the first time I work with Spring, so I researched and saw that to generate a war file I needed to make alterations in my pom.xml and in my main class, I did them.
#SpringBootApplication
public class BwsApplication extends SpringBootServletInitializer {
private ConfigClass config;
private static final Logger log = LoggerFactory.getLogger(Logs.class);
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(BwsApplication.class);
}
public BwsApplication(ConfigClass configClass) {
config = configClass;
}
public static void main(String[] args) {
SpringApplication.run(BwsApplication.class, args);
}
#PostConstruct
private void postConstruct() {
Connection con = null;
try {
con = config.getConnection();
} catch (SQLException e) {
log.error(e.toString());
}
QuartzApp qa = new QuartzApp(config);
qa.excecution();
}
}
My main class with the changes stayed like this ... I put it to extend SpringBootServletInitializer and I added the configure method.
I also made changes to my pom.xml, his is the full .xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.speedsoft</groupId>
<artifactId>bedelServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!-- <packaging>jar</packaging>-->
<packaging>war</packaging>
<name>bedel</name>
<description>BWS</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<java.version>1.8</java.version>
<quartz.version>2.2.1</quartz.version>
<jooq.version>3.9.1</jooq.version>
<logback.version>1.2.3</logback.version>
<logbackaccess.version>1.3.0-alpha4</logbackaccess.version>
<mysql.version>6.0.3</mysql.version>
<exec-maven-plugin>1.7</exec-maven-plugin>
<start-class>com.speedsoft.bws.BwsApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>${quartz.version}</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>${quartz.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-access</artifactId>
<version>${logbackaccess.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.9</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<configuration>
<mainClass>com.speedsoft.bws.BwsApplication</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<!--plugin exe-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<!-- inserida para teste -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build>
</project>
After these changes, when I try to run the application inside intellij gives this error
09-04-2019 15:04:14.247 [main] INFO o.s.c.a.AnnotationConfigApplicationContext.prepareRefresh - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#61dd025: startup date [Tue Apr 09 15:04:14 BRT 2019]; root of context hierarchy
09-04-2019 15:04:16.312 [main] WARN o.s.c.a.AnnotationConfigApplicationContext.refresh - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.speedsoft.bws.BwsApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer
09-04-2019 15:04:16.387 [main] ERROR o.s.boot.SpringApplication.reportFailure - Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.speedsoft.bws.BwsApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
at com.speedsoft.bws.BwsApplication.main(BwsApplication.java:34)
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.boot.web.servlet.support.SpringBootServletInitializer
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:169)
at org.springframework.context.annotation.ConfigurationClassParser.retrieveBeanMethodMetadata(ConfigurationClassParser.java:390)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:315)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:202)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:170)
... 12 common frames omitted
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:158)
... 17 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 21 common frames omitted
Process finished with exit code 1
I followed the tip and now I can run the application in the IDE, I build the war (package maven) only when trying to start the application in tomcat gives the error
FAIL - Application at context path [/bedelServer-0.0.1-SNAPSHOT] could not be started
TomCat log
09-Apr-2019 14:07:08.442 INFORMAÇÕES [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/bedel]
09-Apr-2019 14:29:31.736 INFORMAÇÕES [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\bedelServer-0.0.1-SNAPSHOT.war]
09-Apr-2019 14:29:48.097 GRAVE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.core.StandardContext.startInternal Error during ServletContainerInitializer processing
javax.servlet.ServletException: Failed to instantiate WebApplicationInitializer class
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:158)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5098)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
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(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
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.check(HostConfig.java:1629)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:304)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1179)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1401)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1405)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1373)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchMethodException: com.speedsoft.bws.BwsApplication.<init>()
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at org.springframework.util.ReflectionUtils.accessibleConstructor(ReflectionUtils.java:503)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:155)
... 21 more

I think you need to update the scope from the provided to compile
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>compile</scope>
</dependency>

Related

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder

I have issue with reading the values from the application.properties file and get the following errors,
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.7.RELEASE:run (default-cli) on project wedding-card: An exception occurred while running. null: InvocationTargetException: Error creating bean with name 'weddingCardConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'aws.s3.access.key' in value "${aws.s3.access.key}" -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.7.RELEASE:run (default-cli) on project wedding-card: An exception occurred while running. null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occurred while running. null
at org.springframework.boot.maven.AbstractRunMojo$IsolatedThreadGroup.rethrowUncaughtException (AbstractRunMojo.java:512)
at org.springframework.boot.maven.RunMojo.runWithMavenJvm (RunMojo.java:94)
at org.springframework.boot.maven.AbstractRunMojo.run (AbstractRunMojo.java:244)
Caused by: java.lang.reflect.InvocationTargetException
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.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.java:543)
at java.lang.Thread.run (Thread.java:748)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'weddingCardConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'aws.s3.access.key' in value "${aws.s3.access.key}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties (AutowiredAnnotationBeanPostProcessor.java:380)
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'aws.s3.access.key' in value "${aws.s3.access.key}"
The pom.xml file is provided:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.wedcard</groupId>
<artifactId>wedding-card</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>wedding-card</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>10.0.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.163</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.github.jhonnymertz</groupId>
<artifactId>java-wkhtmltopdf-wrapper</artifactId>
<version>1.1.11-RELEASE</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<!-- <resources>-->
<!-- <resource>-->
<!-- <directory>resources</directory>-->
<!-- <targetPath>${project.build.outputDirectory}</targetPath>-->
<!-- <includes>-->
<!-- <include>application.properties</include>-->
<!-- </includes>-->
<!-- </resource>-->
<!-- </resources>-->
</build>
<repositories>
<repository>
<id>spring.io</id>
<url>https://repo.spring.io/plugins-release/</url>
</repository>
</repositories>
</project>
The configuration source file is here:
#Configuration
#EnableSwagger2
#EnableScheduling
//#PropertySource(value = "classpath:application.properties")
public class WeddingCardConfiguration implements WebMvcConfigurer {
// #Value("${spring.mail.host}")
// private String smtpMailHost;
// #Value("${spring.mail.port}")
// private int smtpMailPort;
// #Value("${spring.mail.username}")
// private String mailUsername;
// #Value("${spring.mail.password}")
// private String mailPassword;
#Value("${aws.s3.access.key}")
private String awsS3AccessKey;
#Value("${aws.s3.access.secret}")
private String awsS3AccessSecret;
#Value("${aws.s3.bucket.region.name}")
private String awsBucketRegionName;
#Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
#Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOrigins("*");
}
// #Bean
// public JavaMailSender javaMailSender() {
// JavaMailSenderImpl sender = new JavaMailSenderImpl();
// Properties prop = new Properties();
// prop.put("mail.smtp.auth", "true");
// prop.put("mail.smtp.starttls.enable", "true"); //TLS
// sender.setJavaMailProperties(prop);
// sender.setHost(smtpMailHost);
// sender.setPort(smtpMailPort);
// sender.setUsername(mailUsername);
// sender.setPassword(mailPassword);
//
// return sender;
// }
#Bean
public AmazonS3 awsS3Client() {
AWSCredentials credentials = new BasicAWSCredentials(awsS3AccessKey, awsS3AccessSecret);
return AmazonS3ClientBuilder
.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.withRegion(awsBucketRegionName)
.build();
}
}
The project has standard file structure provided:
I have tried to provide the property source information to the configuration class but still get the same error:
#Configuration
#EnableSwagger2
#EnableScheduling
#PropertySource(value = "classpath:application.properties")
public class WeddingCardConfiguration implements WebMvcConfigurer {
}
I have also tried to provide explicitly the resources info to the pom file:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>resources</directory>
<targetPath>${project.build.outputDirectory}</targetPath>
<includes>
<include>application.properties</include>
</includes>
</resource>
</resources>
</build>
I keep getting the same error. Whats the issue here and how to solve it?
ps: The email config values are commented purposefully and the error is not related to that
Check that those properties are actually defined in application.properties. There is also an application-aws.properties file, if the properties are only in that file then you will need to tell Spring Boot to enable the aws profile with SPRING_PROFILES_ACTIVE=aws, or add the aws properties with empty values in application.properties.
If no Spring Boot profile is activated, it will only use the properties defined in application.properties.
If you enable the aws profile, it will use use properties from application.properties as defaults, and then any matching properties defined in application-aws.properties will override those from application.properties if defined.
If what you are trying to do it only use those AWS properties when deployed to AWS, then you might need to make a Configuration object that holds those properties in it(which is a better practice than including properties with #Value in code), and make the AmazonS3 bean creation conditional on those properties being set.
Given that your project structure is a standard Maven structure, convention over configuration should apply and there should be no need to try and explicitly include application.properties with additional class path configuration. I.e everything under /src/main/resources should be available on the class path and to the application at runtime.
I needed to add a bean in the configuration file that would read the extra properties file,
#Bean
public PropertyPlaceholderConfigurer properties() {
final PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
// ppc.setIgnoreUnresolvablePlaceholders(true);
ppc.setIgnoreResourceNotFound(true);
final List<Resource> resourceLst = new ArrayList<Resource>();
resourceLst.add(new ClassPathResource("application.properties"));
resourceLst.add(new ClassPathResource("application-local.properties"));
ppc.setLocations(resourceLst.toArray(new Resource[]{}));
return ppc;
}
Afterwards, its working fine.

Cannot determine embedded database driver class for database type NONE Exception with Spring and JavaFX

I want to use Spring's auto-configuration feature to connect and create-drop a datasource.
I'm using JavaFX, Spring and Maven on IntelliJ. I first run 'mvn install' then run the jar file. However, I'm getting the following error even though I believe I have followed the right steps:
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:246)
at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:183)
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:42)
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat.dataSource(DataSourceConfiguration.java:56)
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.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 47 more
I have defined my datasource properties in my application.properties file under src/main/resources:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/project_name?autoReconnect=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=password
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
spring.jpa.show-sql=true
My build details and dependencies in my pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>1.5.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>1.5.7.RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.6</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.0.12.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.1-jre</version>
</dependency>
</dependencies>
My Main class that starts the program is:
#SpringBootApplication
#EnableAutoConfiguration
#ComponentScan
public class Main extends Application {
#Override
public void start(Stage stage) throws Exception {
Parent root = SpringFXMLLoader.load(getClass().getResource("/welcome.fxml"), ResourceBundle.getBundle("language", new Locale("en")));
stage.setTitle("Softserver");
stage.setScene(new Scene(root));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
My custom SpringFXMLLoader class:
public class SpringFXMLLoader {
private static final ApplicationContext context = new AnnotationConfigApplicationContext("package_name");
public static <T> T load(URL url, ResourceBundle languageProperties) {
try {
FXMLLoader loader = new FXMLLoader(url, languageProperties);
loader.setControllerFactory(context::getBean);
return loader.load();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
What else am I missing here? Any help would greatly be appreciated!

Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]

I am trying to build a SpringBoot application.
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
#SpringBootApplication
public class App {
#SuppressWarnings("unused")
public static void main(String[] args) throws Exception {
ApplicationContext ctx = SpringApplication.run(App.class, args);
}
}
But, when I try to run the app, it throws me the below error:
2017-03-27 13:55:58.281 INFO 8608 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-03-27 13:55:58.299 INFO 8608 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2017-03-27 13:55:58.302 INFO 8608 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.11
2017-03-27 13:55:58.554 ERROR 8608 --- [cat-startStop-1] org.apache.catalina.core.ContainerBase : A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.8.0_73]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) [na:1.8.0_73]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) [tomcat-embed-core-8.5.11.jar:8.5.11]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.11.jar:8.5.11]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [tomcat-embed-core-8.5.11.jar:8.5.11]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [tomcat-embed-core-8.5.11.jar:8.5.11]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_73]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_73]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_73]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_73]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) [tomcat-embed-core-8.5.11.jar:8.5.11]
... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [Pipeline[StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) [tomcat-embed-core-8.5.11.jar:8.5.11]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5099) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.11.jar:8.5.11]
... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.authenticator.NonLoginAuthenticator[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) [tomcat-embed-core-8.5.11.jar:8.5.11]
at org.apache.catalina.core.StandardPipeline.startInternal(StandardPipeline.java:170) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.11.jar:8.5.11]
... 8 common frames omitted
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
at org.apache.catalina.authenticator.AuthenticatorBase.startInternal(AuthenticatorBase.java:1137) ~[tomcat-embed-core-8.5.11.jar:8.5.11]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.5.11.jar:8.5.11]
... 10 common frames omitted
my current pom.xml file is as follows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>XXXX</groupId>
<artifactId>XXXX</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!-- JSON -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19.3</version>
</dependency >
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.19.3</version>
</dependency>
<!-- REST Services -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.5.0.RELEASE</version>
</dependency> -->
<!-- SLF4J Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.6.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<!-- Set a compiler level -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
As mentioned in some SO posts, I tried removing (Jersey), adding (embedded tomcat) dependencies. But the error seems not to be having an effect on the changes.
I also tried and another simple project (app) from Spring Tutorials (to add two numbers), this has the following pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SpringBootDemoProject</groupId>
<artifactId>SpringBootDemoProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
This works completely fine. Any pointers as to why this is the case?
For me, upgrading javax.servlet-api to 4.0.1 did the trick:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
Looks like you have an incompatible version of Servlet API in ur classpath.
This could have been as a dependencies to Jersey jars.
Try pulling jersey starter from Spring boot starters.
org.springframework.boot : spring-boot-starter-jersey
This will bring the right version into your classpath.
My guess is you have to use the default ServletInitializer class that is provided within the Spring Boot Project template of Eclipse.
//SpringBootApplication.java
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class SpringBootApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootApplication.class, args);
}
}
//ServletInitializer.java
public class ServletInitializer extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringBootApplication.class);
}
}
If you are not using ServletInitializer class as specified in Spring Boot Starter Project template, try to extend SpringBootServletInitializer from your App class
public class App extends SpringBootServletInitializer
Please check a similar answer here
I just remove my (tomcat-embed-jasper ) , it's worked for me .
I had the same problem with a different cause.
I was trying to run a project on Eclipse and I received this error, and my problem was the version of JDK chosen to run the project.
Run configuration with JDK
I had to set my run configuration to 1.8, same as project.
I solved this problem using tomcat configuration in pom.xml
First go to tomcat folder and open cmd in bin my path is :
C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin>
get tomcat version using this command
C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin>catalina.sh version
After this add this in pom.xml
<properties>
<java.version>1.8</java.version>
<tomcat.version>8.5.43</tomcat.version>
</properties>
It was solution for me after 2 days,
just add this part to pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>9.0.44</version>
</dependency>
I had the same issue, After commenting out the below it was fixed. One of the follwoing dependency was the culprit.
<!-- dependency>
<groupId>me.fhir</groupId>
<artifactId>fhir</artifactId>
<version>0.12.0-RELEASE</version>
</dependency-->
<!-- dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.8</version>
</dependency-->
<!-- dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.8</version>
</dependency-->

java.lang.NoClassDefFoundError: org/springframework/web/client/ResponseErrorHandler

I got this issue when I tried to open my deployed application in HEROKU. NoClassDefFoundError is being thrown for the Spring Framework class ResponseErrorHandler. I tried changing the xml and properties files, but in vain.
[33m2014-12-15T12:12:46.641119+00:00 heroku[web.1]:←[0m Starting process with command java -Dserver.port=39847 -Ddatabase.url=postgres://genreimfcnjetj:Swt7eGbTANi2-X7tBru0wTX4GT#ec2-54-235-76-206.compute-1.amazonaws.com:5432/d9108hum0pg29o -Xss512k -XX:+UseCompressedOops -Dspring.profiles.active=production -jar target/*.jar
[33m2014-12-15T12:12:47.517755+00:00 app[web.1]:←[0m at java.lang.Class.getDeclaredMethods0(Native Method)
[33m2014-12-15T12:12:47.518480+00:00 app[web.1]:←[0m at java.lang.Class.privateGetMethodRecursive(Class.java:3035)
[33m2014-12-15T12:12:47.517563+00:00 app[web.1]:←[0m Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/web/client/ResponseErrorHandler
[33m2014-12-15T12:12:47.518545+00:00 app[web.1]:←[0m at java.lang.Class.getMethod0(Class.java:3005)
[33m2014-12-15T12:12:47.519084+00:00 app[web.1]:←[0m at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
[33m2014-12-15T12:12:47.319339+00:00 app[web.1]:←[0m Picked up JAVA_TOOL_OPTIONS: -Xmx384m -Djava.rmi.server.useCodebaseOnly=true
[33m2014-12-15T12:12:47.519022+00:00 app[web.1]:←[0m at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
[33m2014-12-15T12:12:47.518428+00:00 app[web.1]:←[0m at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
[33m2014-12-15T12:12:47.518938+00:00 app[web.1]:←[0m at java.lang.Class.getMethod(Class.java:1771)
[33m2014-12-15T12:12:47.519224+00:00 app[web.1]:←[0m Caused by: java.lang.ClassNotFoundException: org.springframework.web.client.ResponseErrorHandler
[33m2014-12-15T12:12:47.520145+00:00 app[web.1]:←[0m at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
[33m2014-12-15T12:12:47.519277+00:00 app[web.1]:←[0m at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
[33m2014-12-15T12:12:47.519388+00:00 app[web.1]:←[0m at java.security.AccessController.doPrivileged(Native Method)
[33m2014-12-15T12:12:47.520395+00:00 app[web.1]:←[0m at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[33m2014-12-15T12:12:47.520237+00:00 app[web.1]:←[0m at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[33m2014-12-15T12:12:47.519339+00:00 app[web.1]:←[0m at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[33m2014-12-15T12:12:47.520312+00:00 app[web.1]:←[0m at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[33m2014-12-15T12:12:47.520441+00:00 app[web.1]:←[0m ... 7 more
[33m2014-12-15T12:12:48.201159+00:00 heroku[web.1]:←[0m Process exited with status 1
[33m2014-12-15T12:12:48.209235+00:00 heroku[web.1]:←[0m State changed from starting to crashed
Can I have some HELP please.
Sharing my classes relating to ResponseErrorHandler.
CustomerErrorResponseHandler.java
package rentitnew;
import java.io.IOException;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.ResponseErrorHandler;
class CustomResponseErrorHandler implements ResponseErrorHandler {
private ResponseErrorHandler errorHandler = new DefaultResponseErrorHandler();
#Override
public boolean hasError(ClientHttpResponse response) throws IOException {
return errorHandler.hasError(response);
}
#Override
public void handleError(ClientHttpResponse response) throws IOException {
}
}
Application.java
package rentitnew;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
#Configuration
#ComponentScan
#EnableAutoConfiguration
public class Application {
#Autowired
private WebMvcProperties mvcProperties = new WebMvcProperties();
#Autowired
Credentials credentials;
#Autowired
ClientHttpRequestFactory basicSecure;
#Bean
public RestTemplate restTemplate() {
RestTemplate _restTemplate = new RestTemplate();
List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
messageConverters.add(new MappingJackson2HttpMessageConverter());
_restTemplate.setMessageConverters(messageConverters);
_restTemplate.setErrorHandler(new CustomResponseErrorHandler());
_restTemplate.setRequestFactory(basicSecure);
return _restTemplate;
}
#Bean
public ClientHttpRequestFactory requestFactory() {
return new BasicSecureSimpleClientHttpRequestFactory();
}
#Bean
#ConfigurationProperties(locations = "classpath:META-INF/integration/credentials.yml")
public Credentials getCredentials() {
return new Credentials();
}
public static class Credentials {
private Map<String, Map<String, String>> credentials = new HashMap<>();
public Map<String, Map<String, String>> getCredentials() {
return this.credentials;
}
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>rentitnew</groupId>
<artifactId>rentitnew</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>rentitnew</name>
<description>Rentit Project</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.9.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1100-jdbc41</version>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.4.8</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.springtestdbunit</groupId>
<artifactId>spring-test-dbunit</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.14.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>0.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
<version>0.16.0.RELEASE</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>rentitnew.Application</start-class>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<systemProperty>
<name>spring.profiles.active</name>
<value>production</value>
</systemProperty>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reportsDirectory>shippable/testresults</reportsDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>2.7.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Procfile
web: java -Dserver.port=$PORT -Ddatabase.url=$DATABASE_URL $JAVA_OPTS -Dspring.profiles.active=production -jar target/*.jar
Can I have some suggestions how I can change the code/other files so that I can open my application.
Thanks in advance!
Well, I see I haven't answered this question yet. So even though it is late, I will provide the fix I had made to solve this issue.
Apart from the change proposed by Jens, I added the following plugin into the plugins tag in pom.xml.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
I had accidently removed this plugin from pom.xml which caused the issue above.
You miss the org.springframework.web in your classpath. add it to your pom and it should work.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version><!--your spring version--></version>
</dependency>
In my case only this worked (for executable jar file):
Plugin:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.6.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
Dependency (same as Jens answer):
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.10.RELEASE</version>
</dependency>
Although its late to answer but let me add my 2 cents, for me all the jars and build plugin were there in pom but scope for the jar was "provided" and hence though it was running through jar it wasn't through my IDE (intelliJ), once commented that working all good.

Aspectj in maven with spring works in IDE but not in production

I am using intellij IDE with maven and spring. I am trying to enable the aspectj caching, which required to enable the LoadTimeWeaving to be enabled too. I am able to compile, run and test my web application through the IDE, but when I package it through maven it gives the following exception
2015-01-14 12:08:34.658 ERROR 5896 --- [ main] o.s.boot.SpringApplicat
ion : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'loadTimeWeaver' defined in class org.springframework.context.annotation.
LoadTimeWeavingConfiguration: Instantiation of bean failed; nested exception is
org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [
public org.springframework.instrument.classloading.LoadTimeWeaver org.springfram
ework.context.annotation.LoadTimeWeavingConfiguration.loadTimeWeaver()] threw ex
ception; nested exception is java.lang.IllegalStateException: ClassLoader [org.s
pringframework.boot.loader.LaunchedURLClassLoader] does NOT provide an 'addTrans
former(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start y
our Java virtual machine with Spring's agent: -javaagent:org.springframework.ins
trument.jar
at org.springframework.beans.factory.support.ConstructorResolver.instant
iateUsingFactoryMethod(ConstructorResolver.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:10
94)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:989)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:482)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
xt.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.
java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java
:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java
:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java
:941)
at pts.web.Starter.main(Starter.java:80)
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.boot.loader.MainMethodRunner.run(MainMethodRunner
.java:53)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Facto
ry method [public org.springframework.instrument.classloading.LoadTimeWeaver org
.springframework.context.annotation.LoadTimeWeavingConfiguration.loadTimeWeaver(
)] threw exception; nested exception is java.lang.IllegalStateException: ClassLo
ader [org.springframework.boot.loader.LaunchedURLClassLoader] does NOT provide a
n 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver
or start your Java virtual machine with Spring's agent: -javaagent:org.springfr
amework.instrument.jar
at org.springframework.beans.factory.support.SimpleInstantiationStrategy
.instantiate(SimpleInstantiationStrategy.java:188)
at org.springframework.beans.factory.support.ConstructorResolver.instant
iateUsingFactoryMethod(ConstructorResolver.java:586)
... 23 common frames omitted
Caused by: java.lang.IllegalStateException: ClassLoader [org.springframework.boo
t.loader.LaunchedURLClassLoader] does NOT provide an 'addTransformer(ClassFileTr
ansformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual m
achine with Spring's agent: -javaagent:org.springframework.instrument.jar
at org.springframework.context.weaving.DefaultContextLoadTimeWeaver.setB
eanClassLoader(DefaultContextLoadTimeWeaver.java:91)
at org.springframework.context.weaving.DefaultContextLoadTimeWeaver.<ini
t>(DefaultContextLoadTimeWeaver.java:67)
at org.springframework.context.annotation.LoadTimeWeavingConfiguration.l
oadTimeWeaver(LoadTimeWeavingConfiguration.java:81)
at org.springframework.context.annotation.LoadTimeWeavingConfiguration$$
EnhancerBySpringCGLIB$$412ffa57.CGLIB$loadTimeWeaver$2(<generated>)
at org.springframework.context.annotation.LoadTimeWeavingConfiguration$$
EnhancerBySpringCGLIB$$412ffa57$$FastClassBySpringCGLIB$$f927f664.invoke(<genera
ted>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.j
ava:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$Bea
nMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
at org.springframework.context.annotation.LoadTimeWeavingConfiguration$$
EnhancerBySpringCGLIB$$412ffa57.loadTimeWeaver(<generated>)
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:166)
... 24 common frames omitted
java.lang.reflect.InvocationTargetException
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.boot.loader.MainMethodRunner.run(MainMethodRunner
.java:53)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'loadTimeWeaver' defined in class org.springframework.context.
annotation.LoadTimeWeavingConfiguration: Instantiation of bean failed; nested ex
ception is org.springframework.beans.factory.BeanDefinitionStoreException: Facto
ry method [public org.springframework.instrument.classloading.LoadTimeWeaver org
.springframework.context.annotation.LoadTimeWeavingConfiguration.loadTimeWeaver(
)] threw exception; nested exception is java.lang.IllegalStateException: ClassLo
ader [org.springframework.boot.loader.LaunchedURLClassLoader] does NOT provide a
n 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver
or start your Java virtual machine with Spring's agent: -javaagent:org.springfr
amework.instrument.jar
at org.springframework.beans.factory.support.ConstructorResolver.instant
iateUsingFactoryMethod(ConstructorResolver.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:10
94)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:989)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:482)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
xt.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.
java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java
:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java
:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java
:941)
at pts.web.Starter.main(Starter.java:80)
... 6 more
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Facto
ry method [public org.springframework.instrument.classloading.LoadTimeWeaver org
.springframework.context.annotation.LoadTimeWeavingConfiguration.loadTimeWeaver(
)] threw exception; nested exception is java.lang.IllegalStateException: ClassLo
ader [org.springframework.boot.loader.LaunchedURLClassLoader] does NOT provide a
n 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver
or start your Java virtual machine with Spring's agent: -javaagent:org.springfr
amework.instrument.jar
at org.springframework.beans.factory.support.SimpleInstantiationStrategy
.instantiate(SimpleInstantiationStrategy.java:188)
at org.springframework.beans.factory.support.ConstructorResolver.instant
iateUsingFactoryMethod(ConstructorResolver.java:586)
... 23 more
Caused by: java.lang.IllegalStateException: ClassLoader [org.springframework.boo
t.loader.LaunchedURLClassLoader] does NOT provide an 'addTransformer(ClassFileTr
ansformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual m
achine with Spring's agent: -javaagent:org.springframework.instrument.jar
at org.springframework.context.weaving.DefaultContextLoadTimeWeaver.setB
eanClassLoader(DefaultContextLoadTimeWeaver.java:91)
at org.springframework.context.weaving.DefaultContextLoadTimeWeaver.<ini
t>(DefaultContextLoadTimeWeaver.java:67)
at org.springframework.context.annotation.LoadTimeWeavingConfiguration.l
oadTimeWeaver(LoadTimeWeavingConfiguration.java:81)
at org.springframework.context.annotation.LoadTimeWeavingConfiguration$$
EnhancerBySpringCGLIB$$412ffa57.CGLIB$loadTimeWeaver$2(<generated>)
at org.springframework.context.annotation.LoadTimeWeavingConfiguration$$
EnhancerBySpringCGLIB$$412ffa57$$FastClassBySpringCGLIB$$f927f664.invoke(<genera
ted>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.j
ava:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$Bea
nMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
at org.springframework.context.annotation.LoadTimeWeavingConfiguration$$
EnhancerBySpringCGLIB$$412ffa57.loadTimeWeaver(<generated>)
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:166)
... 24 more
I have used following configuration for spring
#Configuration
#EnableAutoConfiguration(exclude = {HibernateJpaAutoConfiguration.class,
DataSourceAutoConfiguration.class})
#ComponentScan
#PropertySource("classpath:config/${ENV:dev}.properties")
#EnableWebMvcSecurity
#Import(value = {IntegrationConfiguration.class, LoadTimeWeavingConfiguration.class})
#EnableMetrics
#EnableCaching(mode=AdviceMode.ASPECTJ)
#EnableLoadTimeWeaving(aspectjWeaving = EnableLoadTimeWeaving.AspectJWeaving.ENABLED)
My pom.xml has the following dependencies
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pts</groupId>
<artifactId>pts-web</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<start-class>pts.web.Starter</start-class>
</properties>
<dependencies>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.8.3</version>
</dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-spring</artifactId>
</dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-spring-security</artifactId>
</dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ryantenney.metrics</groupId>
<artifactId>metrics-spring</artifactId>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<artifactId>metrics-annotation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.github.trecloux</groupId>
<artifactId>yeoman-maven-plugin</artifactId>
<version>0.1</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>yo/dist</directory>
</fileset>
<fileset>
<directory>yo/.tmp</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>yo/dist/</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>1.8</source>
<target>1.8</target>
<complianceLevel>1.8</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Can anyone give me and idea why its working through the IDE but not independently after packaging? I am running it with the following command,
java -DENV=production -jar /home/pts-java/pts-web.war --server.port=8080

Categories

Resources