Can't create a spring starter project in spring tool suite - spring-boot

JSONException: A JSONObject text must begin with { at character 0
I used spring-tool-suite-3.9.1.RELEASE-e4.7.1a-win32-x86_64, why can't I create a project directly in File->New->Spring Starter Project
I got the screenshot below.

It may be late, but others might find it useful. I faced the same issue when I was trying to create a project in eclipse using Spring Starter Project.
What I did was change the Service Url from http://start.spring.io/ to https://start.spring.io/. I just changed the http to https and it worked. I don't know if it is a security related error or what, but I was able to create a project.

This is what I did:
In eclipse go to -> window -> preferences -> General -> Network Connections.
In Network Connections, select 'Direct' for Active Provider. And click Apply.
Now try creating spring starter project with - https://start.spring.io/ url.

Edit the URL to https://start.spring.io instead of http://start.spring.io (HTTP ⟶ HTTP/S).

This looks like a connection problem with start.spring.io (or a proxy in between your machine and start.spring.io) - or a temporary problem on start.spring.io.
If this problem persists, you can easily workaround it by using your browser, go to http://start.spring.io, select the boot modules you would like to use, and download a ZIP of the project. Then unpack it locally and import it using "Import -> Maven -> Import as Existing Maven Project" into STS.

Go to http://start.spring.io/ and generate the project there; pull
down the zip and extract into a folder (preferably with the top-most
dir being the same as the Artifact)
Import the project
That worked for me ....

Changing the URL from http://start.spring.io to https://start.spring.io
works for me .
In my case, I am in a corporate, and for that first you need to set up the proxy in the eclipse IDE; only then will it work.

just do the eclipse update .
in eclipse menu: Help>> Check for update , accept and install .

I had this same issue. Just connect to internet first and restart the STS.
The inbuilt wizard uses internet web service to work. See if this works for you!

Maybe it's too late but I solved it adding
-Djavax.net.ssl.trustStore=/home/[user]/.sdkman/candidates/java/11.0.6-zulu/lib/security/cacerts line to STS.ini. I hope you can solve it too

Related

url after spring maven deployment

I have a basic question about deployment but I can't seem to find an answer on google...
I am working on a jakarta project and it's the first time I do the deployment.
Since I am using Spring-boot maven, I know there is an embedded tomcat that will launch with the jar.
My issue is, I don't know what url to use to check my project is working...
Before, I used the address http://localhost:9091/contextPath/endpoint, but now, I only get a whiteScreen...
So my question is, what url should I use ? Also, is there something else to do after packaging ?
Thank you for your answers.
EDIT:
Alright, so I tried actuator but that didn't help me...
With /actuator/mappings, I could see that my endpoints are correctly configured but when I use the executable jar, http://localhost:9091/contextPath/endpoint odes not work while it does if I compile with my IDE...
I don't know what url to connect to just to see the index... I'm using a very basic spring framework (boot and mvc) and my IDE is intellij community if this helps anyone
EDIT 2:
I tried to deploy the app on a local Tomcat9 to see if something would change but the connexion is reinitialized everytime I try to deploy a war using the manager, and there was no trace of error in the logs.
I tried using ./mvnw and it did work, endpoint and all, but it implies working with IDE environment
I tried using java (openjdk 13) and it compiled, but i couldn"t acces my own endpoint. I could still access the actuator endpoints so i don't know what to make of it.
Should the url be different depending on whether we are using IDE environment or just the jar?
EDIT 3:
Ok, I think have a lead but I have no idea how to resolve this:
when I began the web part of the application, I created a WEB-INF folder where I put all my jsp. My js and css files were in the resources/static folder. I tried once to put the jsp in the resources folder but it didn't work so I didn't push too hard.
Now, when I unzip the jar, i find my css and js files, but not my jsp.
When I unzip my war file, I have everything, but when I try to deploy it on a separate tomcat server, the connexion resets and I don't know why because nothing is written in the logs.
The issue then becomes:
Right now, I have
└──src
└──main
├──java
├──resources
| ├──static
| | ├──css
| | └──js
| └──template
└──webapp
└──WEB-INF
└──classes
└──jsp
What is the standard tree in intellij with jsp ?
By default Spring Boot apps are on port 8080.
Can you try http://localhost:8080?
Port can be changed in application.properties (or application.yml, application-profile.properties etc.) via server.port property (e.g. server.port=8888).
Ok, I managed to make it work.
I'm going to describe here everything of note that I encountered.
First, when I called my app to the usual url, there was no response (whiteLabel).
I added test logs and i found that I indeed called m controller.
I unzipped the jar and war i produced and came to the conclusion that the issue was architectural. I couldn't use jar, I had to use the war file.
I tried to deploy on a local tomcat server using the manager, but it always resetted the connection, so I took the manual approach - copy pasting the war file in the webapp directory.
Finally, the web pages were accessible in the browser.
Thank you for all the tips given during my research!
`http://endpoint:{PORT}/actuator/health` or `http://endpoint:{PORT}/actuator/status`
it should help but it must require spring-boot-actuator as a dependency in your pom/gradle file.

Spring Initializr Error in Intellij Idea and STS on mac os

I have installed Intellij Idea on my macbook. When I going to create a Spring project using Spring Initializr and press "next" button, it prompts an alert window with the heading "Spring Initilizr Error", and with message body -
"Initialisation failed for 'https://start.spring.io'
Please check URL, Network and Proxy settings
Error Message
Cannot download 'https://start.spring.io':
Status 403".
I have used https://start.spring.io as Spring Initializr url, which is being set by default in Intellij Idea. I have also tried the url changing as http://start.spring.io, but it also haven't worked too.
I have tried to use Spring Tool Suit (STS) to create Spring Initializr project and got this message: "IOException: Server returned HTTP response code: 403 for URL: https://start.spring.io".
My network connection is ok and firewall is turned off too. If someone have already faced this issue, please help me with your overcoming steps. I am struggling too much with this problem and wasted enough time with it. Thanks in advance.
press Ctrl+Alt+S and search for proxy. This will show you the proxies you have set for IntelliJ; try to remove or add any.
Remember spring website will block tor.

Spring 4, STS 3.7 tc server 3.1.1. how to enable insights for my existing web application?

I am new to Spring framework even though i have been a java dev for quite some time. I am impressed by the spring insight application demos in you tube and want to use it in my application. How ever, when i try to create a new tc server using the instructions provided, for windows 8.1 64 bit
tcruntime-instance.bat create --template bio --template insight -i C:\workspaces\eclipses\sts\sts-bundle\pivotal-tc-server-developer-3.1.1.RELEASE\insight-instance http-insight-server-stsdeployed
When i try to add the folder created as the location of the new tc server with insight configured, using STS-> server view-> right click-> new-> server-> selected v3.0-3.1- && server-runtime env->add->browse="newly created server instance directory" it shows me below error.
The Tomcat installation directory is not valid. It is missing expected file or folder tcruntime-ctl.sh.
any idea how to add a new server and run my application on it? or add spring insights to existing spring boot or spring web application thru maven or spring configuration?
Note: Even though im using STS, i would like to know how to use these instances with Eclipse or IntelliJ idea. Im on a windows 8.1 64 bit machine.
When you click "add" from your instructions, you are browsing to a new tc Server installation directory (the binaries you want to run) not the instance directory. Once you select the installation directory of the version you wish to use, you will select next in the configuration and it will give you the option to "Create instance" or use an existing instance. You will then select use an existing instance and point to your newly created instance directory.

Setting up home page in spring

I am new to spring environment. I have created small test spring project through STS.
Project name: SPTest
base package name: uk.co.ifTest
When I run and open this project browser through Eclipse. It work fine, but url, it put in the browser is xx.xx.xx.xx:8080/ifTest/, instead of //xx.xx.xx.xx:8080/SPTest/.
I guess, it is adding base package name.
Is there any way I can open project with http://xx.xx.xx.xx:8080/SPTest/.
Thanks
ish
You need to change your context path for the server to point from ifTest to SPTest.
This answer will help you identify how to do it:
Changing Tomcat context path of web project in Eclipse

Cannot find Spring MVC project when creating new web application project using STS?

I'm new to Spring MVC and trying to learn from the internet tutorial such as these good ones from journaldev, springsource, and codejava
All of those tell me use STS as the IDE and to go for New Project - Spring Template Project - Spring MVC Project.
Though in my case, using the version 3.6.1.RELEASE of STS, I can NOT find any Spring MVC Project options there.
Do you have the same issue using STS?
p.s.
I found the solution here for previous version of STS, though it not works for version 3.6.1.
Seeing no MVC template snapshot.
I've just solved the problem. These are my way:
- Go to New Project -> Spring Project. For first use, only show "Simple Project" folder.
- Select Configure templates.. (blue link).
- In Template Projects window, delete "spring-data-gemfire" and "spring-integration", and check "Show self-hosted templates ..." (at bottom), and then press Apply -> OK
- Just wait while refreshing process, and "Spring MVC Project" should be showed.
Step:1-Go to File->New
Step:2-Click on Spring Legacy Project
Step:3-see a Templates Box, scroll it down you will find Spring Mvc Project
Firstly File -> New Project -> Spring -> Spring Legacy project & finally select what you want. also refer attached images.
As user #AndrewEisenberg suggested here, viewing the Error Log gives me the errors as below
Connection to https://raw.github.com/SpringSource/spring-integration-templates/master/si-sts-templates/builds/descriptor.xml failed on Connection to https://raw.github.com refused. Retry attempt 0 started
Connection to https://raw.github.com/SpringSource/spring-data-gemfire-sts-templates/master/builds/descriptor.xml failed on Connection to https://raw.github.com refused. Retry attempt 0 started
So having a close look at the error in Error Log, by Windows - Show View - Other - Error Log, after calling File - New Project - Spring Project, I see the cause for this symptom.
It causes by the internet connection which cannot reach https://raw.github.com
Try this
New Project -> Spring Project -> Spring MVC Project
File->New-->Spring Legacy Project----> scroll down to Spring Mvc Project

Resources