The application stands up on the default profile, but should be on herok. What's wrong with my setup?
Procfile:
web: java -Dspring.profiles.active=heroku -jar build/libs/todo-api-all.jar
aplication-heroku.properties:
spring.jpa.generate-ddl=true
spring.jpa.show-sql=true
# App Properties
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:postgresql://localhost:5432/test
spring.datasource.username=xxxx
spring.datasource.password=xxxx
logs:
2022-03-17T22:16:37.062638+00:00 heroku[web.1]: Starting process with command `java -Dspring.profiles.active=heroku -jar build/libs/todo-api-all.jar`
2022-03-17T22:16:37.769060+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2022-03-17T22:16:37.772288+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -XX:+UseContainerSupport -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UT
F-8
2022-03-17T22:16:38.078366+00:00 app[web.1]:
2022-03-17T22:16:38.078397+00:00 app[web.1]: . ____ _ __ _ _
2022-03-17T22:16:38.078410+00:00 app[web.1]: /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
2022-03-17T22:16:38.078428+00:00 app[web.1]: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
2022-03-17T22:16:38.078446+00:00 app[web.1]: \\/ ___)| |_)| | | | | || (_| | ) ) ) )
2022-03-17T22:16:38.078463+00:00 app[web.1]: ' |____| .__|_| |_|_| |_\__, | / / / /
2022-03-17T22:16:38.078481+00:00 app[web.1]: =========|_|==============|___/=/_/_/_/
2022-03-17T22:16:38.080265+00:00 app[web.1]: :: Spring Boot ::
2022-03-17T22:16:38.080285+00:00 app[web.1]:
2022-03-17T22:16:38.151045+00:00 app[web.1]: 22:16:38.149 [main] INFO be.ordina.jworks.todoapi.TodoApplication - Starting TodoApplication using Java 17.0.2 o
n b96d702f-a867-4f6c-a1e7-a1c9c48b6f27 with PID 4 (/app/build/libs/todo-api-all.jar started by u47513 in /app)
2022-03-17T22:16:38.151382+00:00 app[web.1]: 22:16:38.151 [main] DEBUG be.ordina.jworks.todoapi.TodoApplication - Running with Spring Boot, Spring
2022-03-17T22:16:38.152810+00:00 app[web.1]: 22:16:38.152 [main] INFO be.ordina.jworks.todoapi.TodoApplication - No active profile set, falling back to 1 def
ault profile: "default"
2022-03-17T22:16:38.153431+00:00 app[web.1]: 22:16:38.153 [main] DEBUG org.springframework.boot.SpringApplication - Loading source class be.ordina.jworks.tod
oapi.TodoApplication
Related
I'm trying to run an AWS Lambda using Docker image build by paketobuildpacks/builder using spring-native + spring-cloud-function-aws, but it's not handling incoming values, justs starts and returns an error, did I missed something?
Log output:
START RequestId: f7a451f1-f43b-4ba0-be3d-58526bfa0d10 Version: $LATEST
2021-06-30 00:20:58.229 INFO 8 --- [ main] o.s.nativex.NativeListener : This application is bootstrapped with code generated with Spring AOT
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.5.1)
2021-06-30 00:20:58.251 INFO 8 --- [ main] o.s.boot.SpringApplication : Starting application using Java 11.0.11 on 169.254.41.117 with PID 8 (started by sbx_user1051 in /workspace)
2021-06-30 00:20:58.251 INFO 8 --- [ main] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2021-06-30 00:20:58.551 INFO 8 --- [ main] o.s.boot.SpringApplication : Started application in 0.42 seconds (JVM running for 0.421)
END RequestId: f7a451f1-f43b-4ba0-be3d-58526bfa0d10
REPORT RequestId: f7a451f1-f43b-4ba0-be3d-58526bfa0d10 Duration: 840.41 ms Billed Duration: 841 ms Memory Size: 128 MB Max Memory Used: 29 MB
RequestId: f7a451f1-f43b-4ba0-be3d-58526bfa0d10 Error: Runtime exited without providing a reason
Runtime.ExitError
Find my configs below:
Gradle Plugins:
kotlin("jvm")
kotlin("plugin.spring")
id("io.spring.dependency-management")
id("org.springframework.boot")
id("org.springframework.experimental.aot")
id("org.graalvm.buildtools.native")
Dependencies:
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.springframework.cloud:spring-cloud-function-adapter-aws")
implementation("com.amazonaws:aws-lambda-java-events:2.0.2")
implementation("com.amazonaws:aws-lambda-java-core:1.1.0")
GraalVM plugin config:
tasks.withType<BootBuildImage> {
builder = "paketobuildpacks/builder:tiny"
environment = mapOf("BP_NATIVE_IMAGE" to "true")
}
App sources:
#SpringBootApplication
class LinkGeneratorApplication: ApplicationContextInitializer<GenericApplicationContext> {
override fun initialize(applicationContext: GenericApplicationContext) {
applicationContext.registerBean(
"function",
FunctionRegistration::class.java,
{
FunctionRegistration(Function<Input, Result> { Result("Here") })
.type(
FunctionType
.from(Input::class.java)
.to(Result::class.java)
.type
)
}
)
}
}
data class Input(val sellerId: String, val ownerId: String, val market: String)
data class Result(val message: String)
fun main(args: Array<String>) {
runApplication<LinkGeneratorApplication>(*args)
}
I am using below library versions in my SpringBoot project and cucumber for integrations tests,
Java - 11.0.11
Maven - 3.8.1
SpringBoot - 2.3.12.RELEASE
Cucumber - 6.10.4
Junit5 Jupiter - 5.4.0
Failsafe plugin - 3.0.0-M5
Although cucumber feature tests are being picked up and executed, I am not seeing any execution report from fail-safe plugin,
[INFO] --- maven-failsafe-plugin:3.0.0-M5:integration-test (default) # my-project ---
[INFO] Failsafe report directory: /Users/ZZZ/my-project/target/failsafe-reports
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.12.RELEASE)
2021-07-08 INFO 77791 --- [ main] Started SpringContext in 4.018 seconds (JVM running for 6.525)
Scenario: some scenario # /some_scenario.feature:2
Given some precondition
When some action is taken
Then something should have happened
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
I am wondering what's missing in my setup which is leading to fail-safe plugin output like this,
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
More worrying thing is that even if any cucumber test fails, fail-safe is not reporting anything and maven build succeeds. This could easily lead to false positives.
fixed by reverting both surefire and failsafe plugin to 2.22.2
I am currently using spring-boot with the org.testcontainers library to pass test in docker . But I noticed that the following message appears several times :
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.20.RELEASE)
It appears up to 4 times , 2 of them with the following message :
11:33:23.733 [main] INFO org.springframework.web.context.support.GenericWebApplicationContext - Refreshing org.springframework.web.context.support.GenericWebApplicationContext#13ffeba4: startup date [Wed Jun 16 11:33:23 CEST 2021]; root of context hierarchy
Some messages that have caught my attention, first time that appears (the only one I think necessary)
11:31:48.515 [main] INFO org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer - Tomcat initialized with port(s): 0 (http)
11:31:49.019 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 5416 ms
2 : It does not appear Why?
3:
11:35:06.738 [main] INFO org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer - Tomcat initialized with port(s): 0 (http)
11:35:06.764 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 1569 ms
4:
11:36:19.343 [main] INFO org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer - Tomcat initialized with port(s): 0 (http)
11:36:19.362 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 454 ms
The message always pops up after a specific test, for example the third time during this test.
#Category(OneTest.class)
public class PasswordEncryptionTest
{
#Test
public void passwordEncryptionTest()
{
PasswordEncryption passwordEncryption = new PasswordEncryption();
try
{
String password = "passwordExample";
String encrypted = passwordEncryption.encryptPassword(password.toCharArray());
String decrypted = passwordEncryption.decryptPassword(encrypted.toCharArray());
assertEquals(password, decrypted);
}
catch (PasswordDecryptionException e)
{
e.printStackTrace();
fail(e.getMessage());
}
}
}
Is this normal ? Because it is the message that appears when you start the application and that it appears 4 times, that is what I noticed.
Can it be affecting the performance of the tests?
Pd: They are messages, after passing the tests many times, in different environments, they are not the result of chance. I have seen no relationship in the times between the different appearances. (It does not follow a time pattern)
spring-boot 1.5.20
junit47
org.testcontainers 1.13.0
Docker windows 2.2.0.3
In CI part most of the times I prefer standard maven phases to execute build steps. In these cases I override application.properties e.g.: -Dlogging.level.root=OFF -Dspring.main.banner-mode=off to turn off debugging logs and save some precious build time.
In some pipelines I prefer to use maven release plugin and I noticed that these flags does not work there.
e.g.: mvn release:prepare -Dspring.main.banner-mode=off
[INFO]
[INFO] . ____ _ __ _ _
[INFO] /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
[INFO] ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
[INFO] \\/ ___)| |_)| | | | | || (_| | ) ) ) )
[INFO] ' |____| .__|_| |_|_| |_\__, | / / / /
[INFO] =========|_|==============|___/=/_/_/_/
[INFO] :: Spring Boot :: (v2.1.4.RELEASE)
[INFO]
Still display spring banner
Any suggestion?
Following is my entire stacktrace in intellijIDEA:
"C:\Program Files\Java\jdk1.6.0_29\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:57558,suspend=y,server=n -javaagent:C:\Users\clearity\.IntelliJIdea13\system\groovyHotSwap\gragent.jar -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.6.0_29\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0_29\jre\lib\ext\sunjce_provider.jar;D:\Work_space\External Card Related\project_related\icpay_v3_merchant\out\production\icpay_v3_merchant;C:\Users\clearity\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-all\2.1.6\165b8246372a829c1915611646f6d964010656cf\groovy-all-2.1.6.jar;D:\Work_space\Spring-boot\annotations-api.jar;D:\Work_space\Spring-boot\catalina.jar;D:\Work_space\Spring-boot\commons-codec-1.6.jar;D:\Work_space\Spring-boot\commons-logging-1.1.3.jar;D:\Work_space\Spring-boot\ecj-4.3.1.jar;D:\Work_space\Spring-boot\el-api.jar;D:\Work_space\Spring-boot\fluent-hc-4.3.4.jar;D:\Work_space\Spring-boot\httpclient-4.3.4.jar;D:\Work_space\Spring-boot\httpclient-cache-4.3.4.jar;D:\Work_space\Spring-boot\httpcore-4.3.2.jar;D:\Work_space\Spring-boot\httpmime-4.3.4.jar;D:\Work_space\Spring-boot\jasper-el.jar;D:\Work_space\Spring-boot\jasper.jar;D:\Work_space\Spring-boot\jsp-api.jar;D:\Work_space\Spring-boot\juli-6.0.41.jar;D:\Work_space\Spring-boot\servletapi-3.0.jar;D:\Work_space\Spring-boot\spring-aop-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-beans-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-boot-1.1.1.RELEASE-tests.jar;D:\Work_space\Spring-boot\spring-boot-1.1.1.RELEASE.jar;D:\Work_space\Spring-boot\spring-boot-actuator-1.1.1.RELEASE.jar;D:\Work_space\Spring-boot\spring-boot-autoconfigure-1.1.1.RELEASE.jar;D:\Work_space\Spring-boot\spring-boot-gradle-plugin-1.1.1.RELEASE.jar;D:\Work_space\Spring-boot\spring-context-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-context-support-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-core-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-expression-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-web-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\spring-webmvc-4.0.5.RELEASE.jar;D:\Work_space\Spring-boot\tomcat-coyote.jar;D:\Work_space\Spring-boot\tomcat-dbcp.jar;D:\Work_space\Spring-boot\tomcat-util-7.0.16.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\commons-codec-1.6.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\commons-logging-1.1.3.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\fluent-hc-4.3.4.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\httpclient-4.3.4.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\httpclient-cache-4.3.4.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\httpcore-4.3.2.jar;D:\Docs\httpcomponents-client-4.3.4-bin\httpcomponents-client-4.3.4\lib\httpmime-4.3.4.jar;C:\Download\UsefulJars\fastjson-1.1.39.jar;C:\Download\jpos-1.9.0.jar;D:\Docs\slf4j-1.7.7\slf4j-1.7.7\slf4j-log4j12-1.7.7.jar;D:\Docs\slf4j-1.7.7\slf4j-1.7.7\slf4j-nop-1.7.7.jar;D:\Docs\slf4j-1.7.7\slf4j-1.7.7\slf4j-api-1.7.7.jar;C:\Download\UsefulJars\druid-1.0.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.3\lib\idea_rt.jar" MerchantApplication
Connected to the target VM, address: '127.0.0.1:57558', transport: 'socket'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.1.1.RELEASE)
Exception in thread "main" 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:135)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:683)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:944)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:933)
at org.springframework.boot.SpringApplication$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at MerchantApplication.main(MerchantApplication.groovy:17)
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:185)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132)
... 11 more
Disconnected from the target VM, address: '127.0.0.1:57558', transport: 'socket'
Process finished with exit code 1
help me
you can add
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>