Spring boot with IBM websphere application server - spring

I am encountering issues while trying to use spring boot with a WAS(Websphere) server.
I have a webpage that accepts input and then executes #controller class.
Any help would be appreciated . Is that anything special we need to do in POM.xml for IBM websphere.
Below is my application class content.
#Configuration
#ComponentScan
#EnableAutoConfiguration
public class Application extends SpringBootServletInitializer{
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
} }
I have added >packaging>war in my pom.xml
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
... 14 more
Spring-boot:run gives me below error trace.
2016-01-13 16:03:05.331 ERROR 8004 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:347) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:295) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1112) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1101) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at hello.Application.main(Application.java:23) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) ~[na:1.7.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) ~[na:1.7.0]
at java.lang.reflect.Method.invoke(Method.java:620) ~[na:2.6 (11-14-2014)]
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:467) [spring-boot-maven-plugin-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at java.lang.Thread.run(Thread.java:795) [na:1.7.0]
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130) ~[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
... 14 common frames omitted
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:467)
at java.lang.Thread.run(Thread.java:795)
Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:347)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:295)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1112)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1101)
at hello.Application.main(Application.java:23)
... 6 more
Caused by: org.springframework.context.ApplicationContextException:
Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
... 14 more
[INFO] ----------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ----------------------------------------------------------------

You can use the WebSphere Liberty Starter application to create a Spring Boot application that will run on WebSphere Liberty:
http://liberty-starter.wasdev.developer.ibm.com
Just check the "Spring Boot with Spring MVC" and click Download Project. The generate project will contain everything that you need to run a simple Spring Boot project on WebSphere Liberty:
The Application class (the one you posted above looks correct already)
The pom.xml file to include all the necessary SpringBoot dependencies (I suspect that you have something missing here). It will also contain the necessary bits to create a WAR file and deploy it to WebSphere Liberty so that you can see it running straight away.
There is also a generate example Spring MVC endpoint and test class so that you can see a running example.

Related

Im having a problem of dependency with springboot-web-embed-tomcat it gives me the following error in log

I have cleared and excluded every spring-boot-starter-tomcat from all spring-boot-starter-anything and still!
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.configureContext(TomcatServletWebServerFactory.java:367)
The following method did not exist:
org.apache.catalina.Context.addServletContainerInitializer(Ljavax/servlet/ServletContainerInitializer;Ljava/util/Set;)V
The method's class, org.apache.catalina.Context, is available from the following locations:
jar:.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/10.0.2/tomcat-embed-core-10.0.2.jar!/org/apache/catalina/Context.class
The class hierarchy was loaded from the following locations:
org.apache.catalina.Context: .m2/repository/org/apache/tomcat/embed/tomcat-embed-core/10.0.2/tomcat-embed-core-10.0.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.apache.catalina.Context
after downgrading tomcat from 10.0.2 to 9.0.43 it also couldn't start and wrote application run failed and gave me the following stack trace:
ERROR o.s.boot.SpringApplication.reportFailure - Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:582)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298)
at com.ebs.dda.config.ApplicationLauncher.main(ApplicationLauncher.java:64)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104)
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:451)
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:200)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159)
... 14 common frames omitted
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:187)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126)
... 19 common frames omitted

Grails 4.0.0 database migrations setup - cannot find class CommonsLoggingLiquibaseLogger using IntelliJ

My Grails Spring Security Core app fails at runtime after I add the following to build.gradle:
compile 'org.grails.plugins:database-migration:3.0.4'
This line is directly from the Grails database migration plugin tutorial for setting up migrations, but my project blows up after I add it. I receive the following error:
java.lang.NoClassDefFoundError: org/springframework/boot/liquibase/CommonsLoggingLiquibaseLogger
Has anyone encountered this? Can you suggest a fix please?
Using Grails 4.0.0, IntelliJ, Windows 10.
The full error output:
2019-09-13 10:40:40.658 ERROR --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
java.lang.NoClassDefFoundError: org/springframework/boot/liquibase/CommonsLoggingLiquibaseLogger
at org.grails.plugins.databasemigration.DatabaseMigrationGrailsPlugin.configureLiquibase(DatabaseMigrationGrailsPlugin.groovy:97)
at org.grails.plugins.databasemigration.DatabaseMigrationGrailsPlugin.doWithSpring(DatabaseMigrationGrailsPlugin.groovy:50)
at org.grails.plugins.DefaultGrailsPlugin.doWithRuntimeConfiguration(DefaultGrailsPlugin.java:539)
at org.grails.plugins.AbstractGrailsPluginManager.doRuntimeConfiguration(AbstractGrailsPluginManager.java:166)
at grails.boot.config.GrailsApplicationPostProcessor.postProcessBeanDefinitionRegistry(GrailsApplicationPostProcessor.groovy:171)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:125)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
at grails.boot.GrailsApp.run(GrailsApp.groovy:97)
at grails.boot.GrailsApp.run(GrailsApp.groovy:458)
at grails.boot.GrailsApp.run(GrailsApp.groovy:445)
at marinedebristracker.Application.main(Application.groovy:11)
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.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.liquibase.CommonsLoggingLiquibaseLogger
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 22 common frames omitted
This is what I needed to add to build.gradle instead, cleared the liquibase error right up:
dependencies {
compile 'org.grails.plugins:database-migration:3.1.0.RC1'
}
found here: https://plugins.grails.org/plugin/grails/database-migration

Application failed to start with classpath in STS Spring Boot Maven project

I want to run Spring Boot project in Spring Tool Suite, so when I run as Spring Boot App, this error occur in my log file:
> Application failed to start with classpath: [file:/C:/Users/Xonos/Desktop/ElasticSpringIndexer/target/classes/, file:/C:/Users/Xonos/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/1.2.3.RELEASE/spring-boot-starter-data-jpa-1.2.3.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/boot/spring-boot-starter/1.2.3.RELEASE/spring-boot-starter-1.2.3.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/boot/spring-boot/1.2.3.RELEASE/spring-boot-1.2.3.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.3.RELEASE/spring-boot-autoconfigure-1.2.3.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.2.3.RELEASE/spring-boot-starter-logging-1.2.3.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/slf4j/jul-to-slf4j/1.7.11/jul-to-slf4j-1.7.11.jar, file:/C:/Users/Xonos/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.11/log4j-over-slf4j-1.7.11.jar, file:/C:/Users/Xonos/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar, file:/C:/Users/Xonos/.m2/repository/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar, file:/C:/Users/Xonos/.m2/repository/org/yaml/snakeyaml/1.14/snakeyaml-1.14.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/boot/spring-boot-starter-aop/1.2.3.RELEASE/spring-boot-starter-aop-1.2.3.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/aspectj/aspectjrt/1.8.5/aspectjrt-1.8.5.jar, file:/C:/Users/Xonos/.m2/repository/org/aspectj/aspectjweaver/1.8.5/aspectjweaver-1.8.5.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-core/4.1.6.RELEASE/spring-core-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.2.3.RELEASE/spring-boot-starter-jdbc-1.2.3.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-jdbc/4.1.6.RELEASE/spring-jdbc-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/tomcat/tomcat-jdbc/8.0.20/tomcat-jdbc-8.0.20.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/tomcat/tomcat-juli/8.0.20/tomcat-juli-8.0.20.jar, file:/C:/Users/Xonos/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.8.Final/hibernate-entitymanager-4.3.8.Final.jar, file:/C:/Users/Xonos/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar, file:/C:/Users/Xonos/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar, file:/C:/Users/Xonos/.m2/repository/org/hibernate/hibernate-core/4.3.8.Final/hibernate-core-4.3.8.Final.jar, file:/C:/Users/Xonos/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar, file:/C:/Users/Xonos/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar, file:/C:/Users/Xonos/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar, file:/C:/Users/Xonos/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar, file:/C:/Users/Xonos/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.5.Final/hibernate-commons-annotations-4.0.5.Final.jar, file:/C:/Users/Xonos/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar, file:/C:/Users/Xonos/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar, file:/C:/Users/Xonos/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-orm/4.1.6.RELEASE/spring-orm-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/data/spring-data-jpa/1.7.2.RELEASE/spring-data-jpa-1.7.2.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-aspects/4.1.6.RELEASE/spring-aspects-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/com/h2database/h2/1.4.185/h2-1.4.185.jar, file:/C:/Users/Xonos/.m2/repository/org/hsqldb/hsqldb/2.3.2/hsqldb-2.3.2.jar, file:/C:/Users/Xonos/.m2/repository/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar, file:/C:/Users/Xonos/.m2/repository/commons-pool/commons-pool/1.6/commons-pool-1.6.jar, file:/C:/Users/Xonos/.m2/repository/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-test/4.1.6.RELEASE/spring-test-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-web/4.1.6.RELEASE/spring-web-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-aop/4.1.6.RELEASE/spring-aop-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-beans/4.1.6.RELEASE/spring-beans-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-context/4.1.6.RELEASE/spring-context-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-expression/4.1.6.RELEASE/spring-expression-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.4.5/jackson-databind-2.4.5.jar, file:/C:/Users/Xonos/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.5/jackson-annotations-2.4.5.jar, file:/C:/Users/Xonos/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.4.5/jackson-core-2.4.5.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/data/spring-data-elasticsearch/1.2.0.RELEASE/spring-data-elasticsearch-1.2.0.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/spring-tx/4.1.6.RELEASE/spring-tx-4.1.6.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/org/springframework/data/spring-data-commons/1.9.2.RELEASE/spring-data-commons-1.9.2.RELEASE.jar, file:/C:/Users/Xonos/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar, file:/C:/Users/Xonos/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar, file:/C:/Users/Xonos/.m2/repository/joda-time/joda-time/2.5/joda-time-2.5.jar, file:/C:/Users/Xonos/.m2/repository/org/elasticsearch/elasticsearch/1.4.4/elasticsearch-1.4.4.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-core/4.10.3/lucene-core-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-analyzers-common/4.10.3/lucene-analyzers-common-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-queries/4.10.3/lucene-queries-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-memory/4.10.3/lucene-memory-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-highlighter/4.10.3/lucene-highlighter-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-queryparser/4.10.3/lucene-queryparser-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-sandbox/4.10.3/lucene-sandbox-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-suggest/4.10.3/lucene-suggest-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-misc/4.10.3/lucene-misc-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-join/4.10.3/lucene-join-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-grouping/4.10.3/lucene-grouping-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/org/apache/lucene/lucene-spatial/4.10.3/lucene-spatial-4.10.3.jar, file:/C:/Users/Xonos/.m2/repository/com/spatial4j/spatial4j/0.4.1/spatial4j-0.4.1.jar, file:/C:/Users/Xonos/.m2/repository/org/antlr/antlr-runtime/3.5/antlr-runtime-3.5.jar, file:/C:/Users/Xonos/.m2/repository/org/ow2/asm/asm/4.1/asm-4.1.jar, file:/C:/Users/Xonos/.m2/repository/org/ow2/asm/asm-commons/4.1/asm-commons-4.1.jar, file:/C:/Users/Xonos/.m2/repository/org/slf4j/slf4j-api/1.7.11/slf4j-api-1.7.11.jar, file:/C:/Users/Xonos/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.11/jcl-over-slf4j-1.7.11.jar] [7556] [o.s.b.l.ClasspathLoggingApplicationListener]
16:00:35.820 INFO -
> Error starting ApplicationContext. To display the auto-configuration report enabled debug logging (start with --debug)
> [7557] [o.s.b.a.l.AutoConfigurationReportLoggingInitializer]
16:00:35.826 ERROR - Application startup failed [7563] [o.s.boot.SpringApplication]
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:675) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:690) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
at my.com.tmgeomatics.ElasticIndexer.geocoding.EsIndexingApplication.main(EsIndexingApplication.java:44) [classes/:na]
Caused by: java.lang.ArithmeticException: / by zero
at my.com.tmgeomatics.ElasticIndexer.util.ProgressBar.update(ProgressBar.java:30) ~[classes/:na]
at my.com.tmgeomatics.ElasticIndexer.geocoding.EsIndexingApplication.BulkIndexing(EsIndexingApplication.java:82) [classes/:na]
at my.com.tmgeomatics.ElasticIndexer.geocoding.EsIndexingApplication.run(EsIndexingApplication.java:53) [classes/:na]
at org.springframework.boot.SpringApplication.runCommandLineRunners(SpringApplication.java:672) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
... 5 common frames omitted
Main focus is the Application failed to start with classpath, my guess is because my project can't get the jar file for DB and many other functions, that's why finally it come out the error said that divide by zero error as it can't retrieve any data at all...
I had look around but can't find any answer at all, hope everyone can help...

Spring Boot, Maven and missing EmbeddedServletContainerFactory bean

Spring Boot (1.2.5.RELEASE) Web Application project (spring-boot-starter-web), built with Maven (3.3.3), runs when executing JAR file created in /target directory
java -jar magic-supplies-1.0.0.jar
But fails to execute when running maven command
mvn spring-boot:run
with the following stack trace:
16:32:36:125 | cogito.online.application.MagicSuppliesApplication.main() | Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:473)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at cogito.online.application.MagicSuppliesApplication.main(MagicSuppliesApplication.java:10)
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:497)
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:418)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
... 13 more
[WARNING]
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:497)
at org.springframework.boot.maven.RunMojo$LaunchRunner.run(RunMojo.java:418)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:473)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at cogito.online.application.MagicSuppliesApplication.main(MagicSuppliesApplication.java:10)
... 6 more
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
... 13 more
It has a simple configuration
#Configuration
#EnableAutoConfiguration
#ComponentScan ("cogito.online")
#ImportResource("classpath:spring-activemq.xml")
public class MagicSuppliesConfiguration {
}
and application class
#Import(MagicSuppliesConfiguration.class)
public class MagicSuppliesApplication {
public static void main(String[] args) {
SpringApplication.run(MagicSuppliesApplication.class, args);
}
}
Again everything works, both web and jms requests, when running the executable JAR but fails when running the Maven Spring Boot command.
Any help would be greatly appreciated...minus any snarky trolling on Maven ;)

Deploying JPA and Spring based module in Servicemix

I'm trying to deploy a bundle in servicemix 5.1.0, that uses spring 3.2.4.RELEASE. When I try to start it, I get this error:
1 model WARN [SpringOsgiExtenderThread-14] openjpa.Runtime - An error occurred while registering a ClassTransformer with PersistenceUnitInfo: name 'model', root URL [bundle://271.0:1]. The error is logged along with this warning. Load-time class transformation will not be available.java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy32.addTransformer(Unknown Source)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:169)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager$Jpa2PersistenceUnitInfoDecorator.invoke(DefaultPersistenceUnitManager.java:617)
... 21 more
Caused by: java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified
at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:109)
... 26 more
Can anyone tell me what should I do to get rid of this warning/error?
To solve this error, I put this on spring configuration file (spring-config.xml):
<ctx:load-time-weaver weaver-class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver" />
My deduction is that in Spring 3.2.4.RELEASE, there is only this class for load-time weaving. The other ones that I tried are not disponible for this Spring version. (By other ones I mean ReflectiveLoadTimeWeaver and InstrumentationLoadTimeWeaver).

Resources