XAMPP: tomcat doesn't start from control panel, starts only from bat - java

I installed XAMPP and have trouble starting tomcat. Apache, MySQL, FileZilla start without problems when I click the "Start" button, while Tomcat writes Attempting to start Tomcat service... and seems to pass out - it doesn't start no matter how long I wait for it.
I can start it manually from catalina_start.bat though. But I really wish to find out what causes this problem and be able to start tomcat from control panel. Please help!

I think that problem is about port conflict, by default both Apache and Tomcat using port 8080, when you using XAMPP and start Apache first then Apache hold that port then you can not start Tomcat, you can start Tomcat via bat file my be because you already stopped the Apache. Also by default when you click on Start button of Tomcat on XAMPP, it will call to catalina_start.bat file.

Related

Spring Tool Suite embedded server won't start after windows 8.1 upgrade

A strange thing has happened and it seems like it was triggered by the latest Windows upgrade. I upgraded from Windows 8.0 to 8.1, and ever since then, the embedded tomcat server in Spring Tool Suite won't start.
There's no indication of any problems in the log/console output, and the console says that it started up normally, but in the servers tab it says that the server is still in "starting..." status (seen below).
After 120 seconds I get the following dialog:
Server Tomcat v7.0 Server at localhost was unable to start within 120 seconds. If the server requires more time, try increasing the timeout in the server editor.
I tried running the Tomcat server from a command prompt and it works fine. I can start the server and deploy my app fine.
Any ideas?
just Double Click on Server it will open one window and click on time outs and give 300 seconds and try it. it will started thats for sure .
Its very simple , You need to double click on your server. It will open server editor window where you can edit the default start time of server. For reference I am going to attach here screen shot.
Maybe you need to change file permissions. For example, if the server is stored in C:\SpringToolSuite\sts-bundle\pivotal-tc-server-developer-3.1.1.RELEASE, (For Windows 7) Double click in C:\SpringToolSuite\ < Properties < Security. Then change the permissions to "Total Control".

Tomcat console remote

I'm starting tomcat by cmd (Windows) then Tomcat opens a java window like a console, tomcat log when people login/logout and shows it in this "window". I want to access remotely this "window" screen while server is running to admin who is login/logout. I saw Jconsole and it don't show what I want. What is the alternative?
If you want to manage the tomcat, i think you can try to use Tomcat manager which is built-in in Tomcat server. you can access to it with /manager/html. In addition, you can use remote desktop to your remote host as a alternative.

How do I debug Java servlet filters, on-the-fly, from a remote machine (I'm using Eclipse and Apache Tomcat 5.5)

I wrote a Java servlet filter on my local machine and deployed it a remote (machine) web server. Unfortunately, it's been very difficult and time-consuming trying to trace errors reported by Apache Tomcat 5.5, my JSP/servlet engine. I can't keep writing System.out.println(...), saving, deploying, testing JSP pages, and so on. It's taking too long. There has to be a better, faster way.
Is it possible to remotely debug servlet filters? I don't have a web server on my local machine, which is why I'm asking about remote debugging. Specifically, I'm looking for a way to debug, line-by-line, the servlet filter, on-the-fly, as it's happening on the remote web server. Does such a method exist?
Or, is there a better method than writing to standard output. It's taking too long and I feel that must be a more efficient means of debugging Java servlet filters.
Note: I'm using Eclipse for development.
Thank you very much for any help.
Update
Thank you all for your help. I really appreciate it.
I added the JVM argument to Tomcat, restarted Tomcat. Then, on the machine with Eclipse, I entered in the appropriate info in the Debug config, put the breakpoint in, and tested. Unfortunately, it did not work. In the config, I left it as Socket Attach, clicked apply, and that was it. I pressed the debug button and it said the connection was refused. I tried ports 8000 and 8001 and both did not work.
Let me explain what I'm trying to do, that might be better.
I have a login page called login.jsp. On that page, is a form whose action attribute is servlet/LoginServlet. When the user submits the form, it calls servlet/LoginServlet, which is mapped to a class in the web.xml file. Let's call this class com.mysite.mypkg.classA. In class A, it calls a method from another class called com.custom.mypkg.classB. I want to put a breakpoint in classB.
So, using the url with login.jsp page in the Eclipse debugger won't call it. I tried using servlet/LoginServlet and that also did not work.
What should I put in for the URL? Or, do I debug this type of setup?
Thank you.
Update 2
I found this site here, which is pretty comprehensive. I ran netstat -a and noticed that the debug port is not listed. Windows Firewall is turned off, but there could be another thing blocking the port, who knows. Anyway, I placed the VM argument here and it's not working.
Thank you.
For remote debugging you need to start the server in debug mode. There are couple of ways doing that.
1 > start the server using
catinlina.bat jpda start
2 > Add an jvm argument to the tomcat java process
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Once the server is started in debug mode , you need to change the perspective of the project in eclipse to debug.
Then go to Run - > Debug configuration.
Double click remote java application and enter the details such as
Remote IP address
Debug port . Default tomcat debug port is 8000. If you use jvm argument, use the port mentioned in the jvm argument.
Click Apply
Go to the java file you want to debug.
Put a break point in the source code and run the scenario you want to test (Eg Web application using browser)
Also , ensure that the code in the java file is in sync with code deployed on remote server.
Happy Debugging!!!
Peace.
Sanket Raut
You can attach a debugger to a running Tomcat instance, provided that you gave it the right command line options when you launched it.
The Tomcat Development Wiki explains how to do this, and as a bonus gives you instructions on how to set up to debug from the Eclipse or NetBeans IDEs.
Of course, attaching a debugger to a running Tomcat has both security and performance implications*.
* And OH&S issues - you might get badly scratched if you tried this on the wrong kind of tomcat ...
You should run your remote tomcat with the following starup parameter:
bin/catalina.bat jpda start
Then in Eclipse on your local machine go to Run -> Debug Configurations -> Remote Java Application, create new configuration here, use IP of the remote machine as a host and 8000 as a port there
Run this configuration and use the breakpoints in Eclipse for debugging

difficulty setting up apache tomcat

I am trying to install, run and do something with tomcat for the first time.
apache-tomcat-7.0.16-windows-x86
I am running windows 7/firefox 4.0.
My first step is to run tomcat and be able to see some welcome screen on
http://localhost:8080/
I get the error that:
Firefox can't establish a connection to the server at localhost:8080.
I connect to internet by using a data card, if this info is needed at all.
I have also downloaded/installed JDK,struts in the system, but I think the above step doesn't need or clash with these things.
try with
http://127.0.0.1:8080/
http://www.coreservlets.com/Apache-Tomcat-Tutorial/

A problem occurred when I tried to run a java web-app on server

I use eclipse for java EE as my IDE and tomcat as my server. Here's the problem:
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.
It is as the exception says - you have a running instance of Tomcat (or, less likely, something else), that's taking ports 8080 and/or 8009. What to do:
if you've started tomcat, find it and stop it: using /etc/init.d/tomcat stop, or administrative tools > services > apache tomcat > stop, or shutdown.sh / shutdown.bat
if it is not you, find the process of tomcat and kill it (task manager on windows, and something like ps ux on nix)
if you don't find it, reboot
It looks like you have a Tomcat running already. It is possible that Eclipse couldn't stop Tomcat and now that it tries to run it again, it can't. Find and kill the existing process or reboot.
Issue the tasklist command in command prompt.
It should display tomcat as one of the processes. You can kill it by issuing either taskkill /IM "image_name" or taskkill /PID "process_id"
Others have mentioned that you could try and track down what's using those ports (perhaps another instance of Tomcat?), and kill it. However it might be that Windows itself is using them.
Killing the rogue program, or rebooting, might cure the problem for now, but to prevent this happening again, you need to reserve the ports you need. KB812873 explains how to do this.
Disclaimer: This KB article is for Windows Server 2003 and Windows 2000, and it's a while since I had to do this (for a few Windows Server 2003 installations). However I imagine it's the same for Windows 7. If not, someone will correct me :-)
Several ports (8080, 8009) required by Tomcat v5.5 Server at localhost are already in use.
You are not required to run Tomcat on 8080 or 8009. I am using Eclipse 8.6. I have set my Tomcat port to 8086 for eg.
Here are the steps to do it:
Stop Tomcat.
Click on the Run/Stop/Restart dropdown button
Select MyEclipse Tomcat
Click Configure Connector
Change port to whichever one you think is free.
To make sure you see these options make sure you have the latest version of MyEclipse.

Categories