Grails https port closes application - java

Running a grails application with grails 2.4, i specify the server port and https ports (9191 and 9192, respectively) in a run-app command:
grails -Dgrails.env=dev -Dgrails.server.port.http=9191 -Dgrails.server.port.https=9192 run-app -https
which gets the server up and running. I can go to the http port just fine, but when i access the https port, i get the following message and then the browser shows a "could not connect" page:
| Server running. Browse to http://localhost:9191/inventory or https://localhost:9192/inventory
14:35:58,091 DEBUG [DefaultListableBeanFactory:128] {localhost-startStop-2} Returning cached instance of singleton bean 'grailsApplication'
14:35:58,092 INFO [GrailsWebApplicationContext:152] {localhost-startStop-2} Closing org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#26a2bd15: startup date [Mon Aug 24 14:35:17 PDT 2015]; parent: Root WebApplicationContext
It looks like going to this non-default port is closing my application! when i don't specify the port, and the default of 8443 is used, the application works fine. I've upgraded this app from a grails 1.3.7 version and never had this issue, now i can only use 8443 as my port, which doesn't work as we have multiple services on this machine requiring HTTPS.

When not running in "production" mode, whatever the port is for http, if you add one and make a request to that URL, it will stop your application. This is used for killing forked grails processes during development.
Just put a gap between your above ports you should be good to go.

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.

URL for webapp Docker Tomcat IntelliJ

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

Why does Port 9721 intermittently refuse connections on Apache Tomcat 8.5 running on Windows Server 2012 R2?

Web Server: Apache Tomcat 8.5
Operating System: Windows Server 2012 R2
Port: 9721
We are running a Web server on our internal network and have about 8500 kiosks connecting through our VPN to a Java servlet that is running on this port: <Server IP Address>:9721
This Web server was set up by a former employee and we are not sure how it was originally configured.
We noticed recently that about 25% of the connection attempts are being refused (Connection Refused error). We found this information by monitoring Port 9721 using PRTG and this monitoring tool is reporting that this port is refusing connections on multiple occasions within each hour throughout the day. I have not been able to find a pattern to the refused connections...it appears to be intermittent.
Our network administrator says it is not a firewall issue, but I have not ruled out this possibility. We have tried to review the "maxconnections" setting in the Tomcat server.xml configuration file, but cannot find the "maxconnections" attribute included in that configuration file. We do not have the Tomcat Manager Application installed on this server that I can find.
How do I troubleshoot and resolve this port connection issue?

Is Tomcat 8's port use interfering with itself when run out of Netbeans?

We have a web application that's been running on Tomcat 7, we're moving to Tomcat 8 and are now depending on an internal microservice for the application as well. We use Netbeans.
I have made the necessary changes to configuration such that I can start the microservice app and then the web application on my machine from the command line. However, when I attempt to run the web app from within Netbeans, it tells me "Starting of Tomcat failed, the server port 8443 is already in use".
I don't know why that port is reported as in use when run from within Netbeans, but not if the same server with the same web application is run from the command line. Does anyone have any ideas on what to check?
A quick way to make progress is simply to use a port other than 8443. That won't necessarily resolve the problem you are experiencing, but it will circumvent it. To do that:
Stop Tomcat.
Pick a port other than 8443. I chose 8447.
Run the following command from the console to verify that port 8447 is not already being used:
netstat -aon | findstr 8447
That's the syntax for Windows - I think it is different on Linux. If nothing is displayed then 8447 is an available port. Otherwise keep picking different port numbers until you find one which is available.
Take a backup of server.xml which resides in directory {Tomcat dir}/conf (so you can regress if necessary).
Edit server.xml replacing all instances of 8443 with 8447, or whatever alternative port you chose, and save the file.
Start Tomcat. It will come up using port 8447 instead of 8443. You can verify that in Tomcat's log shown in NetBeans; look for the string https-openssl-apr-8447 to verify:
09-Jan-2018 02:07:26.279 INFO [main]
org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
["http-nio-8080"] 09-Jan-2018 02:07:26.285 INFO [main]
org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
["https-openssl-apr-8447"] 09-Jan-2018 02:07:26.290 INFO [main]
org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
["ajp-nio-8009"] 09-Jan-2018 02:07:26.293 INFO [main]
org.apache.catalina.startup.Catalina.start Server startup in 2585 ms
You should now be able to test your web app. I just verified that this approach works using Tomcat 9 but I'm sure it would also work with Tomcat 8.
As a separate issue, once everything is working on port 8447, run netstat -aon | findstr 8443 to see if port 8443 is still being used while Tomcat is running. If so then (on Windows) get the PID of the process that is still using that port, and then lookup that PID on the Details tab of Task Manager. Here's a screenshot showing that in my case port 8447 was used by PID 2340 which was an instance of java.exe for Tomcat:
If none of that resolves anything:
Please advise which Operating System and which version of NetBeans are being used.
Add the relevant portion of Tomcat's log within NetBeans to your post.

Tomcat 7 server says it's listening on debug port but doesn't accept any connections

I'm working with a Tomcat 7 server running on Ubuntu. I've configured the etc/default/tomcat7 file to accept remote debugging requests through the instruction in this thread: Setting up JPDA for Tomcat7 in ubuntu-server
When the server restarts, in the catalina log file, it says that it's listening on port 8000, but I can't connect to it.
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Listening for transport dt_socket at address: 8000
I've tried connecting to it through Window's Telnet tool as well as through the Eclipse debugger but the connection is always rejected. I also had all 4 of my teammates try connecting to it as well, to rule out issues with my own firewall, but they were unsuccessful as well.
These are the settings for my Eclipse debugger:
And the error message in Eclipse:
Any ideas?
After a little more digging, it turns out that AWS was blocking the port.
For anyone reading this, you can check to see if the port is being blocked through: yougetsingal's port forward checking tool.

Categories

Resources