I am trying to host my web app through Tomcat. I am using the Spring framework and have Tomcat set up. I have converted it to a Maven project and one a Maven file and moved the war file to correct webapps folder in the Tomcat installation folder. When I try to run, it gives the me the error:
Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
In the console, I see that it gets stuck on
Building JPA container EntityManagerFactory for persistence unit 'default'
I am using an MySQL database and in the MySQL workbench it says the server is running. I am really confused as to why this is happening. I have even tried the following:
Click on Window > Show view > Server OR right click on the server in "Servers" view, select "Properties".
In the "General" panel, click on the "Switch Location" button.
The "Location: [workspace metadata]" should replace by something else.
Open the Overview screen for the server by double clicking it.
In the Server locations tab , select "Use Tomcat location".
Save the configurations and restart the Server.
Can someone tell me why this is happening? Thanks for any help
Open the Servers Tab from Windows>Show View>Servers menu.
Right click on the server and delete it.
Create a new server by going New>Server on Server Tab.
Click on “Configure runtime environments…” link.
Select the Apache Tomcat v7.0 server and remove it. This will remove the Tomcat server configuration. This is where many people do mistake – they remove the server but do not remove the Runtime environment.
Click on OK and exit the screen above now.
From the screen below, choose Apache Tomcat v7.0 server and click on next button.
Browse to Tomcat Installation Directory.
Click on Next and choose which project you would like to deploy.
Click on Finish after Adding your project.
Now launch your server. This will fix your Server timeout or any issues with old server configuration. This solution can also be used to fix “port update not being taking place” issues.
Source: Fix Tomcat
the server requires more time to start but the default start time limit is 45 seconds .
All you have to do is open the servers tab, right click on your server and click open , a menu will be opened in your editor , open submenu Timeouts and change the value of Start (in seconds) to a higher value for example 300 seconds. and start your server again.
In my case, the problem came from an impossible loopback on localhost.
Tomcat effectively started (I could call "http://localhost:8080/myApp"), but Eclipse didn't get a response of that and it considered Tomcat keep on starting.
A software called ZScaler (set by admin to protect the enterprise) on Windows 10 put loopback restrictions. Fortunately, an option existed to disable loopback restrictions on ZScaler.
A VPN may cause the same restrictions.
If you don't find which application cause the trouble, you can change "Host name" in Eclipse's Tomcat General Informations, from "localhost" to "yourIP" (ex : 179.25.14.178), BUT this trick won't allow DEBUG MODE.
Related
I had install tomcat10 on my Pi 3B+ Debian full desktop Linux 32bit OS
To make the tomcat10 server successfully instal on my freshly build machine I follow the following recommended settings.
pi#Home:~ $ java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-post-Raspbian-1deb10u2)
OpenJDK Server VM (build 11.0.9.1+1-post-Raspbian-1deb10u2, mixed mode)
Then download and install tomcat10 from:
wget https://downloads.apache.org/tomcat/tomcat-10/v10.0.2/bin/apache-tomcat-10.0.2.tar.gz
Change the IP address to my local IP address in both following XML files:
Manager File: ./webapps/manager/META-INF/context.xml Host Manager
File: ./webapps/host-manager/META-INF/context.xml
<Context antiResourceLocking="false" privileged="true" >
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
sameSiteCookies="strict" />
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1|192.168.0.16" />
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
After installation complete, I manage to set the environment and start the server
root#Home:/usr/local/tomcat10# ./bin/startup.sh
Output:
Using CATALINA_BASE: /usr/local/tomcat10
Using CATALINA_HOME: /usr/local/tomcat10
Using CATALINA_TMPDIR: /usr/local/tomcat10/temp>
Using JRE_HOME: /usr/lib/jvm/java-11-oracle
Using CLASSPATH: /usr/local/tomcat10/bin/bootstrap.jar:/usr/local/tomcat10/bin/tomcat->juli.jar
Using CATALINA_OPTS:
Tomcat started.
but when I type localhost:8080 I get an error message:
This site can’t be reached localhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
As some of the articles on the web suggest to change port 8080 to port 80 in server.xml even trying this option doesn't solve my problem because I have apache webserver running on port 80 by typing localhost:80 it loads the index page for apache webserver
As it is a fresh install and I do not have any firewall installed in my system even on my Router firewall I have enabled TCP/UDP ports 80 and 8080
can anyone please suggest what should I do to load the tomcat index page?
As I have posted this question couple of days ago but I was unable to get an answer so I decided to try a few methods of my own to see if I can resolve the problem. In my case solution, I am posting solved the above issue and I am able to connect to localhost:8080 from my browser window. I have to confess I found this solution by flook I still don't know the logic behind what made it work but it is working.
root#Home:/usr/local/tomcat10# ./bin/startup.sh
Output:
Using CATALINA_BASE: /usr/local/tomcat10 Using CATALINA_HOME:
/usr/local/tomcat10 Using CATALINA_TMPDIR: /usr/local/tomcat10/temp> Using
JRE_HOME: /usr/lib/jvm/java-11-oracle Using CLASSPATH:
/usr/local/tomcat10/bin/bootstrap.jar:/usr/local/tomcat10/bin/tomcat->juli.jar
Using CATALINA_OPTS:
Tomcat started.
at this stage, I know tomcat is installed successfully and services are all up and running therefore there maybe is something wrong with the browser which may be causing a connectivity issue.
So I took the following steps:
Step No:1
I have click on three dots on the top right-hand side of the Chrome browser window (setting) then I click on more tools then click on clear browsing data.
From the Clear browsing, data window clicked the advance tab and select all times from the drop-down list
Tick all options except Password and other sign-in data and Autofill option
After your selection click the Clear data button
Open new browser window and type localhost:8080
Got unable to connect to the server message
Step NO:2
Now open the My account setting page and from here browse to My activity and clear all previously recorded activities log and turn off all active activity recording sliding switches
Web & App Activity
Location History
YouTube History
Ad personalisation
Open the web browser and typed localhost:8080 (Enter)
still got the same error message
Step NO:3
Go to add the Ad settings, I turned the Ad personalisation setting OFF in past because I didn't want Google to collect my browsing data In your case it might still be ON so I turned it back on for my browser.
now type localhost:8080 surprisingly tomcat10 index page open in my browser window To test if it was Ad setting which was stoping tomcat10 index page to load in browser window I turned Ad personalisation tab OFF again and type localhost:8080 and press Enter
Even the Ad personalisation tab is OFF but this time tomcat10 index page is loaded to the browser window again.
Therefore I am not 100% sure if it was Ad personalisation state which was not allowing the tomcat10 index page to load in the browser window or one of the other previous options which I turned off
To test further I have close all my browsers and then type localhost:8080 in a new browser window and the index page still loading successfully.
This solution is working for me hope it will help other readers too
Actually the apache-tomcat 7 server running at The Eclipse.but in browser getting error "The requested resource is not available." .Any reasons Please..?
When you start tomcat independently and type http://localhost:8080/, tomcat show its default page (tomcat has its default page at TOMCAT_ROOT_DIRECTORY\webapps\ROOT\index.jsp).
When you start tomcat from eclipse, eclipse doesn't have any default page for url http://localhost:8080/ so it show error message. This doesn't mean that tomcat7 is not running.when you put your project specific url like http://localhost:8080/PROJECT_NAME_YOU_HAVE_CREATE_USING_ECLIPSE will display the default page of your web project.
I had the same issue and for me, I tried changing the options in
Server Locations
and it worked.
Double click on the Tomcat Server under the Servers tab in Eclipse
Doing that opens a window in the editor with the top heading being Overview opens (there are 2 tabs-Overview and Modules).
In that change the options under Server Locations, and give Ctrl+S (Save configurations)
For me, Use Tomcat installation (takes control of Tomcat installation) worked
Try starting the server and checking if localhost opens in the browser. Else select a different option.
I do not understand why that issue came up. I did search but did not find a relevant answer(Maybe I didn't use the right keywords). If someone knows why that worked, kindly share.
Thanks.
There could be a number of reasons, have it as a checklist and go through it
Is your server running on 8080?I mean that is the default port but it could be configured to run on other.
Also there is a possibility that the default application is removed/uninstalled that is why it is giving "the requested resource is not available"
Also it could be a proxy issue. make sure you are not using any proxy in your browser.
1)Goto Server tab
2)Right on server -> general -> click on switch location.
3)Double click on the server -> under server location -> select tomcat installation.
4) restart the server.
It will be proxy configuration of your browser.
In NetWork Setting, use no proxy
For Manual proxy configuration add exception(No Proxy for in Firefox) like localhost:8080, localhost.
You may face two errors while testing tomcat server startup.
Error in the Eclipse inbuilt browser - This page can’t be displayed
Turn on TLS 1.0, TLS 1.1, and TLS 1.2 in Advanced settings and try connecting to https://localhost:8080 again. If this error persists, it is possible that this site uses an unsupported protocol. Please contact the site administrator.
404 error in the normal browsers.
Fixes -
For the eclipse browser error, check whether you are using secured URL - https://localhost:8080. This should be http://localhost:8080
For the 404 error:
Go to Tomcat server in the console. Do a right click, select properties. In the properties window, Click "Switch location" and then click OK.
Followed by that, Go to Tomcat server in the console, double click it, Under "server locations" select "Use Tomcat installation" radio button. Save it.
The reason for choosing this option is, When the default option is given as eclipse location, we will see 404 error as it changes Catalina parameters (sometimes). But if we change it to Tomcat location, it works fine.
Sometimes another software can be holding this door and it can be the cause of this conflict, try change the door on the server.xml.
Double click on the Tomcat Server under the Servers tab in Eclipse
Doing that opens a window in the editor with the top heading being Overview opens (there are 2 tabs-Overview and Modules).
In that change the options under Server Locations, and g
You can run below commands.
./catalina.sh run
Note: Make sure the port 8080 is open. If not, kill the process that is using 8080 port using sudo kill -9 $(sudo lsof -t -i:8080)
Many of us get this error after setting up the eclipse and server for first time. This solution is -
go to server tab
select the properties option of your respective server and expand it
in the properties window ,
select general tab -> click Switch Location -> click apply
->click ok.
This may work .
I want to increase the server time out in eclipse but not sure how server is configured in my eclipse, I was not able to find timeout settings anywhere. Check the screenshot of my project.
I have tried Windows > Show Views > Server but nothing happens... no windows is shown
I have tried Windows > Perefences > Server see the screenshot here I cannot find timeout settings
goto server view, double click on one of the server, expand time out option and set value to it
To see your server in server view of eclipse(if server view is not coming, simply right click on the perspective e.g. Java or J2EE and select reset. Hope that helps),
right click (in server server view pane) -> new -> server
You will see below screen:
Now select Apache Tomcat with right version, then select next, you will see screen below:
Browse the Tomcat server installation directory and finish. Now you will be able to see the Tomcat server in server view of the eclipse.
As a last step of your problem, double click on the Tomcat server listed in the server view of eclipse and change the timeout as in screen below:
Hope this helps!.
This is what you need to do:
Open the Servers view -> double click tomcat -> click on Timeouts section
Make changes according to your requirement.
refer: Change Tomcat Server's timeout in Eclipse
Open the Servers view -> double click tomcat -> drop down the Timeouts section
There you can increase the startup time for each particular server.
Open the Servers view -> double click tomcat -> Server and Click Open ..
you can increase the startup time in Timeouts tag
Specify the time limit to complete server operations.
starts (in sec) increase 600
I have a problem when starting TOmcat 6 server from eclipse, it pops up with the following message:
Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
It could be that it just takes too long to start-up. You can check that from your logs to see whether it was midway through when the default 45 secs cutt-off time occurred. If so, on the Servers view double-click on the tomcat instance you are deploying and in the Overview tab, click on the Timeouts section on the right column and give your tomcat a bit more time to startup.
My eclipse used to work fine but now I am no longer the administrator of my computer(I no longer have administrator priveledges) and i see that my already installed and working eclipse is now showing errors in my jsp files of the application which it didn't used to show before..
also I am not able to connect to tomcat server which seperately can be started normally but not inside eclipse.....
Is this something to do with my not being administrator anymore of is it something else....
would highly appreciate the help.....
I have now been able to run my tomcat server without admin previledge but problem of many files showing error still persists.........
the below written jsp code is showing error in all the files....:
<%
pageContext.getRequest().setCharacterEncoding("UTF-8");
String label = pageContext.getRequest().getParameter("rswitb1");
if(label==null)label="";
else label = label.replaceAll("<", "<").replaceAll(">", ">");
%>
I am not able to get what the problem ....
if anyone could help...
The connection to the external tomcat should be using only TCP/IP port 8080, there is no reason why a non-admin user should not be able to do that.
It's possible that your tomcat password has changed (or hasn't been set up at all)
There is a troubleshooting section at the eclipse wiki (if you are using WTP, that is)
First,check out the tomcat server is on: "netstat -an" to
find that whether the port8080 is used(if you didn't assign another server port.).
check out whether the server is on(netstat -an).
Maybe 8080 is used by tomcat.
You'd better reinstall tomcat as non administrator.