0

I'm trying to do a ConfigServer with a remote repository.

The ConfigServer pom's file is:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-server</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bus-amqp</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-monitor</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

Inthe the properties file, i have the url, user and password of the repository. Is necessary anything else?. The file is like:

server.port:8888
spring.cloud.config.server.git.uri:git@gitlab.com:user/repo.git
spring.cloud.config.server.git.uri.username:user
spring.cloud.config.server.git.uri.password:password
spring.profiles.active:config-monitor
rabbitmq.host:rabbitmq
rabbitmq.port:5672
rabbitmq.username:guest
rabbitmq.password:guest
spring.cloud.bus.enabled:true
spring.cloud.config.server.monitor.gitlab.enabled:true

And I created a Webhook in gitLab with url http://localhost:8888/monitor too.

But when a client try to start, the ConfigServer's console shows:

**2017-03-14 23:46:35.767 ERROR 10595 --- [nio-8888-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Cannot clone or checkout repository] with root cause

com.jcraft.jsch.JSchException: USERAUTH fail at com.jcraft.jsch.UserAuthPublicKey.start(UserAuthPublicKey.java:118) ~[jsch-0.1.50.jar:na] at com.jcraft.jsch.Session.connect(Session.java:463) ~[jsch-0.1.50.jar:na]

2017-03-14 23:46:51.162 WARN 10595 --- [nio-8888-exec-2] .c.s.e.MultipleJGitEnvironmentRepository : Could not fetch remote for master remote: git@gitlab.com:user/repo.git**

Dou you know how can i resolver it? Thanks!

AleGallagher
  • 1,745
  • 7
  • 30
  • 40
  • 1
    Looks like these properties are wrong `spring.cloud.config.server.git.uri.username:user` `spring.cloud.config.server.git.uri.password:password` They should be `spring.cloud.config.server.git.username:user` `spring.cloud.config.server.git.password:password` – Ryan Baxter Mar 15 '17 at 15:58
  • Thanks @RyanBaxter ! It resolved that problem, but now the error is: **"UnsupportedCredentialItem: ssh://git@gitlab.com:22: org.eclipse.jgit.transport.CredentialItem$StringType:Passphrase for /home/user/.ssh/id_rsa MultipleJGitEnvironmentRepository : Could not fetch remote for master remote: git@gitlab.com:AleGallagher/repo-properties.git"** I have the id_rsa's file in the /home/user/.ssh/ folder. I don't know what is the problem. – AleGallagher Mar 16 '17 at 02:21
  • 1
    Since you are authenticating with a username and password I think you need to set the git URL to use `https` rather than ssh. – Ryan Baxter Mar 16 '17 at 13:19
  • Thank you very much @RyanBaxter! :D It works! The last problem is when I request localhost:8888/monitor a get a PageNotFound : Request method 'GET' not supported error. – AleGallagher Mar 17 '17 at 01:18
  • 1
    That is because the `/monitor` endpoint only supports `POST` methods – Ryan Baxter Mar 17 '17 at 16:00
  • Thanks again @RyanBaxter! You are a genius! . The last is when I commit the changes, the configServer refreshs the properties, but the client still reading the old value. Both application have the spring-cloud-starter-bus-amqp dependence and the cliente has the @RefeshScope en the controller. I understand the client must refresh the property automaticaly. – AleGallagher Mar 18 '17 at 14:59
  • The client doesn't receive the notification. – AleGallagher Mar 18 '17 at 20:29
  • Have you tried hitting the `/refresh` endpoint on the client? – Ryan Baxter Mar 20 '17 at 13:45
  • @RyanBaxter /refresh works ok. The problem is when I commit a chenge. The configServer recieive the post of /monitor, it refresh the propertie's file but it doesn't send anything to the client through RabbitMQ. – AleGallagher Mar 21 '17 at 03:25
  • Since this issue is different than your original problem I think you should start a new post or open an issue on GitHub so we can work through it. – Ryan Baxter Mar 21 '17 at 13:43
  • Yes, you are right, I thought about that. I asked a question about that in this link: http://stackoverflow.com/questions/42894061/springcloud-configserver-rabbitmq-client-doesnt-receive-message-from-conf Thank you very much for all your hepl @RyanBaxter . – AleGallagher Mar 21 '17 at 13:47

0 Answers0