spring.profiles.active=native is not working on app.yml - java

I keep getting the:
java.lang.IllegalStateException: You need to configure a uri for the git repository"
every time I try to run the app.
Already tried to set the spring.profiles.active=native, but it keeps not working.
spring:
profiles:
active: native
cloud:
config:
server:
native:
searchLocations: file:///${user.home}/config
Caused by: java.lang.IllegalStateException: You need to configure a uri for the git repository

Related

Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Could not load key

Any one help me with this below error
org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Could not load key store 'null'
i have placed the key store file out side the project . i check key file also using keytool list command. Still application not starting .
i am using java 11 , maven 3.6.3 . spring boot 2.3.2 release
i did not find any solutions for it .
but i tried loading keystore inside the project , outside, adding new key file . northing works .
it was fixed after adding the keystore properties to management port .
management:
endpoints:
web:
exposure:
include: ["health", "info", "metrics", "prometheus", "bindings", "beans", "env", "loggers","actuator"]
base-path: /
path-mapping:
prometheus: metrics
prometheus:
enabled: true
server:
port: ${npbprog.metrics.server.port}
ssl:
enabled: true
key-store: ${ssl.key-store}
key-store-type: ${ssl.key-store-type}
key-store-password: ${ssl.key-store-password}
key-password: ${ssl.key-password}
key-alias: ${ssl.key-alias}
protocol: TLS
enabled-protocols:
- TLSv1.2

SpringBoot profiles with Gradle vs cloud

I have some problem with starting microservice with cloud config on local machine:
In application.yml:
spring:
application:
name: my_servie
config:
import: 'configserver:'
profiles:
group:
env-prod-pg: postgres,log
I create application-local.yml, where add:
spring:
application:
name: mc-service-logistics-v2
config:
import: 'optional:configserver:'
and some other config updates,
in build.gradle I add:
tasks.register("bootRunLocal") {
group = "application"
description = "Runs the Spring Boot application with the local profile"
doFirst {
tasks.bootRun.configure {
systemProperty("spring.profiles.active", "local")
}
}
finalizedBy("bootRun")
}
but when I try to start app with gradle bootRunLocal I caught error:
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8888/my-service/local": Connection refused; nested exception is java.net.ConnectException: Connection refused
If I understand- application still want to use cloud config and can't start. If I comment
spring.config.import in application.yml- aplication started without any problem.
How to solve this problem? I don't want to push to repo my local config again)
Well, I create to application-.yml and application.yml ,where store current profile:
spring:
profiles:
active: prod

Run jar with spring profile environment variable

I'm trying to use a spring profile argument to run a jar file, the profile isn't working:
java -jar -Dspring.profiles.active="test" build/libs/moley2-0.0.1-SNAPSHOT.jar
Here is my application.yml file:
spring:
profiles: dev
server:
port:8000
---
spring:
profiles: test
server:
port:9000
The jar was created using gradle build in the projects root directory. Running the jar with the command provided starts on port 8080 so it seems like the profile isn't loading. I'm sure I'm missing something simple here as I'm new to gradle / spring. Thanks in advance for any suggestions.
The property server should be:
server:
port: 9000
Instead of:
server:
port:9000
A space is missing between the colon and the value.
Also notice that configuring the profile as:
spring:
profiles: dev
is deprecated since 2.4.0 version and should be replaced with:
spring:
config:
activate:
on-profile: dev
More info in the doc. Or a tutorial here.

Spring cloud server returning empty configurations

I have a dead simple config server with following properties :
spring:
profiles:
active: native
cloud:
config:
server:
native:
searchLocations: classpath:/configs
server:
port: 8888
In the src/main/resources folder i have a configs folder with a customer-service.yml file inside it containing the following config :
spring:
application:
name: customer-service
h2:
console:
enabled: true
server:
port: 8080
eureka:
client:
serviceUrl:
defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
instance:
preferIpAddress: true
leaseRenewalIntervalInSeconds: 1
leaseExpirationDurationInSeconds: 2
logging:
level:
com.netflix: WARN
The config server starts with no issue but issuing the following URL in the browser - http://localhost:8888/customer-service/master - returns the following response :
{"name":"customer-service","profiles":["master"],"label":null,"version":null,"state":null,"propertySources":[]}
There doesn't seem to be many examples out there of using a folder on the classpath to store configs. What am I doing wrong?
I just tried it with Spring 2.1.3 and it works as you have laid it out. Since you mentioned you are using Spring 2.2, there might have been a change or potentially a bug.
Update
Just for kicks, I tried it with 2.2.0.BUILD-SNAPSHOT and it works as well. Not sure what to say at this point.

JHipster page blank

Hi i have installed jhipster 4.1.1 and im trying to create microservice and gateway applications, im using jhipster-registry, the microservice start ok, the gateway start ok, but when im trying to load localhost:8080, i obtained blank page, and no error on log.
whats happen?
Application 'clothes' is running! Access URLs:
Local: http://localhost:8080
External: http://192.168.56.1:8080
Profile(s): [swagger, dev]
----------------------------------------------------------
2017-04-06 11:15:17.186 INFO 6344 --- [ restartedMain] com.anelsoftware.clothes.ClothesApp :
----------------------------------------------------------
Config Server: Connected to the JHipster Registry config server!
----------------------------------------------------------
2017-04-06 11:19:58.930 INFO 6344 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
No entities were generated
You have to install all dependency manager, package manager and build tools for successfully run the JHipster app ( mvn, nvm, npm, bower, gulp ) before "yo jhipster" process.
If you have choose not stable version of Angular on generating process you have to change it or regenerate app.
For start JHipster app correctly you have to start 1-BackEnd mvnw or gradlew and 2-FrontEnd => yarn start.
Definitely the problem is Angular Beta, run gateway from springboot run and yarn start and works fine, now if only run springboot run does not work, any idea how to solve this?
I experience blank page when using MySQL on development.
The localhost:8080 is only for API request. With Angular, you access it on a different port.
Go to webpack.dev.js
Change the port to 9060
plugins: [
new BrowserSyncPlugin({
host: 'localhost',
port: 9060, // change this into 9060
proxy: {
target: 'http://localhost:9060'
}
}, {
reload: false
}),
and then access it on localhost:9060
I have found this with the latest JHipster (4.1.* and Angular 5).
My solution was to regenerate the application and everything worked.

Categories

Resources