JHipster Registry rejects gateways and microservices - jwt

I'm trying to use JHipster for a project using microservices, but the latest JHipster Registry won't let my gateway or microservices access the config server and rejects them.
I installed the JHipster Vagrant DevBox, then used docker run -p 8761:8761 jhipster/jhipster-registry to run the JHipster registry.
Then, I generated a gateway and 2 microservices following this, and it worked.
But then I wanted to use the JHipster Registry from GitHub, so I cloned it and runned it (apparently it had been updated to 2.0.0 in the meantime). Sadly, the gateway and the microservices weren't able to access this registry. They were still able to access the Docker image registry though (I suppose Docker didn't update it). But since it was fancier, and probably more up-to-date, I wanted to use the latest version of the registry, the same as the one from GitHub. So I tried to update the Docker image Jhipster Registry with docker pull. And now it won't work with either registry - Docker image or GitHub clone.
When a registry is running and I run a gateway or microservice, I get 6 times this:
2016-05-10 15:39:07.511 DEBUG 20706 --- [ main] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader#86ba8f5 pairs: {GET /config/gateway/dev/master HTTP/1.1: null}{Accept: application/json, application/*+json}{User-Agent: Java/1.8.0_91}{Host: localhost:8761}{Connection: keep-alive}
2016-05-10 15:39:07.522 DEBUG 20706 --- [ main] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader#43c7802510 pairs: {null: HTTP/1.1 401 Unauthorized}{Server: Apache-Coyote/1.1}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{Cache-Control: no-cache, no-store, max-age=0, must-revalidate}{Pragma: no-cache}{Expires: 0}{Content-Type: application/json;charset=UTF-8}{Transfer-Encoding: chunked}{Date: Tue, 10 May 2016 15:39:07 GMT}
Then I get an error:
2016-05-10 15:39:13.781 ERROR 20706 --- [ main] o.s.boot.SpringApplication : Application startup failed
Then I get Java exceptions:
java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:110)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$FastClassBySpringCGLIB$$fa44b2a.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:74)
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263)
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:154)
at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:101)
at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:118)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$EnhancerBySpringCGLIB$$a0abff82.locate(<generated>)
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:89)
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:640)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:343)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at com.soprasteria.example.GatewayApp.main(GatewayApp.java:73)
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.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.web.client.HttpClientErrorException: 401 Unauthorized
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:641)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:597)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:557)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:475)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:130)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:81)
... 23 common frames omitted
[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:498)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:478)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:110)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$FastClassBySpringCGLIB$$fa44b2a.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:74)
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263)
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:154)
at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:101)
at org.springframework.retry.annotation.AnnotationAwareRetryOperationsInterceptor.invoke(AnnotationAwareRetryOperationsInterceptor.java:118)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$$EnhancerBySpringCGLIB$$a0abff82.locate(<generated>)
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:89)
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:640)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:343)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at com.soprasteria.example.GatewayApp.main(GatewayApp.java:73)
... 6 more
Caused by: org.springframework.web.client.HttpClientErrorException: 401 Unauthorized
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:641)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:597)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:557)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:475)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:130)
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:81)
... 23 more
And finally a BUILD FAILURE and a Maven error:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.3.RELEASE:run (default-cli) on project gateway: An exception occurred while running. null: InvocationTargetException: Could not locate PropertySource and the fail fast property is set, failing: 401 Unauthorized -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
In the registry's shell I get this line 6 times too:
2016-05-10 15:39:07.519 DEBUG 17958 --- [io-8761-exec-10] i.g.j.r.s.Http401UnauthorizedEntryPoint : Pre-authenticated entry point called. Rejecting access
I tried updating everything, and I am currently trying to downgrade things (since the doc says "we recommend you use the same version tag as the one you use for your JHipster generator", but I don't think it'll work since JHipster Registry's latest version is 2.0.0 and the JHipster generator introduced microservices with the 3.0 version), and I also tried copying directly the secret from the central-server-config to the config of the applications, but apparently to no avail.
Could you help me with this ?
Thank you very much in advance.
EDIT:
I tried updating JHipster to 3.2.1 using npm install -g generator-jhipster, which apparently worked, but when I run yo jhipster, Yeoman still uses JHipster 3.1.0. Actually, even if I uninstall JHipster with npm uninstall -g generator-jhipster, Yeoman can still use JHipster 3.1.0...
EDIT:
It works fine if I reinstall everything locally (in the directory where I use yo jhipster).
However, I still can't update JHipster globally in Yeoman. When I try using npm install -g generator-jhipster, it updates JHipster globally to 3.2.1 but Yeoman still uses 3.1.0. If I try to update JHipster using yo/"Update your generators"/generator-jhipster, I get an error:
npm WARN deprecated npmconf#2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/generator-jhipster
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── generator-jhipster#3.2.1
npm ERR! Linux 3.13.0-85-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "generator-jhipster"
npm ERR! node v4.4.4
npm ERR! npm v3.8.9
npm ERR! path /usr/local/lib/node_modules/generator-jhipster
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/generator-jhipster'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/generator-jhipster']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/generator-jhipster' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/vagrant/npm-debug.log
I've just updated your generators. Remember, you can update
a specific generator with npm by running:
npm install -g generator-_______
Using sudo will do the same and sudo su give me this when I try to run yo:
/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/root/.config/configstore/insight-yo.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Object.create.all.get (/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:27:44)
at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/index.js:37:34)
at Object.<anonymous> (/usr/local/lib/node_modules/yo/lib/cli.js:163:11)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
EDIT:
Ok it does not work even with a local installation...
Well the gateway does access to the registry, but it displays a debug page when I try to access to localhost:8080.
Actually, during the generation, I get a permission denied again, and missing dependencies (gulp-rev).
I just saw this: "It is wise to use a tag to have a stable version: the JHipster DevBox tags are the same as the JHipster Generator tags, so using the DevBox v3.2.0 also means using the generator v3.2.0" on the DevBox GitHub page, so maybe I'll just delete and download the DevBox again...

This is because you upgraded the JHipster Registry to the 2.0.0 version. This new version is secured, and that's why you have 401 "unauthenticated" errors, as you didn't provide any login/password to connect.
3 solutions:
Stay with the older JHipster Registry version, that matches your JHipster version.
Add a login/password (by default it's admin/admin) to your Eureka and Spring Cloud Config URLs. The detailed documentation on securing the JHipster Registry is here - it is incomplete at the time of this writing, but I will update it shortly
Update to JHipster v3.2.1, that is meant to be used with JHipster Registry v2.0.0, and where everything will be automatically configured.

I found the same behavior when using the latest JHipster Registry pulled from github running locally with IntelliJ IDEA -- the server would start but the frontend would not serve up.
It turned out to be an issue with a blank working directory in the Run/Debug Configuration. Once that is populated, things work find from the IDE.

Related

Terminal 'ionic start' gives npm ERR

I am trying to start my first ionic project based on VUE, following the steps on https://ionicframework.com/docs/intro/cli
I reinstalling nodejs, tried uninstalling ionic > npm cache clear --force > reinstall, as well as launching Visual Studio Code in admin mode. Keep getting same error below. I am out of options, any advice?
? Starter template: blank
√ Preparing directory .\myapp in 1.41ms
√ Downloading and extracting blank starter in 320.71ms
> ionic integrations enable capacitor --quiet -- myapp io.ionic.starter
> npm.cmd i --save -E #capacitor/core#latest
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN ERESOLVE overriding peer dependency
npm ERR! code ECONNRESET
npm ERR! network aborted
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2022-07-18T02_58_39_592Z-debug-0.log
[ERROR] An error occurred while running subprocess npm.
npm.cmd i --save -E #capacitor/core#latest exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Installing dependencies may take several minutes.
──────────────────────────────────────────────────────────────────────────────
Ionic Advisory, tailored solutions and expert services by Ionic
Go to market faster
Real-time troubleshooting and guidance
Custom training, best practices, code and architecture reviews
Customized strategies for every phase of the development lifecycle
Learn more: https://ion.link/advisory
──────────────────────────────────────────────────────────────────────────────
> npm.cmd i
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN ERESOLVE overriding peer dependency
npm ERR! code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
npm ERR! 13168:error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:677:
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2022-07-18T02_59_54_033Z-debug-0.log
[ERROR] An error occurred while running subprocess npm.
npm.cmd i exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I've had the same issue myself but not had much chance to do any digging in to why it's doing it yet but could be a breaking change in a newer version of Angular which the Ionic team haven't picked up on.
In the meantime (assuming you're using Angular), use:
ng serve and access it at http://localhost:4200.

I tried installing yarn package using powershell. First I typed npm install -g yarn then I typed yarn install. but I got the following error

I tried opening Powershell with Administrative rights and typed
set-executionpolicy remote signed
then tried this again and I still am getting below error.
yarn install
yarn install v1.22.11
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
warning react-scripts > webpack-dev-server > sockjs > uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/#material-ui/icons/-/icons-4.9.1.tgz: ESOCKETTIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Win8\\Documents\\Masters Software Engineering\\upstac-ui\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
This worked for me, I made a file and named it
.yarnrc
and put this inside of it
network-timeout 500000
Have a look:
https://github.com/mui/material-ui/issues/12432

Strapi - Server wasn't able to start properly

I'm building app in Flutter. I have connected Strapi with Mongodb Atlas.
Everything was fine until suddenly I'm getting this kind of error:
[2020-08-03T17:03:26.651Z] debug ⛔️ Server wasn't able to start properly.
[2020-08-03T17:03:26.652Z] error Error connecting to the Mongo database. Server selection timed out
after 30000 ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server#0.1.0 develop: `strapi develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server#0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
My cluster is connected and I know no idea what could go wrong.
Any idea what should I do?
Apparently my ip has changed. So what i had to do is to add in mongodb atlas my new ip.
In my Cluster -> SECURITY -> Netwrok Access - ADD IP ADDRESS.
And thats its

Unable to publish Loopback application to IBM Cloud using API designer

#ibm -
I'm getting following error while trying to publish loopback application on IBM Cloud using API Designer portal. Please help me understand why is it looking into Temp folder to publish the application and how I can bypass that. I keep getting resource busy or locked issue with apiconnect toolkit.
Here's the node, npm and apiconnect toolkit version I'm using currently. Please let me know if you need any additional details.
node - v8.9.4
npm - v5.6.0
apiconnect - v5.0.8.2 (apiconnect: v2.7.111)
Error publishing runtime: Command failed: npm prune --production npm
ERR! path
C:\Users\SUNNY~1.GOE\AppData\Local\Temp\0.6717806509437265-1517290270545\project\node_modules\cryptiles\node_modules\boom\package.json.1443453620
npm ERR! code EBUSY npm ERR! errno -4082 npm ERR! syscall rename npm
ERR! EBUSY: resource busy or locked, rename
'C:\Users\SUNNY~1.GOE\AppData\Local\Temp\0.6717806509437265-1517290270545\project\node_modules\cryptiles\node_modules\boom\package.json.1443453620'
-> 'C:\Users\SUNNY~1.GOE\AppData\Local\Temp\0.6717806509437265-1517290270545\project\node_modules\cryptiles\node_modules\boom\package.json'
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Sunny\npm-cache_logs\2018-01-30T05_31_21_546Z-debug.log Error ID:
a055ee2d-8232-459b-bf62-f4340837a61b
As a simple step, first run this command from cli
apic stop all
and try the publishing loopbaclk application to IBM Bluemix.
In case, this does not resolve the issue, then the problem may be due to permission issues during the installation of APIC toolkit. Uninstall the toolkit do a fresh install of toolkit using '--unsafe-perm' option with the install command to overrides the permisson issues Here is the example
sudo npm install --unsafe-perm -g apiconnect
Try the publish with the new instance of API Connect and see if it resolves the issue.

kafka-node npm install failing on windows 7

I am new to apache kafka and trying to install their node client which is failing with the following message-
gyp ERR! stack Error: Python executable "python" is v3.4.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
There's an optional dependency called snappy that requires compilation. This dependency has been made optional since kafka-node v0.3.3 and above so you can ignore any errors generated from npm install.