Spring Boot - java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - spring-boot

Just created a quick and simple 'sandbox' application to test out Spring-boot.
I'm getting the following error when attempting to run it -regardless of the versioning (tried to drop down to 1.4.7.RELEASE as well).
Also, almost all of the answers I've read on other posts seems to indicate that there's a mismatch in the versions somewhere -but how is that possible in this case? I was attempting to use the parent to avoid versioning conflicts to begin with.
POM
<?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.sandbox.springboot</groupId>
<artifactId>SpringBootSandbox</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringBootSandbox</name>
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
ApplicationRunner
#SpringBootApplication//(scanBasePackages = "com.sandbox")
#ComponentScan("com.sandbox")
public class ApplicationRunner extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ApplicationRunner.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(ApplicationRunner.class, args);
}
}
Exception
2017-10-20 10:48:42.483 WARN 8828 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around
2017-10-20 10:48:42.485 ERROR 8828 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2805c96b: startup date [Fri Oct 20 10:48:42 EDT 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:372) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1187) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1176) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at com.sandbox.configuration.ApplicationRunner.main(ApplicationRunner.java:31) [classes/:na]

After some playing around... and checking other Spring boot setups, I adjusted my ApplicationRunner as follows, and it seems to run without error now. I'm still looking into what the difference is between these approaches and why this one works.
#SpringBootApplication
#ComponentScan("com.sandbox")
public class BootApplicationRunner implements ApplicationRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(BootApplicationRunner.class, args);
}
public void run(ApplicationArguments args) throws Exception {
}
}

Related

Spring server doesn't start with actuator dependency

If I add spring boot actuator dependency my server doesn't start. I get the following error:
SEVERE [main] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying deployment descriptor [tomcat path\conf\Catalina\localhost\test.xml]
java.lang.IllegalStateException: Error starting child
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:720)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:692)
...
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/agromarket]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
... 37 more
Caused by: java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext
at rs.navigator.alexandar.sync.WebAppInitializer.onStartup(WebAppInitializer.java:34)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
Dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Any ideas why? From my knowledge even if the versions aren't compatible the server should still be able to start.
Edit:
My WebAppInitializer:
public class WebAppInitializer implements WebApplicationInitializer {
public void onStartup(ServletContext servletContext) throws ServletException {
System.out.println(("------------------ Sync context initialized and application started ------------------"));
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
// ctx.register(ServletContextListener.class);
// ctx.register(SecurityConfiguration.class);
// ctx.register(SpringFoxConfig.class);
// ctx.register(WebMvcConfigure.class);
// ctx.register(JPAConfiguration.class);
// ctx.setServletContext(servletContext);
// Reconfigure log4j
// ServletContext sctx = ctx.getServletContext();
System.setProperty("logFilename", servletContext.getContextPath().substring(1));
org.apache.logging.log4j.core.LoggerContext sctxLog =
(org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false);
sctxLog.reconfigure();
//Dispatcher servlet
ServletRegistration.Dynamic servlet = servletContext.addServlet("mvc-dispatcher", new DispatcherServlet(ctx));
servlet.setLoadOnStartup(1);
servlet.addMapping("/");
ctx.close();
}
}
Error stack after adding #EnableAutoConfiguration
If you want benefit from the automatic features of Spring Boot, your #Configuration class must be annotated with #EnableAutoConfiguration.
Since the auto-configuration already creates a DispatcherServlet bound to /, you can safely change your WebAppInitializer class to:
#SpringBootApplication
public class WebAppInitializer extends SpringBootServletInitializer {
}

org.springframework.core.convert.TypeDescriptor Class not found?

I was trying to do experiments about spring IOC and I write ServiceBean as well as a beans.xml file. I try to instantiate a service bean like this in my Application:
public class SpringTrialApplication {
public static void main(String[] args) throws IOException {
SpringTrialApplication main = new SpringTrialApplication();
XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("beans.xml",main.getClass().getClassLoader() ));
// use service bean:
ServiceBean service = (ServiceBean)factory.getBean("service");
// com.ServiceBean service = new com.MyServiceBean();
service.addUser("bill", "hello");
service.addUser("tom", "goodbye");
service.addUser("tracy", "morning");
System.out.println("tom's password is: " + service.getPassword("tom"));
if(service.findUser("tom")) {
service.deleteUser("tom");
}
}
}
And I can read the beans.xml successfully, but it failed to create a bean due to the not-found class org.springframework.core.convert.TypeDescriptor. Below is my log:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'service' defined in class path resource [beans.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/convert/TypeDescriptor
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:955)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:901)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at com.SpringTrialApplication.main(SpringTrialApplication.java:27)
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/convert/TypeDescriptor
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:950)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.core.convert.TypeDescriptor
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)
... 9 more
Process finished with exit code 1
and my beans.xml like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="service" class="com.MyServiceBean" />
</beans>
My workspace like this:
directory
following dependencies are used in my project:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.5.6</version>
</dependency>
So is that because spring framework change inner structure in 3.x? How can I solve this problem?
Make the same version in spring-beans and spring-core resolve the problem.

Server Sent Events with Spring Boot and WebFlux

I am working on Server Sent Events. I took help from
http://sinhamohit.com/writing/spring-boot-reactive-sse
https://github.com/mohitsinha/spring-boot-reactive-sse
The issue with the above example is everything is defined in one class. I am trying to do it different classes but it fails with exception:
2018-08-20 17:03:15.521 WARN 10964 --- [ main]
onfigReactiveWebServerApplicationContext : Exception encountered during
context initialization - cancelling refresh attempt:
org.springframework.context.ApplicationContextException: Unable to start
reactive web server; nested exception is
org.springframework.context.ApplicationContextException: Unable to start
ReactiveWebApplicationContext due to missing ReactiveWebServerFactory bean.
2018-08-20 17:03:15.599 ERROR 10964 --- [ main]
o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start
reactive web server; nested exception is
org.springframework.context.ApplicationContextException: Unable to start
ReactiveWebApplicationContext due to missing ReactiveWebServerFactory bean.
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:76) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:61) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:330) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at hello.SpringBootApplication.main(SpringBootApplication.java:8) [classes/:na]
Code:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
#RestController
#RequestMapping("/stock/transaction")
public class StockTransactionController {
#Autowired
StockTransactionService stockTransactionService;
#GetMapping(produces = MediaType.APPLICATION_STREAM_JSON_VALUE)
public Flux<StockTransaction> stockTransactionEvents() {
return stockTransactionService.getStockTransactions();
}
}
#Service
public class StockTransactionService {
List<Stock> stockList = new ArrayList<>();
List<String> stockNames =
Arrays.asList("mango,banana,guava,infinity".split(","));
#Bean
CommandLineRunner commandLineRunner() {
return args -> {
createRandomStock();
stockList.forEach(System.out::println);
};
}
public Flux<StockTransaction> getStockTransactions() {
Flux<Long> interval = Flux.interval(Duration.ofSeconds(1));
interval.subscribe((i) -> stockList.forEach(stock ->
stock.setPrice(changePrice(stock.getPrice()))));
Flux<StockTransaction> stockTransactionFlux = Flux
.fromStream(Stream.generate(() -> new
StockTransaction(getRandomUser(), getRandomStock(), new Date())));
return Flux.zip(interval, stockTransactionFlux).map(Tuple2::getT2);
}
}
Please help.
The problem was with annotation. #SpringBootApplication

Spring Integration Java DSL problems at startup with Http Outbound Gateway

I'm new to Spring Integration and am trying to develop an application which simply (1) polls a folder for new files with extension .dat containing data in csv format (2) initialize for each line a domain POJO object of class RecordDTO and finally (3) sends this object as payload to a REST service with a POST.
For this I'm trying to use Java DSL for Spring Integration.
The problem I'm getting is the following VerifyError / HttpRequestExecutingMessageHandler overrides final method onInit. exception.
2016-07-22 10:01:38.965 ERROR 4460 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'upcase' defined in eu.softeco.examples.SpringBootIntegrationTestApplication: Initialization of bean failed; nest
ed exception is java.lang.VerifyError: class org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler overrides final method onInit.()V
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
...
Caused by: java.lang.VerifyError: class org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler overrides final method onInit.()V
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_45]
at java.lang.ClassLoader.defineClass(ClassLoader.java:760) ~[na:1.8.0_45]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_45]
...
Below are relevant details concerning my code and maven configuration. Please not that
1) the problem is at startup, before any data is put in the input folder
2) if I replace the final Http outboundGateway step with the simple (commented) System.out.println, everything works fine.
Following are code/config details. This is my main Spring Boot application class with Spring Integration Flow definition:
#SpringBootApplication
#EnableIntegration
#IntegrationComponentScan
public class SpringBootIntegrationTestApplication {
...
public static void main(String[] args) {
SpringApplication.run(SpringBootIntegrationTestApplication.class, args);
}
/**
* Inbound FileReadingMessageSource
*/
#Bean
#InboundChannelAdapter(channel = "upcase.input", poller = #Poller(fixedDelay = "4000"))
public MessageSource<File> fileReadingMessageSource() {
FileReadingMessageSource source = new FileReadingMessageSource();
source.setDirectory(new File(INBOUND_PATH));
source.setFilter(new SimplePatternFileListFilter("*.dat"));
return source;
}
/**
* Spring Integration Java DSL Flow
*/
#Bean
public IntegrationFlow upcase() {
FileToStringTransformer fileToStringTranformer = Transformers.fileToString();
fileToStringTranformer.setDeleteFiles(true);
return flow -> flow
// get string contents from fie
.transform(fileToStringTranformer)
// split into individual lines
.split( s -> s.applySequence(true).get().getT2().setDelimiters("\n"))
// cleanup lines from trailing returns
.transform( (String s) -> s.replace("\n", "").replace("\r", "") )
// convert csv string to RecordDTO object
.transform("#recordFromCsvTransformer.transform(payload)")
// print on System.out
// .handle(m -> System.out.println(m.getPayload()))
// send to
.handle(Http.outboundGateway("http://localhost:8080/records")
.httpMethod(HttpMethod.POST)
.expectedResponseType(RecordDTO.class));
}
}
Below the RecordFromCsvTransformer class
#Component
public class RecordFromCsvTransformer
{
#Transformer
public RecordDTO transform(String csvline) throws Exception {
RecordDTO record = new RecordDTO();
... parse csv and initialize record's fields...
return record;
}
}
And Finally the relevant parts of pom.xml (dependencies);
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RC1</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
...
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-file</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-http</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
...
</dependencies>
...
As a side question in general, can someone suggest me some good tutorial / getting started guide to learn Spring Integration with Java Annotation/Java DSL? So far I've only found either introductory guide based on Spring Integration XML configuration or material about Java Annotations/DSL but that already requires prior knowledge of Spring Integration.
<version>2.1.0.RELEASE</version>
That version of Spring Integration is mismatched with the spring-integration-core version brought in transitively by maven.
You need to use the same version of all spring-integration-* files - check which version of spring-integration-file is being pulled in by boot and use the same version.

I can't start tomcat 7 server on linux openshift - Failed to start end point associated with ProtocolHandler ["http-nio-12345"]

I've checked out this question which is very similar to mine, however the difference is I'm using a port > 1024 (i.e. I'm using port 12345) which is what the answerer said to do. I'm trying to run a Tomcat instance on an Openshift server.. Any help is appreciated! Thanks!
My execution script is as follows:
nohup java -Xms384m -Xmx412m -jar target/*.war --server.port=12345
Note the "-jar" is this right? I am deploying a .war file not a .jar? I think.. Sorry, a little new to this.
The important part of my error output is as follows:
2015-10-07 19:30:13.317 INFO 261765 --- [ main]
o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX
exposure on startup 2015-10-07 19:30:13.409 DEBUG 261765 --- [
main] o.s.w.s.resource.ResourceUrlProvider : Looking for resource
handler mappings 2015-10-07 19:30:13.411 DEBUG 261765 --- [
main] o.s.w.s.resource.ResourceUrlProvider : Found resource
handler mapping: URL pattern="/**/favicon.ico", locations=[class path
resource [META-INF/resources/], class path resource [resources/],
class path resource [static/], class path resource [public/], class
path resource []],
resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#f5e53a1]
2015-10-07 19:30:13.412 DEBUG 261765 --- [ main]
o.s.w.s.resource.ResourceUrlProvider : Found resource handler
mapping: URL pattern="/webjars/**", locations=[class path resource
[META-INF/resources/webjars/]],
resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#1f5137b7]
2015-10-07 19:30:13.414 DEBUG 261765 --- [ main]
o.s.w.s.resource.ResourceUrlProvider : Found resource handler
mapping: URL pattern="/**", locations=[ServletContext resource [/],
class path resource [META-INF/resources/], class path resource
[resources/], class path resource [static/], class path resource
[public/]],
resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#3f8892d1]
2015-10-07 19:30:14.022 ERROR 261765 --- [ main]
o.a.coyote.http11.Http11NioProtocol : Failed to start end point
associated with ProtocolHandler ["http-nio-12345"]
java.net.SocketException: Permission denied at
sun.nio.ch.Net.bind0(Native Method) at
sun.nio.ch.Net.bind(Net.java:436) at
sun.nio.ch.Net.bind(Net.java:428) at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473)
at
org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:653)
at
org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:449)
at
org.apache.catalina.connector.Connector.startInternal(Connector.java:1007)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.StandardService.addConnector(StandardService.java:241)
at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186)
at ...
application.properties:
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
error.whitelabel.enabled=false
server.port=12345
web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Demo Web Application</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<!--<url-pattern>/</url-pattern>-->
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
mvc-dispatcher-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<mvc:annotation-driven />
</beans>
And finally...
Application.java
package hello;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
#RestController
#SpringBootApplication
public class Application extends SpringBootServletInitializer {
#Autowired
UserRepository userRepository;
#RequestMapping ("/isRunning")
boolean isRunning () {
return true;
}
#RequestMapping ("/")
String home () {
return "Home";
}
#Override
protected SpringApplicationBuilder configure (SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main (String[] args) {
SpringApplication.run(Application.class);
System.out.println("RUNNING! :D");
}
}
And finally...
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<groupId>org.springframework</groupId>
<artifactId>gs-crud-with-vaadin</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.6.RELEASE</version>
</parent>
<properties>
<java.version>1.7</java.version>
<tomcat.version>7.0.59</tomcat.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-log4j</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-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
UPDATE 1
Okay, so I ran rhc app-tidy -a {APP_NAME} and it now deploys fine and launched and works fine but I am still having the same error log output... Why is this? What's wrong?
2015-10-08 03:15:41.254 ERROR 290379 --- [ main]
o.a.coyote.http11.Http11NioProtocol : Failed to start end point
associated with ProtocolHandler ["http-nio-8080"]
java.net.SocketException: Permission denied at
sun.nio.ch.Net.bind0(Native Method) at
sun.nio.ch.Net.bind(Net.java:436) at
sun.nio.ch.Net.bind(Net.java:428) at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473)
at
org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:653)
at
org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:449)
at
org.apache.catalina.connector.Connector.startInternal(Connector.java:1007)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.StandardService.addConnector(StandardService.java:241)
at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186)
at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:149)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:967)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:956)
at hello.Application.main(Application.java:41) 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:483) at
org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
2015-10-08 03:15:41.263 ERROR 290379 --- [ main]
o.apache.catalina.core.StandardService : Failed to start connector
[Connector[org.apache.coyote.http11.Http11NioProtocol-8080]]
org.apache.catalina.LifecycleException: Failed to start component
[Connector[org.apache.coyote.http11.Http11NioProtocol-8080]] at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at
org.apache.catalina.core.StandardService.addConnector(StandardService.java:241)
at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:186)
at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:149)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:967)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:956)
at hello.Application.main(Application.java:41) 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:483) at
org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745) Caused by:
org.apache.catalina.LifecycleException: service.getName(): "Tomcat";
Protocol handler start failed at
org.apache.catalina.connector.Connector.startInternal(Connector.java:1014)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 18 common frames omitted Caused by: java.net.SocketException:
Permission denied at sun.nio.ch.Net.bind0(Native Method) at
sun.nio.ch.Net.bind(Net.java:436) at
sun.nio.ch.Net.bind(Net.java:428) at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473)
at
org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:653)
at
org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:449)
at
org.apache.catalina.connector.Connector.startInternal(Connector.java:1007)
... 19 common frames omitted
2015-10-08 03:15:41.347 INFO 290379 --- [ main]
o.apache.catalina.core.StandardService : Stopping service Tomcat
2015-10-08 03:15:41.682 INFO 290379 --- [ main]
.b.l.ClasspathLoggingApplicationListener : Application failed to start
with classpath:
[file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/classes!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-data-jpa-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-1.2.6.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-1.2.6.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-autoconfigure-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-logging-1.2.6.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/log4j-over-slf4j-1.7.12.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/logback-classic-1.1.3.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/logback-core-1.1.3.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/snakeyaml-1.14.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-aop-1.2.6.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-aop-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/aopalliance-1.0.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/aspectjrt-1.8.6.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/aspectjweaver-1.8.6.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-core-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-jdbc-1.2.6.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-jdbc-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/tomcat-jdbc-7.0.59.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/tomcat-juli-7.0.59.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-tx-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-entitymanager-4.3.11.Final.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jboss-logging-3.1.3.GA.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jboss-logging-annotations-1.2.0.Beta1.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-core-4.3.11.Final.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/antlr-2.7.7.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jandex-1.1.0.Final.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/dom4j-1.6.1.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/xml-apis-1.0.b2.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-commons-annotations-4.0.5.Final.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/javassist-3.18.1-GA.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/javax.transaction-api-1.2.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-orm-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-beans-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-data-jpa-1.7.3.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-data-commons-1.9.3.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-context-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/slf4j-api-1.7.12.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-aspects-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-log4j-1.2.6.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jcl-over-slf4j-1.7.12.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jul-to-slf4j-1.7.12.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/slf4j-log4j12-1.7.12.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/log4j-1.2.17.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-boot-starter-web-1.2.6.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jackson-databind-2.4.6.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jackson-annotations-2.4.6.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/jackson-core-2.4.6.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/hibernate-validator-5.1.3.Final.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/validation-api-1.1.0.Final.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/classmate-1.0.0.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-web-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-webmvc-4.1.7.RELEASE.jar!/, jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/spring-expression-4.1.7.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib/h2-1.4.188.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/spring-boot-starter-tomcat-1.2.6.RELEASE.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/tomcat-embed-core-7.0.59.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/tomcat-embed-el-7.0.59.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/tomcat-embed-logging-juli-7.0.59.jar!/,
jar:file:/var/lib/openshift/5612fdaa89f5cfa2090000dd/app-root/runtime/repo/target/gs-crud-with-vaadin-0.1.0.war!/WEB-INF/lib-provided/tomcat-embed-websocket-7.0.59.jar!/]
2015-10-08 03:15:41.683 INFO 290379 --- [ main]
utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration
report enable debug logging (start with --debug)
2015-10-08 03:15:41.724 ERROR 290379 --- [ main]
o.s.boot.SpringApplication : Application startup failed
java.lang.IllegalStateException: Tomcat connector in failed state at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:967)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:956)
at hello.Application.main(Application.java:41) 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:483) at
org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
2015-10-08 03:15:41.724 INFO 290379 --- [ main]
ationConfigEmbeddedWebApplicationContext : Closing
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#7c2b6a03:
startup date [Thu Oct 08 03:14:59 EDT 2015]; root of context hierarchy
2015-10-08 03:15:41.739 INFO 290379 --- [ main]
o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed
beans on shutdown 2015-10-08 03:15:41.777 INFO 290379 --- [
main] j.LocalContainerEntityManagerFactoryBean : Closing JPA
EntityManagerFactory for persistence unit 'default'
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:483) at
org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745) Caused by:
java.lang.IllegalStateException: Tomcat connector in failed state at
org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:157)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:288)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:967)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:956)
at hello.Application.main(Application.java:41) ... 6 more Starting
jbossews cartridge Found 127.7.143.1:8080 listening port Archiving
artifacts Unable to auto-install JDK until the license is accepted.
Finished: SUCCESS
As described here, OpenShift restricts the ports that an application can bind to. You can use 15000 - 35530 to bind an internal IP. You can also use 8080, and must do so if you want your Spring Boot app to be externally accessible.
You also need to bind to the correct address. There's an example showing how to configure the address and port using OpenShift's environment variables in the Spring Boot documentation:
nohup java -jar target/*.jar --server.port=${OPENSHIFT_DIY_PORT} --server.address=${OPENSHIFT_DIY_IP} &
So, the exception that was being thrown should have been a StupidDeveloperException. Anyway, I had already started tomcat on that port and wasn't stopping it before trying to bind it again to the same port, resulting in that error. Thanks guys for all your input!

Resources