New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot 1.1.4.Release - Deploying to Tomcat and Websphere Liberty #1244

Closed
naruraghavan opened this Issue Jul 12, 2014 · 7 comments

Comments

Projects
None yet
3 participants
@naruraghavan

naruraghavan commented Jul 12, 2014

Here is my build.gradle:

configurations {
    querydslapt
    provided
}

buildscript {
    repositories {
        maven { url "http://repo.spring.io/libs-release" }
        maven { url "http://repo.spring.io/libs-snapshot" }
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.4.RELEASE")
        classpath("org.flywaydb:flyway-gradle-plugin:3.0")
        classpath("com.h2database:h2:1.4.178")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'flyway'
apply plugin: 'war'

jar {
    baseName = 'netstar-content-rest-services'
    version = '1.0.0'
}

war {
    baseName = 'ncrs'
}

sourceCompatibility = 1.7

//applicationDefaultJvmArgs = [
//        "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
//]

repositories {
    mavenLocal()
    mavenCentral()
    maven { url "http://repo.spring.io/libs-release" }
    maven { url "https://repository.jboss.org/nexus/content/repositories/releases" }
    maven { url "http://repo.spring.io/libs-snapshot" }
}

sourceSets {
    main.compileClasspath += configurations.provided
    test.compileClasspath += configurations.provided
    test.runtimeClasspath += configurations.provided
}

flyway {
    url = "jdbc:h2:tcp://localhost/./netstar-content"
    user = 'sa'
}


dependencies {
    versionManagement 'io.spring.platform:platform-versions:1.0.1.RELEASE@properties'

    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("org.springframework.boot:spring-boot-starter-data-rest")
    compile("com.fasterxml.jackson.core:jackson-databind")
    compile("org.springframework.hateoas:spring-hateoas")

    compile("org.springframework.plugin:spring-plugin-core")
    compile("net.sf.ehcache:ehcache:2.8.3")
    compile("org.springframework:spring-context-support")
    compile("org.springframework.data:spring-data-redis")
    compile("org.springframework:spring-tx")
    compile("org.springframework:spring-tx-events:1.0.0.BUILD-SNAPSHOT")

    compile("redis.clients:jedis")
    compile("org.apache.commons:commons-pool2")
    compile("com.jayway.jsonpath:json-path")
    compile("com.h2database:h2")
    compile("org.jsoup:jsoup:1.7.3")
    compile('org.apache.commons:commons-lang3')
    compile("org.apache.httpcomponents:httpclient")
    compile("com.cenqua.clover:clover:3.3.0")
    compile("com.jolbox:bonecp:0.8.0.RELEASE")

    // for the anontation processor
    querydslapt group: 'com.mysema.querydsl', name: 'querydsl-jpa', version: '2.8.0', classifier: 'apt-one-jar', transitive: false

    compile group: 'org.projectlombok', name: 'lombok', version: '1.14.2'

    // for compiling
    compile("com.mysema.querydsl:querydsl-jpa")
    compile("com.mysema.querydsl:querydsl-apt")

    compile fileTree(dir: "${project.projectDir}/external/lib", includes: ['*.jar'])

    testCompile("org.springframework.boot:spring-boot-starter-test")

    //For tomcat
    provided("org.springframework.boot:spring-boot-starter-tomcat")

    compile("org.springframework.boot:spring-boot-starter-actuator")
}

//Querydsl

def generatedSrcDir = 'src/main/generated'
task createGeneratedSrcDir << {
    file(generatedSrcDir).mkdirs()
}
compileJava.dependsOn createGeneratedSrcDir

compileJava {
    options.compilerArgs << '-processor' << 'com.mysema.query.apt.jpa.JPAAnnotationProcessor' << '-s' << file(generatedSrcDir).absolutePath
}

clean {
    delete generatedSrcDir
}

task wrapper(type: Wrapper) {
    gradleVersion = '1.11'
}

I don't see lib-provided WEB-INF of the war file when I gradle build.

@naruraghavan

This comment has been minimized.

Show comment
Hide comment
@naruraghavan

naruraghavan Jul 12, 2014

Here is the error message during tomcat server startup:

12-Jul-2014 16:00:14.626 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ncrs]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is java.lang.ArrayStoreException: org.apache.catalina.valves.RemoteIpValve
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(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.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.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.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
    at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89)
    at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:51)
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 10 more
Caused by: java.lang.ArrayStoreException: org.apache.catalina.valves.RemoteIpValve
    at org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat.customizeTomcat(ServerProperties.java:269)
    at org.springframework.boot.autoconfigure.web.ServerProperties.customize(ServerProperties.java:153)
    at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:67)
    at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:54)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:407)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    ... 27 more

12-Jul-2014 16:00:14.627 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /Users/Naru/Servers/apache-tomcat-8.0.9/webapps/ncrs.war
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ncrs]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:727)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

naruraghavan commented Jul 12, 2014

Here is the error message during tomcat server startup:

12-Jul-2014 16:00:14.626 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ncrs]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is java.lang.ArrayStoreException: org.apache.catalina.valves.RemoteIpValve
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(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.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.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.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
    at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89)
    at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:51)
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 10 more
Caused by: java.lang.ArrayStoreException: org.apache.catalina.valves.RemoteIpValve
    at org.springframework.boot.autoconfigure.web.ServerProperties$Tomcat.customizeTomcat(ServerProperties.java:269)
    at org.springframework.boot.autoconfigure.web.ServerProperties.customize(ServerProperties.java:153)
    at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:67)
    at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:54)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:407)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    ... 27 more

12-Jul-2014 16:00:14.627 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /Users/Naru/Servers/apache-tomcat-8.0.9/webapps/ncrs.war
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ncrs]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:727)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
@wilkinsona

This comment has been minimized.

Show comment
Hide comment
@wilkinsona

wilkinsona Jul 13, 2014

Member

This is the same as the comments you made on #1194.

You need to declare the embedded server container dependencies in a configuration named providedRuntime as described here

Member

wilkinsona commented Jul 13, 2014

This is the same as the comments you made on #1194.

You need to declare the embedded server container dependencies in a configuration named providedRuntime as described here

@wilkinsona wilkinsona closed this Jul 13, 2014

@naruraghavan

This comment has been minimized.

Show comment
Hide comment
@naruraghavan

naruraghavan Jul 13, 2014

Thanks Andy. I will try that out and let you know.

Thanks for your prompt response. Much appreciated!!!

+Naru

On Jul 13, 2014, at 3:26 AM, Andy Wilkinson notifications@github.com wrote:

Closed #1244.


Reply to this email directly or view it on GitHub.

naruraghavan commented Jul 13, 2014

Thanks Andy. I will try that out and let you know.

Thanks for your prompt response. Much appreciated!!!

+Naru

On Jul 13, 2014, at 3:26 AM, Andy Wilkinson notifications@github.com wrote:

Closed #1244.


Reply to this email directly or view it on GitHub.

@naruraghavan

This comment has been minimized.

Show comment
Hide comment
@naruraghavan

naruraghavan Jul 13, 2014

Perfect! After changing from provided to providedRuntime, the war deployed and started properly on Tomcat 8. As mentioned in the documentation, looks like, there is no need for declaration:

configurations {
    providedRuntime
}

to be described in the build.gradle.

naruraghavan commented Jul 13, 2014

Perfect! After changing from provided to providedRuntime, the war deployed and started properly on Tomcat 8. As mentioned in the documentation, looks like, there is no need for declaration:

configurations {
    providedRuntime
}

to be described in the build.gradle.

@naruraghavan

This comment has been minimized.

Show comment
Hide comment
@naruraghavan

naruraghavan Jul 22, 2014

I got Spring Boot, Spring IO, and Spring JPA to work on IBM Websphere Application Server. Please read about it here. Any other suggestions are most welcome!!

naruraghavan commented Jul 22, 2014

I got Spring Boot, Spring IO, and Spring JPA to work on IBM Websphere Application Server. Please read about it here. Any other suggestions are most welcome!!

@natashacalil

This comment has been minimized.

Show comment
Hide comment
@natashacalil

natashacalil Sep 26, 2014

its not worked for me

natashacalil commented Sep 26, 2014

its not worked for me

@naruraghavan

This comment has been minimized.

Show comment
Hide comment
@naruraghavan

naruraghavan Sep 28, 2014

Did you try what I mentioned in my blog?

naruraghavan commented Sep 28, 2014

Did you try what I mentioned in my blog?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment