ttcli
ttcli copied to clipboard
Proxy for ttcli
Hi Wim Thank you for your books and ttcli I found that I needed to add a proxy to be able to use ttcli in my environment Currently, I have the proxy hardcoded in the springBootInitializrClient Bean (and hardcoded "isReachable" to be true)
I suppose I will work towards getting it from environment variables Please give suggestions and/or comments
Thanks!
I am afraid I don't really understand your question. Please only use the issue tracker for questions and issues with ttcli itself. For other questions, you might be better to post a question on stackoverflow.com.
Hi Wim, This is an issue (or question) about ttcli itself. ttcli would not work in my environment. Internet was not available... But I found that it would work if I added a proxy for the connection to start.spring.io, etc, I also eliminated the test using socket connection to start.spring.io ("isReachable" set to true)
I do not know if anyone else has had this problem, but a change to the code to use a proxy fixed it for me (and maybe others...?)
If I get a pull request together, I will submit.
Thanks again
Same issue, i'm behind a corporate proxy at work and when i run ttcli init i have this error message
Error during project generation: Unable to connect to start.spring.io. Is your internet connection enabled? Error: Connect timed out
And this is the content of ttcli.log
2024-12-11T10:15:44.177+01:00 INFO 303904 --- [main] i.g.w.t.TamingThymeleafCliApplication : Starting AOT-processed TamingThymeleafCliApplication using Java 23.0.1 with PID 303904 (/home/acostanza/.local/ttcli/bin/ttcli started by acostanza in /home/acostanza/Dev/ttcli)
2024-12-11T10:15:44.177+01:00 INFO 303904 --- [main] i.g.w.t.TamingThymeleafCliApplication : No active profile set, falling back to 1 default profile: "default"
2024-12-11T10:15:44.216+01:00 INFO 303904 --- [main] i.g.w.t.TamingThymeleafCliApplication : Started TamingThymeleafCliApplication in 0.057 seconds (process running for 0.062)
2024-12-11T10:15:49.231+01:00 ERROR 303904 --- [main] io.github.wimdeblauwe.ttcli.Init : Error during project generation: Unable to connect to start.spring.io. Is your internet connection enabled?
Error: Connect timed out
io.github.wimdeblauwe.ttcli.ProjectInitializationServiceException: Unable to connect to start.spring.io. Is your internet connection enabled?
Error: Connect timed out
at io.github.wimdeblauwe.ttcli.util.InetUtil.checkIfInternetAccessIsAvailable(InetUtil.java:19) ~[na:na]
at io.github.wimdeblauwe.ttcli.Init.addSpringBootVersionInput(Init.java:135) ~[ttcli:na]
at io.github.wimdeblauwe.ttcli.Init.init(Init.java:53) ~[ttcli:na]
at [email protected]/java.lang.reflect.Method.invoke(Method.java:580) ~[ttcli:na]
at org.springframework.shell.command.invocation.InvocableShellMethod.doInvoke(InvocableShellMethod.java:306) ~[na:na]
at org.springframework.shell.command.invocation.InvocableShellMethod.invoke(InvocableShellMethod.java:232) ~[na:na]
at org.springframework.shell.command.CommandExecution$DefaultCommandExecution.evaluate(CommandExecution.java:230) ~[na:na]
at org.springframework.shell.Shell.evaluate(Shell.java:248) ~[ttcli:3.3.3]
at org.springframework.shell.Shell.run(Shell.java:159) ~[ttcli:3.3.3]
at org.springframework.shell.jline.NonInteractiveShellRunner.run(NonInteractiveShellRunner.java:144) ~[ttcli:3.3.3]
at org.springframework.shell.DefaultShellApplicationRunner.run(DefaultShellApplicationRunner.java:66) ~[ttcli:3.3.3]
at org.springframework.boot.SpringApplication.lambda$callRunner$4(SpringApplication.java:784) ~[ttcli:3.4.0]
at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:82) ~[na:na]
at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[ttcli:6.2.0]
at org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:86) ~[na:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:796) ~[ttcli:3.4.0]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:784) ~[ttcli:3.4.0]
at org.springframework.boot.SpringApplication.lambda$callRunners$3(SpringApplication.java:772) ~[ttcli:3.4.0]
at [email protected]/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[na:na]
at [email protected]/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) ~[na:na]
at [email protected]/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:571) ~[ttcli:na]
at [email protected]/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560) ~[ttcli:na]
at [email protected]/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[ttcli:na]
at [email protected]/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[na:na]
at [email protected]/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265) ~[ttcli:na]
at [email protected]/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:636) ~[ttcli:na]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:772) ~[ttcli:3.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) ~[ttcli:3.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[ttcli:3.4.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[ttcli:3.4.0]
at io.github.wimdeblauwe.ttcli.TamingThymeleafCliApplication.main(TamingThymeleafCliApplication.java:10) ~[ttcli:na]
at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH) ~[na:na]
Can you try to download the jar from the releases page and try to run:
java -Djava.net.useSystemProxies=true -jar ttcli-1.6.2.jar init
If that does not work, you can try with:
java -Dhttp.proxyHost=10.10.10.10 -Dhttp.proxyPort=8080 -Dhttp.proxyUser=username -Dhttp.proxyPassword=password -jar ttcli-1.6.2.jar init
Ofcourse, using the proper values for all those settings for your own proxy server.
Not working for me
$ java -Dhttp.proxyHost=my.proxy.local -Dhttp.proxyPort=8080 -jar ttcli-1.6.2.jar init
❌ Error during project generation: Unable to connect to start.spring.io. Is your internet connection enabled?
Error: Connect timed out
$ java -Dhttp.proxyHost=my.proxy.local -Dhttp.proxyPort=8080 -Dhttps.proxyHost=my.proxy.local -Dhttps.proxyPort=8080 -jar ttcli-1.6.2.jar init
❌ Error during project generation: Unable to connect to start.spring.io. Is your internet connection enabled?
Error: Connect timed out
$ java -Djava.net.useSystemProxies=true -jar ttcli-1.6.2.jar init
❌ Error during project generation: Unable to connect to start.spring.io. Is your internet connection enabled?
Error: Connect timed out
Anyone else can try?
Looking at https://docs.spring.io/spring-boot/reference/io/rest-client.html#io.rest-client.clienthttprequestfactory.configuration, maybe this can help:
Add this bean to TamingThymeleafCliApplicationConfiguration:
@Bean
ClientHttpRequestFactoryBuilder<?> clientHttpRequestFactoryBuilder(ProxySelector proxySelector) {
return ClientHttpRequestFactoryBuilder.jdk()
.withHttpClientCustomizer((builder) -> builder.proxy(proxySelector));
}
You will need to get the sources and compile locally for that to try. I don't have a proxy server, so I can't try it out. If that works, maybe I can add property to optionally enable or disable this.
I got source; hardcoded the proxy config - it works... I will send the snippet when I get home...this week
On Mon, Dec 23, 2024, 3:57 AM Wim Deblauwe @.***> wrote:
Looking at https://docs.spring.io/spring-boot/reference/io/rest-client.html#io.rest-client.clienthttprequestfactory.configuration, maybe this can help:
Add this bean to TamingThymeleafCliApplicationConfiguration:
@Bean ClientHttpRequestFactoryBuilder<?> clientHttpRequestFactoryBuilder(ProxySelector proxySelector) { return ClientHttpRequestFactoryBuilder.jdk() .withHttpClientCustomizer((builder) -> builder.proxy(proxySelector)); }
You will need to get the sources and compile locally for that to try. I don't have a proxy server, so I can't try it out. If that works, maybe I can add property to optionally enable or disable this.
— Reply to this email directly, view it on GitHub https://github.com/wimdeblauwe/ttcli/issues/106#issuecomment-2559239336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGXJL4NNTP6OF775Z72VHT2G7F6HAVCNFSM6AAAAABTM7S4VCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJZGIZTSMZTGY . You are receiving this because you authored the thread.Message ID: @.***>