how to deploy springboot app in windows server 2012? - spring-boot

I'm developing a SpringBoot app and I need to deploy it on a remote server running Windows Server 2012. I tried running the app from eclipse there, and i can access locally from the server, but when I try to access from other devide using the IP of the server it has no response. Any idea about how can I deploy it? The app runs on port 8080, so the URL is locally: localhost:8080/start/
but when i access XXX.XXX.XXX.XXX:8080/access/ there is no answer
I beg you to help me, I'm desperate

When you run your application in eclipse , the tomcat might be configured to listen to localhost, but still if your remote is in the same network as your local system you should be able to access the endpoints without fail.Make sure that the remote is open to the public , otherwise it won't be accessible to other devices.
If you are using spring-boot to create an executable war or jar to be deployed to a remote server for long term , you can use the Windows service wrapper provided by springboot itself to register your application as a service in windows.
Please read the doc and the sample code to implement it.

You may have to enable CORS--- #CrossOrigin on top of your controller class where you have you #RestController annotation

Related

How do I connect my Azure frontend static web app to my Azure backend app service via endpoints?

For a learning project we've built a frontend and backend application. The frontend "application" is just a bunch of linked html/css/javascript files. The backend application is a spring boot / maven / java project with some endpoints.
When I run the backend application locally I am able to send a GET-request successfully using Postman. Now we've hosted the backend application via Azure and I have no idea how I can send a GET-request, I don't know which url to use.
After I get this to work I'd like to connect front- and backend application using these url's.
As you can run the backend application in your local environment successfully, you have to follow the below steps to configure and deploy the spring boot web app to azure app service:
In a terminal window, run the following command to configure your web app with the Azure Maven Plugin
./mvnw com.microsoft.azure:azure-webapp-maven-plugin:1.14.0:config
Then, at the Command Prompt, run this maven command and set the default configurations by typing ENTER and Confirm (Y/N) => 'y' and the configuration will gets completed.
Once you've done with the above steps, run
mvn azure-webapp:deploy to publish the web app to Azure.
Your webapp URL will be displayed in the output.
I don't know which url to use?
You can use that URL from maven console output and access the web-app.
Also Refer this SO thread to know how to deploy frontend and backend to the same app service plan.

Pivotal Cloud Foundry - Deployed Spring Boot App failed to run because of java netsocket(port) permission denied

so, i tried to deploy spring boot app to a PCF Server. When i deployed it, the logs showed that my application was shut down because it failed to open a tomcat server because there is a java.netsocketexception where it says that permission denied. The tomcat server was fine for a moment (it successfully use the port) but the next moment, it was shut down because there is the permission denied netsocketexception.
the port i tried to use is port 443. i tried to look up to several kinds of problems. one of it said that i need to have root access to be able to use port lower than 1000. the problem is, my other apps, which is eureka server run perfectly even when i use port 443.
the configuration, build-pack, and everything is the same. and it is even deployed on a same pcf platform. so, why can this app failed but the other (eureka server) can use the 443 port.
can anyone tell me for the things i need to check to make sure of the problem?
Remove server.port configuration from Spring Boot yml / properties configuration. It will by default expose the service to 443 on PCF

Wiremock UI to connect to locally running Wiremock standalone server

I have downloaded the wiremock standalone jar locally. And I am starting the standalone server using below command.
java -jar wiremock-jre8-standalone-2.26.3.jar --port 8089 &
I am placing all the mocked endpoints under the mappings folder.
I need a user interface which can connect to my wiremock server and show me all the mappings.
It would be of advantage if the UI could provide features for editing, deleting and adding new files permanently.
You can take a look at https://github.com/plouc/wiremock-ui and its live demo.
Use any version from https://github.com/holomekc/wiremock/releases and run executable jar having mocked endpoint JSONs under the mappings folder.If you have not provided port configuration then UI with mapping details will be accessible over URL http://localhost:8080/__admin/webapp

Deploy SpringBoot Api into IIS Web Server

I created spring boot api with gradle build. everything working fine in my local.
I deployed angular app in Sites/DefaultsTest in IIS web server. it run in https://example.app.com/app
SpringBoot API base path is '/api'
I want to deploy spring boot api in same windows server machine and should able to access through Angular App globally.
please guide me.
IIS WebServer Dashboard
As far as I know, the spring boot API is a java web application, we don't suggest you directly hosted the java web application in the IIS.
I suggest you could try to install a docker or using tomcat to host the application, then you could use IIS reverse proxy to redirect the request to that API to get the result.
More details about how host the spring boot application on the docker, you could refer to below article.
https://blog.codecentric.de/en/2017/04/ansible-docker-windows-containers-spring-boot/
More details about how to use IIS reverse proxy, you could refer to below article.
https://blogs.msdn.microsoft.com/friis/2016/08/25/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world-apps/

How do I forward requests from a client to a Windows Service running on Windows Server

I have an Angular application deployed to/via IIS. This app is sending requests to REST endpoints exposed by a Spring Boot application which I am running as a Windows Service (The Spring Boot application is accessing a MongoDB but this should not be relevant, I think). The exposed REST interface is accessable via port 8080 on the servers localhost.
The Angular app is accessible as it should be but there seems to be a problem when the web app tries to access the Spring Application's REST interfaces. More specific: The client seems to be receiving HTML documents when he should be receiving JSON files.
I am new to working with IIS so beginner errors are not unlikely. I'm happy to share more information if needed!
Edit: I read again the question, and understood something wrong:
Looks like you were sending requests to your Angular server. For development you should use the embedded web server (https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-web-servers.html) in order to ease your server configuration steps. And from within the windows server, send request to localhost:springboot_port.
Once you want your service to be available for an external client, and to keep your service available/awake (something similar to systemd in Linux), you could try this: https://www.baeldung.com/spring-boot-app-as-a-service

Resources