I am trying to create a RESTful website using Spring Tool Suite. I am getting the error:
"Failed to refresh live data from process 90196 - com.example.demo.DemoApplication after retries: 10."
I am unsure why I am getting this error. Any suggestions on how to fix it?
Yes, I can explain that... :-) This is part of this feature of the tooling:
https://github.com/spring-projects/sts4/wiki/Live-Application-Information
The aim of this feature is to provide live information from a running Spring application and merge that information with the source code of your workspace, so that you get live information in-place right within your editor.
This information that the IDE uses is provided by the Spring Boot actuators. In order to make this as automatic and easy to use as possible, the IDE automatically tries to connect to a running Spring process and tries to identify that live information. This might not work for various reasons (like the process is not responding, the Spring app doesn't have the actuators on the classpath, JMX connection isn't working, whatever). After trying to get the data for a specific process 10 times, the tooling gives up (assuming there is no live data to extract from the process) and shows the above message.
You can disable this "automatically try to connect to a running process" in the Preferences -> Language Servers -> Spring Language Server -> Spring Boot Language Server -> Spring Boot Java and disable Live Information - Automatic Process Tracking Enabled. If you want to display that live information nevertheless, you can connect to a running process manually, too (using the quick access or the action the boot dashboard views menu). In that case, take care to add the actuators to the Spring Boot project before starting up the app.
Hope that helps!
Related
We are trying to deploy Camundas webapplications as standalone spring-boot application and also deploy .bpmn diagram and engine in another stand alone Spring-boot application. But only connect the two SB-apps via a shared DB or REST-calls, and still be able to update the task through Camundas webapplications.
We have managed to deploy them and connect them to a file based H2 database. So now we can do rest-calls to the .bpmn Spring-boot app and submit forms etc. and then make it show in the Webapps-tasklist/cockpit.
The problem is that if we try to submit the form through the tasklist, we get an error that it’s trying to look for a javaclass (which we have implemented in the engine-SB-application but not in the Webapplications-SB-application).
Is there any way to make it so that we can use the web-apps-tools and submit the form from there (without changing that the .bpmn diagram uses java-classes)?
Either through making the webapps update the database, or maybe through REST-calls?
We solved it by using Asynchronus Continuation.
A very good video about can be found here:
https://www.youtube.com/watch?v=Nx4I8lNMUs0
There is Spring Boot application that runs on the server without exposing to external world. I connected Sentry to monitor it but never got any errors, even I have tons of them in the logs.
By without exposing to external world I mean that there is no open url that everyone can use for API connection.
How should I configure Sentry in order to get errors? Should I fall down to other scenarios, not default Spring Boot app configuration?
Sentry doesn't need to connect to your application. When you add Sentry's SDK to your app and configure it with the correct DSN, your app will connect to Sentry to send errors as they occur.
For that you need to make sure the DSN you used goes to the project your expect to see the events in Sentry. That could be a reason why you don't see the events.
Perhaps your server has not access to the Internet? Or if it does, it requires use of an internal proxy server which was not configured in your server/application/sdk.
I fight with this problem for some time but it seems that either some of error messages were lost on the way or Sentry.io default configuration for Spring Boot sends messages with low threshold, so 1 error message for several actual errors.
In the end, it fixed itself.
While my Spring Boot Rest application is already running, I want to be able to turn the Rest functionality on and off at will programatically without having to restart the application.
How do I go about doing so?
EDIT: When I say turn off Rest Functionality I literally mean that Tomcat stops listening on the port. And it starts listening on the port again when it's turned on.
I can see two possible solutions:
Close the port on the machine by creating a schedueled task that is responsible of opening and closing the port on specific times
In Spring terms, what you want to do boils down to a configuration change. SpringBoot provides a standard way to refresh configuration changes without having to restart your application. This is achieved by refreshable beans. What you can do is override the default Tomcat bean by a custom bean that is refreshable. Then you can create a task (through a CI, schedueled script ...) that will update the configuration (you can provide config as Env variables) and refresh the beans of the application.
The first solution is much easier. The second approach needs some more development inside your application.
I am migrating from PlayFramework 1.* (java) to SpringMVC (but not using SpringBoot). I have some questions about the transition:
1) In Play framework there is an opportunity to show an error in a browser, when you deploy an app in dev mode. As I understood in Spring there is nothing like that, but I always see error pages with 500 http code when errors occur. That is no good for users to see those exception logs. In Play it is easy to stop showing those messages to users by switching to prod mode, but how to do that in Spring? (I deploy the webapp to tomcat7).
2) Is there any way in SpringMVC to get a path to any controller as it can be done in Play's template engine with #{Controller.action} tag? In Spring I use JSP for rendering web pages.
3) In examples of Play projects I saw before, properties like URLs of external resources or some texts are stored in .conf files that are divided into development.conf, production.conf etc. Play loads them (not automatically hough) depending on which server is running the application. Is there a way to create and load such kinds of property files in Spring and make it easier to switch between those configurations on different servers?
If you are new to web programming and Spring MVC and Play I wouldn't start learning with the combination of Play and Spring. I recommend start either with Spring or with Play. Nearly everything you can do with Spring MVC you can do with Play itself too and if it is dependency injection you are after then Play comes with Guice out of the box.
For Spring I'd recommend starting with Spring Boot (and MVC of course). There is a good tutorial on their site.
For Play I'd recommend their official documentation. You could also look at Lightbend's templates and filter for Java, e.g. this one seems to be a good starting point for a simple web app.
I built a simple jhipster app to start a new Spring Application project from. I chose:
Java 7
Local Auth
Postgresql both for production and development
No HTTP sessions
No Websocket
Ehcache
Maven
Grunt
I created the relevant Schemas in Postgresql and started the app with mvn spring-boot:run in the terminal and I get a starting page for my application on localhost. Only the navigation is visible and none of the attached javascripts seems to be running or at least working properly. In the javascript log I get "ReferenceError: angular is not defined". None of the links take me anywhere.
Talking about logs, the startup says the app is using org.jboss.logging. I see no log files. Anyone knows where the logs are? I'm trying to read the source code for log settings, but I can't seem to find the proper settings.
There are no created tables in the database either.
I assume there is a setting I missed somewhere, but I don't have a clue yet. Hopefully I can find the logs soon and get one.
Any ideas how to diagnose this problem is most welcome. Thank you.