Two Tomcat Services in a VM - java

Installed two Tomcat 9.0.60 services in a single windows VM with diff ports(8080 & 9090), did the same config changes, deployed same version of applications which shares the same DB. I found that the Tomcat with port 9090 is dead slow and I couldn't even open the application. It takes ages to load a single page.
Tried all the ways (Changing Tomcat versions, deploying diff version of Application and changing heap). None resolved my issue.
So, I deleted the 9090 Tomcat service and copied the 8080 Tomcat to 9090 Tomcat's location and started. It works as expected.
any idea what went wrong ?

Related

How do I debug a Java application deployed in a cluster environment using IntelliJ IDEA?

Each time when I need to debug a Java application deployed in a cluster environment, I'm in big trouble.
Company's environments (Test, Acceptance, etc.) usually is cluster environments with multiply servers and in front of the cluster, there is a proxy server that forwards the requests (HTTP) to one of the servers in the cluster. If you have no access to the individual servers and you are not allowed to lunch the app from one particular server then you must use the endpoint that comes from the proxy.
As I know one IntelliJ can open only one remote debug connection. That means if the request goes to another server in the cluster (where my debugger is not attached) then I can not see anything in my debug window. Maybe next time.
If you are lucky you can stop all servers in the cluster except one, what you are debugging. But to stop servers is also not easy, especially in Acceptance environments.
According to my colleagues, I can debug multiply servers with one Eclipse instance, but I really do not want to use Eclipse.
Okay, I guess that I can copy the whole source code to a different folder, open the code with a new IntelliJ instance, and from there I can connect to the 2nd server in the cluster. But this is a painful hack.
Is there any normal way how to debug the cluster environment with multiple servers with IntelliJ?
You can open as many number of debug sessions as many remote JVM are running on remote ends (on corresponding ip address and tcp port) by creating multiply Run Configurations and launch them:
For example to connect with the above host and port, the remove JVM must be started with
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
if you use JDK version 8 or less, and the
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
if you use JDK version 9 or newer.

debug two applications in tomcat in different eclipse instances

I have two server java applications.
One of the applications is running in one eclipse instance - it connected to remote tomcat application to port 5005.
Another application is running in another eclipse instances. But when I try to connect it to remote application to port 5005 - I've got connection refused error.
I start tomcat after setting JAVA_OPTS
C:\Users\username>set JAVA_OPTS=-Dapp.environment=LOCAL -Dapp.config.dir=/D:\config -Xms1024m -Xmx4096m -XX
:NewSize=512m -XX:MaxNewSize=1024m -XX:PermSize=512m -XX:MaxPermSize=2048m -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n
and then use catalina start.
So the question is:
How to allow debugging of two applications in different eclipse instances but connected to the same Tomcat instance?
You can make a separate copy of the Tomcat directory for the other Eclipse. Proceed with the normal process of creating new server with New -> Server. Be sure to select the duplicate Tomcat as the server. Then after that, double click the server in the Servers tab and change the Server Ports to be different with the first Tomcat instance.

Tomcat 7 ignoring my server.xml file (vhost)

I am running into a wall with the tomcat manuals.
I want to run two domains on the same server by using tomcat.
I was successfully changing the port 8080 to 80 in the server.xml
Then I wanted to configure the vhosts as its written on the apache tomcat page.
After spending days in it, I gave up and just moved the server.xml to an other place and saw that tomcat is not even taking care about that. Not even a single error in the log files.
Tomcat is installed at /etc/tomcat7 on an ubuntu server.
Other softwares are ip2ban and java8 - so nothing specially going on there.

eclipse port occupying error on startup

I am getting this error while starting eclipse. I am using eclipse on windows 7
"There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.
Command start-domain failed."
I have searched and found that if i put mny hostname against 127.0.0.1 then this problem can be resolve but my problem is that i can't place my hostname in my host file due to our organization internal network security and i can't even edit this file.So i want that this glassfish server stops allocating 4848 port and starts working on another port.
Please help as i got stuck in this issue.
Thanks
The Eclipse plugin contributes its own Glassfish instance that runs only as long as Eclipse runs. Uninstalling your standalone copy is probably a good solution for you. If not, reconfigure the standalone copy to use a different admin port.
A simple Google search will cover that for you. Here's what I have found as the top hit.

problem with tomcat 6

I just started the tomcat and opened my browser and gave http://localhost:8080. But i found 404 error.
I tried running the same in eclipse i got the following error message.
Several ports (8005, 8080, 8009)
required by Tomcat v6.0 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).
What could be the problem?
I just started the tomcat and opened my browser and gave http://localhost:8080. But i found 404 error.
Tomcat runs fine, but there was nothing to serve on the given URL. There's no ROOT webapp anywhere or there's no welcome file. You need to either deploy a webapp or let the URL point to a valid resource.
I tried running the same in eclipse i got the following error message.
Several ports (8005, 8080, 8009) required by Tomcat v6.0 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).
A port can be used only once by only one application at time. This indicates that you haven't shutdown the first instance of Tomcat before you run the one in Eclipse which is apparently been configured to listen on same ports.
If you are using windows, probably tomcat is running as a service.
Control Panel -> Administrative Tools -> Services -> Find Apache Tomcat 6
Right Click and choose properties
Startup Type : change it to manual, and hit the stop button.
click, ok and close all windows.
You can now run tomcat from eclipse IDE without changing the ports.
Just go and kill the javaw process.

Categories

Resources