URL for webapp Docker Tomcat IntelliJ - java

I'm using a Tomcat 9 server in a Docker container to deploy locally a webapp for development purposes. I can connect to my Tomcat using http://localhost:8080/ But I can't find my webapp URL anywhere. My Docker container is deployed from IntelliJ, and I have no URL field in the configuration of the Container.
Does anyone know where to find/set the URL ?

There is no URL to be set, at least not explicitly.
Once you have your application started in a container (either started through IntelliJ IDEA, Docker Desktop (for), command line...) with the port binding configuration (the Bind ports config section in your screenshot), you are only left with the application as if it was started on the host on the mapped port (the first section before the colon : in the port binding).
Which means you can simply access your application on:
http://localhost:8080
following the pattern for a URL: (protocol)://(host)(:port) where:
protocol is HTTP since you mentioned using Tomcat as a web server
host being you local station where the docker daemon is running on
port being the port you chose to map to the started container port

Related

Error during Intellij idea remote Tomcat Server debug

I've some problems during configuration of remote Tomcat Server in Intellij
I've got a java web app that need to run in a cluster configuration, so I've got 3 Linux VMS in which I've installed tomcat server.
The problem is that I need to use this 3 tomcat servers together in debug mode in order to test and check issues.
I've tried some things but I was not able to get a solution.
OPTION A: configuring Remote JVM Debug:
I've tried to configure a Remote JVM Debug on my intellij configuring Catalina to listen to another port (2001) and launch it with the command: sh catalina.sh jpda start -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:2001 but it stucks on this message "Connected to the target VM, address: 'IP:2001', transport: 'socket'"
OPTION B: remote Tomcat server:
I've tried configuring a remote Tomcat server (that is the thing I prefer) configuring remote host with SFTP, but in this case Tomcat service start, it works for some minutes and after that it goes in TimeoutException
[](https://i.stack.imgur.com/XmDKx.png)
I hope anyone can help me, I read a lot of thing on the internet but no-one works.

How to limit AEM access to localhost?

To load some code, I need a clean local AEM Author instance running on my laptop. I start it using CLI like :
bash$ java -jar aem-author-p4502.jar -nointeractive
Default user/password is then admin/admin to access AEM on http://localhost:4502. I'm ok with that but I've tested from another computer and port 4502 is open from full local network.
I'd like to limit access only from localhost, maybe by configuring listener address to 127.0.0.1 only. How ?
Recent AEM versions uses Apache Felix Lightweight HTTP Service as HTTP Server. I found how to bind it to 127.0.0.1 when it is embedded in AEM.
Configuration file is crx-quickstart/launchpad/config/org/apache/felix/http.config. I added last line :
:org.apache.felix.configadmin.revision:=L"1"
org.apache.felix.http.session.timeout=I"10"
org.apache.felix.https.jetty.protocols.excluded=[ \
"SSLv3", \
]
org.apache.felix.proxy.load.balancer.connection.enable=B"true"
service.pid="org.apache.felix.http"
org.apache.felix.http.host="127.0.0.1"
Now AEM Author is available only from localhost.
Maybe you can try to add an exception on your firewall to the port 4502 and only enable connections from your local and deny the others.
Regards,

Spring boot admin with docker resolves docker hostnames and IPs

My Issue/Setup
I'm trying to build a stand-alone spring boot admin application which all our instances (in a private VPC- behind a network load balancer) can register with.
But my spring boot application itself runs inside a docker container, so hostname and ip-address always defaults to the container hostname and container ip-address.
And spring-boot admin fails with
`Request failed with status code 502`
Connection refused: /1XX.17.0.2:8840
because it cannot find actual hosts with the hostname or the IP addres.
What i tried
I had the set up working with below (one instance),
`spring.boot.admin.client.instance.service-base-url`
But cannot use this for multiple clients as i cannot specify a comma separated value.
Moreover, since there can be n number of instance at any time i do not want to use the below property.
`spring.boot.admin.client.instance.service-base-url`
So i took the suggestion to omit spring.boot.admin.client.instance.service-base-url on spring-boot-admin git hub page and issues section and used below instead
`spring.boot.admin.client.instance.prefer-ip=true`
But Since my applications are running inside a docker container,
spring boot clients register itself with container id/ip-address as the hostname/ip-address.
I also tried the "--net=admin-network","--name client" parameters in my AWS beanstalk file
"containerDefinitions": [
{
"name": "cloudy-email",
"image": "xxx.dkr.ecr.us-east-2.amazonaws.com/sba-admin-repo:xx_2019-04-24_14.36_e9aax8710",
"command": [ "--net=admin-network","--name client"],
"Update": "true",
How can i overcome this issue?
Any pointers/references would be much appreciated.
You can make docker run in the host network using the --network host option to the docker run command. This will make the container assume the same IP address of the host VM. Also, check if you are exposing the admin port through Docker and the host firewall (security groups).
More info: https://docs.docker.com/network/host/

Communication between spring boot dockerized apps

I new using spring boot and docker and I faced a problem running the docker containers.
On debug mode, there is no problem on applications boot, but when I run them as a container, there is something wrong.
For example, I have my server config with all the yml files, also eureka properties.
The config server boot perfectly, but not the eureka server, it must look for it`s configuration to the config server becouse of these:
uri: ${vcap.services.config-service.credentials.uri:http://127.0.0.1:8888}
In the eureka`s log I can found:
Could not locate PropertySource: I/O error on GET request for
"http://127.0.0.1:8888/server-eureka/default":Connection refused;
nested exception is java.net.ConnectException: Connection refused
So I see that eureka cant connect to the config server for a reason I cant understund.
Maybe I miss something in my docker file.
If you are not using docker linked containers you'll have to use only the public ip addresses. Docker will assign every running container an own ip address which is per default not accessible. Only when you start to expose ports there will be an entry to iptables that is linking the hosts public ip address and given port to the internal used port and (dynamically assigned) ip address of the docker container. This is also why 127.0.0.1 does not work cause it would look into the containers local context but tgere the service is not running.

Port and url error in heroku app

I made a webservice that publish a wsdl file , here is the code
Endpoint.publish("http://localhost:"+args[0]+"/main/webServ", new WebServiceImpl());
and here is the procfile
worker: java -cp target/classes:target/dependency/* com.example.Publisher $PORT
there is no error in the log file and I got the port number from there lets say its "7435".
and when I run :
telnet whispering-beyond-3102.heroku.com
I got nothing
how can I access the webserice url ? , I tried to go to:
http://whispering-beyond-3102.heroku.com:7435/run/java/main/webServ?wsdl
I get no output
what URL should I use
If you are exposing a web service, you'll want to be defining a web process in your Procfile instead of a worker process. This will tell Heroku to inject the $PORT environment variable on app start up and route web requests to your app on that port. Web requests from the Internet to your app should be on the default 80 (or 443 for HTTPS) and then Heroku will route the request to your app on the provided $PORT. Once you fix the Procfile, you should be able to access your web service at (on default port 80):
http://whispering-beyond-3102.heroku.com/run/java/main/webServ?wsdl

Categories

Resources