I have deployed two war file in docker container, say app1.war and app2.war. app1.war is calling internally app2.war to access few services. I am able to access service in app1.war from browser and internally when app1.war tries to call service in app2.war I am getting following error
I am using Apache server and each request will be first hit to apache server and then directed to the services running in container. Apache server is running in my host as a service.
I have created Dockerfile by taking tomcat as base and copied app1.war and app2.war in webapps folder and expose port is 8080
and build image as
docker build -t myapp .
execute it as
docker run -it -p 9999:8080 myapp
http://localhost:9999/app1/service1 ----- this is accessible and this URL is internally calling a service which is deployed in app2 http://localhost:9999/app2/calculation
on hitting http://localhost:9999/app2/calculation URL I am getting below error
Connection error for URL[http://localhost/app2/calculation/]. Exception: [I/O error on POST request for "http://localhost/app2/calculation/": Connect to localhost:80 [localhost/127.0.0.1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:80 [localhost/127.0.0.1] failed: Connection refused (Connection refused)].
I am looking for a solution for this issues and want to know where exactly the issue is. Any response is highly appreciated.
Your app2 deployed on Tomcat is exposed on port 8080 within the container, not 9999. Therefore, you're getting error when trying to access it on port 9999 from within the container. If you change internal endpoint to 8080 for app2, it should work.
Now, deploying 2 war files on the same Tomcat like this is actually an anti-pattern in containerized world. The usual architecture would be to have 2 separate images/containers, each having its own war file.
Related
I build web application and service to docker from tomcat directory, in web application application.properties file I specify service url with port 8886 but when i use web call to api the application is calling on port 886. Please help me!!
I tried changing other ports, changing environment variable name but same result
I have deployed my first spring boot web application executable jar in self contained tomcat server successfully and accessing it on port 8080 but when I deployed my second app on different port using init.d on port 42000 I am unable to access it. I have looked the log in /var/log the application starts successfully without any errors. What would be the causes for my problem?
I encountered a weird problem with spring cloud. I run a spring cloud project defined server port as 8888 in eclipse as run as java application, and register this project to the remote eureka server, it's working fine. but when I package the project and run as java -jar, will register to eureka server with 8080 port, so other service access this service will get a connection refused error.
I've recently deployed SymmetricDS tutorial example to my Tomcat 8. I have three .war files created from corresponding .properties files: corp-000.war, store-001.war and store-002.war. The sync.url in corp-000.properties file is:
sync.url=http://localhost:8080/corp-000/sync
and in my store-XXX.properties files I have this:
registration.url=http://localhost:8080/corp-000/sync
For some reason, when started all three of them on Tomcat, the log says:
[store-002] - PullService - Failed to connect to the transport: http://localhost:31415/sync/corp-000
[store-002] - PullService - Could not communicate with corp:000:000 at http://localhost:31415/sync/corp-000 because: Connection refused: connect
[store-002] - DefaultOfflineClientListener - Failed to connect to the transport: http://localhost:31415/sync/corp-000
But that is the url that was in files by default, and I've changed it to what I've written above!
When I run corp-000 node on Tomcat and start store-XXX node using the command `bin\sym' (this runs embedded jetty server) everything connects and works. What am I doing wrong?
I am new to glassfish and java ee programming. I am using Netbeans. When I try to deploy my web application to glassfish server, my project output shows
The module has not been deployed.
And in the glassfish server log:
WARNING: There is no cluster named localhost in this domain.
SEVERE: There is no instance named localhost in this domain.
Any comment would be helpful. thanks guys.
In glassfish/domains folder is there a domain called domain1 (default name). if not you need to create a new domain. if there is one then make sure under glassfish/domains/domain1 a file domain.xml points to all instances of localhost