How do I find the port number of my SpringBoot app so I can call it? I already tried setting -Dserver.port=8080 and--server.port=8080 in VM arguments and in src/main/resources/application.properties.
If I try to go to localhost:8080 Chrome says refused to connect. I simply want to be able to connect to my App don't know why Spring Boot made finding which port is being used so challenging.
I'm using Eclipse and the app appears to be running properly from the logs.
This simply printed 0:
#Value("${local.server.port}")
int port;
I've tried these answers none work:
Spring Boot - How to get the running port
Spring boot - how to get running port and ip address How to configure port for a Spring Boot application How to configure port for a Spring Boot application
localhost:<your port> may not respond at all. Make sure you're hitting an endpoint you know is availible like localhost:8080/info. Make sure your app has completly started, it could take serveral minutes.
As #BrianC mentioned make sure your app is actually a web server.
in your springboot main method use below code to detect port of your application
Environment environment =app.run(args).getEnvironment();
System.out.println(environment.getProprty("server.port");
this will tell you actual port where your aplication running .
Value can be found using Spring’s Environment as it represents the environment in which the current application is running.
It can also be used to find other properties in applications like profiles.
#Autowired Environment environment;
String port = environment. getProperty("local.server.port");
Related
I'm using jboss 7.2,and I created a log4j2.xml and placed in the server, application running in the domain mode there are two server instance in each ip, application logs are printing only for one server instance and another server instance logs are not printing,how to print the both server instance logs are in separate files.
Is anyone having idea pls help on this.
Sorry....you cannot use log4j2 in JBoss7.2.
Only WildFly 22 supports Log4j2 out of the box.
However, you may implement Log4j2 to other versions of WildFly, according to this tutorial. However I did not try myself.
By default, applications in wildfly are deployed to localhost:8080/app. How to deploy application on dedicated port, i.e. open it on localhost:8282 without application name ending?
I need to change the port for certain application, not the default port.
I have not tried this, but AFAICT it should be possible to:
run a single Wildfly instance listening on multiple HTTP ports. This is, in theory at least, possible (ref: https://developer.jboss.org/thread/233414?start=0&tstart=0)
Configure undertow subsystem as a reverse proxy, and proxy your app to the other port/location (ref: http://www.mastertheboss.com/jboss-server/wildfly-8/configuring-a-reverse-proxy-with-undertow). That said, I have never used undertow for a reverse proxy and as such cannot speak for whether this really works.
Once you have done this, you have effectively just turned your Wildfly instance into an overly complex application server and reverse proxy in one. Ultimately however, the app in question would still be running on both ports, but you redirect the traffic using the proxy the way you would like.
The same proxy configuration in an Apache (ref: https://httpd.apache.org/docs/current/mod/mod_proxy.html#forwardreverse or https://www.leaseweb.com/labs/2014/12/tutorial-apache-2-4-transparent-reverse-proxy/) or NGINX (ref: https://www.nginx.com/resources/admin-guide/reverse-proxy/) would be IMHO less complex and better tested in countless production scenarios.
With Angel.SR3, assigning server.port: 0 would assign a random port to embedded Tomcat instance and use that port when registering with Eureka (using random instance ID as well in order to run more than one instance of a service on my dev machine).
I want to use the new Spring Cloud Sleuth for automatic tracing so first I just tried using spring-cloud-starter-sleuth at 1.0.0.M1 but trace and span didn't show up in log files when using the logging pattern in the example app. I thought it might be related to the versions of the other libraries that I was picking up with Angel.SR3 so I tried experimenting with Brixton.M1. With Brixton.M1, trace and span are now being set correctly but my service no longer registers its random port with Eureka - port 0 is registered instead. Tomcat DOES come up on a random port, however.
I added a breakpoint in EurekaDiscoveryClientConfiguration.containerPortInitializer() and it is not hit until AFTER the service has registered with Eureka Server in Brixton.M1 and is hit BEFORE service registration in Angel.SR3.
Am I missing something or is this currently broken in Brixton.M1?
This is a known issue that has been fixed in snapshots. Another milestone will come in the next week or so.
I am a newbie to working with jboss 7 as- I recently set it up on my server, and am able to start it as well.
However after starting it, when I access
http://IP_ADDRESS:8080
or
http://IP_ADDRESS:9990
Google Chrome gives an error that the page is unavailable.
How can such access be enabled? Also, I am using the startup-shutdown script for /etc/init.d as provided with jboss, do I have to modify the startup and shutdown commands in it, for enabling remote web access to the server interface?
Have you tried http://localhost:8080? If you're using the IP address of your PC it's probably the firewall that is blocking the access to it.
I'm trying to write a Servlet in eclipse configured to use Tomcat 5.5 and I get the following error when I try to run it:
Several ports (8080, 8009) required by Tomcat v5.5 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s)
As far as I know, Tomcat 5.5 is the one using port 8080, and when I go to http://localhost:8080 I do get the Tomcat success page, so it looks like eclipse tries to run another instance of Tomcat without shutting down the original and fails. How do I solve this?
like it says, something is using the port.
there are two solutions for your problem.
identify (on windows with netstat command) what is using the port (e.g. skype, ...) and stop it
change the port of your tomcat runtime in eclipse -> http://techteam.wordpress.com/2009/02/13/changing-the-tomcat-port-settings-in-eclipse/
hope this helps