I have a Spring Boot app which writes to an ActiveMQ topic. Another application is a Spring Boot listener that reads from this topic. I am using IntelliJ IDEA 2018.1 (Ultimate Edition).
What are concrete steps to allow me to run both apps simultaneously on Tomcat 8.0.24?
I have tried changing Tomcat port from 8080 to 8081 and JMX port from 1099 to 1098 and setting a different debugger port for each application. I have also tried using an IntelliJ IDEA compound configuration and making a copy of the Tomcat install with all different ports in server.xml. I keep getting various errors like address is in use - bindException and cannot use debugger port. socket closed.
Under Intellij run configurations - create two different tomcat settings (i usually name it with the port number so its easy to identity tomcat-8080 and tomcat-8005), change ports on one of them.
http
jmx
shutdown
Related
I am trying to build a batch service in an existing application that has server.port=8080 property configured in application.properties file. When I run the batch process and Spring Batch trying to bring up remote partitions(separate JVMs), spring cloud deployer local throws error saying
"\r\n\r\n***************************\r\nAPPLICATION FAILED TO START\r\n***************************\r\n\r\nDescription:\r\n\r\nThe Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.\r\n\r\nAction:\r\n\r\nVerify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
Is there a way to make the framework generate random ports for worker partitions being the server.port property that is already configured in the application.properties as is?
Thanks.
A Spring Batch remote partitioning setup requires a message broker for the communication between the manager and workers, but it does not require any web capabilities. You seem to be deploying all your apps locally (manager and workers) as web applications, hence the port conflict when multiple workers are deployed.
You have at least two options:
Either set a random server port for each app (See how Spring Boot allows you to do that here)
Or, if the number of workers is fixed, set ports to distinct values statically.
I have production tomcat server running on 8080 port with few war files.
Now, I have created a vaadin/spring-boot jar, and I need to deploy it in that server.
I have changed the embedded port of spring-boot application to 8082. Its working fine, but the URL is showing like - localhost:8082/statprojectdemo.
And current requirement demands that 8082 should not be seen in the URL.
So, Is there anyway I can use the URL as localhost:/statprojectdemo instead of mentioning port number.
Note* - I can't use port number 8080 or 80 as my production tomcat is running on that.
The port number is hard part of the url. So there is no way to direct leave it.
Like Jens said, you need to set up a proxy server that listens on yoururl.com:80/statprojectdemo and communicates with that server on 8082.
I am creating a spring boot microservice project with intelij IDEA.
Currently I have developed three seperate spring boot rest services as customer service, vehicle service and spring cloud config server. Spring cloud config server is pointing to a github repository.
The issue is sometimes above projects take more than 10 minutes to run and sometimes does't run and give an error message as "failed to check application readystate intellij attached provider for the vm is not found". I have no idea why this happens ?
There are two possible causes:
1. IntelliJ IDEA and the Spring application are running in different JVMs.
There is a bug for IntelliJ IDEA regarding that:
https://youtrack.jetbrains.com/issue/IDEA-210665
Here is short summary:
IntelliJ IDEA uses local JMX connector for retrieving Spring Boot actuator endpoint's data by default. However, it could be impossible to get local JMX connector address via attach api if Spring Boot application and IntelliJ IDEA are run by different JVMs. In this case, add the following lines to VM options of your Spring Boot run configuration:
-Dcom.sun.management.jmxremote.port={some_port}
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
As mentioned in the official Oracle documentation, this configuration is insecure. Any remote user who knows (or guesses) your port number and host name will be able to monitor and control your Java applications and platform.
2. Prolonged time to retrieve local hostname
You can check that time using inetTester. Normally it should take only several milliseconds to complete. If it takes a long time then you can add the hostname returned by inetTester to /etc/hosts file like this:
127.0.0.1 localhost winsky
::1 localhost winsky
I use Spring Boot with embedded Active-MQ as JMS-Provider and it works quite well but: I need to run multiple instances on one host. When I start the second instance I get the following error:
2018-12-17 17:23:25.498 WARN 11042 --- [JMX connector] o.a.a.broker.jmx.ManagementContext : Failed to start JMX connector Cannot bind to URL [rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException: jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi]. Will restart management to re-create JMX connector, trying to remedy this issue.
This is of course because port 1099 is already used by the first instance. Sadly I really dont find a way to change this port using any spring.activemq.* property or an instance of ActiveMQConnectionFactoryCustomizer. Can anyone help me?
Best regards, Dominic
Do you even need jmxrmi?
You can disable it with (at least for one of your instances):
org.apache.activemq.broker.jmx.createConnector=false
(in application.properties or with VM argument -Dorg.apache.activemq.broker.jmx.createConnector=false)
I'm trying to start two spring-boot (1.3.2.RELEASE) app instances on my dev machine. The app uses elasticsearch embedded (1.5.2) through spring data elasticsearch (1.3.2.RELEASE).
I configured instances to use different ports (-Dserver.port=8081), and this works well for my other app without elasticsearch.
So, my first instance starts normally, with second instance start I'm getting
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 54022; nested exception is:
java.net.BindException: Address already in use
I've tried to get more info from the logs, but it didn't help.
logging.level.org.elasticsearch=TRACE
I even tried
logging.level.root=TRACE
No mention about the port 54022. Google doesn't help much either.
Update: I start my instances in STS. When shutting down the instance (red square button in the console view) I see that STS connects to 54022 port. Maybe it's some kind of shutdown port?
andrey:~$ lsof -i tcp:54022
STS 447 andrey 36u IPv6 0xf4ba94cfea1e25e5 0t0 TCP localhost:49424->localhost:54022 (CLOSE_WAIT)
This problem is specific to STS IDE (Spring Tool Suite). This is not reproducible if you run the app from console.
54022 is JMX Port by STS.
To solve the issue go to Run > Run Configurations... > Spring Boot App > <your_run_config> > Spring Boot (Tab).
Toggle Enable Live Bean support or change the JMX Port.