Could not find or load main class org.apache.catalina.startup.Bootstrap

China☆狼群 提交于 2020-01-02 00:19:12

问题


When I run apache tomcat7.0.56 in Eclipse, I get an error

Error: Could not find or load main class org.apache.catalina.startup.Bootstrap

How can I fix the problem?


回答1:


First of all you should try to run TOMCAT using it's own .bat and not Eclipse. If it doesn't run problems would be on your tomcat installation and not in Eclipse and you could take a look to the files of TOMCAT_HOME/logs/ where Tomcat's errors are traced (they are so helpful).

Anyway, if it runs properly out of eclipse, try to delete the eclipse's tomcat configuration and set it from the beginning following these simple steps

  • Go to Eclipse's Window > Preferences > Server > Runtime Environment and add a Tomcat Server browsing your TOMCAT_HOME and selecting the suitable JRE (use JAVA_HOME that contains jre yet) paying attention to messages requiring a certain JDK depending on the TOMCAT version (TOMCAT_8 requires at least JDK_1.7 version and, if not set, usually shows errors explaining it when starting)
  • Go to Eclipse's Window > Show View > Other... > Server > Servers and add a new server; in this case the version of TOMCAT you set before. You don't need to add further configuration to make TOMCAT to start.
  • At this point if would be helpful if you hadn't any app at TOMCAT_HOME's webapps folder but those that came default (you must empty TOMCAT_HOME/work folder to remove cached stuff). Once you have ensured it, start from ECLIPSE and cross fingers. In case of fail, take a look to Eclipse's console and look for the exception to copy at this post



回答2:


After installing tomcat, start eclipse and configure and/or verify tomcat is correctly set up in eclipse: Go to "Servers" ("Window", "Show View", "Servers"), right-click on "Servers", and add the path to (e.g.) Tomcat7.0.56.... For reference, see this tutorial.

If you've configured eclipse to run tomcat as a normal java application (i.e,. specifying the main class), then see these steps; but this approach may be an unnecessarily complicated for your use case.




回答3:


I was having the same problem, Windows 10 64 bit, Eclipse Neon.2 4.6.2.

Newly extracted tomcat zip, 8.5.11. Had done the stuff that michael_n said (multiple times with different versions of tomcat).

What fixed it for me was in the dzone article the part about setting the Run Directory in the Run Configuration under Arguments. I set it to the top tomcat directory (the one with bin, lib, etc. in it) That's the only thing I did and then it starts and I can go to the main tomcat page.

But it's not running my app; it's not listed in the manager.




回答4:


Que 1. Is your tomcat started interdependently(outside eclipse)??

Ans. if ans is no - then - I think you have downloaded tomcat source instead binary... you should download binary and install tomcat then it will run.

1.download binary (https://tomcat.apache.org/) 2.unzip it

3.copy unzipped apache folder

4.place this to your program files

  1. set JAVA_HOME to C:\Program Files\Java\jdk_Your_version_num

  2. Run C:\Program Files\apache-tomcat-Your_version_num\bin\startup.bat .... hope your tomcat will start

1.download binary Link -. https://tomcat.apache.org/

1.1. choose version of your choice and click "download"

1.2. On next page under heading "Binary Distributions"- download zip and proceed to next steps. All the best.




回答5:


If tomcat is working perfectly fine independently,

  • then change the permissions of the directory and subdirectories of tomcat

Eclipse is not able to read a certain file from the directory which is the reason for the error. Nothing worked for me, but changing the permission helped me.



来源:https://stackoverflow.com/questions/31029810/could-not-find-or-load-main-class-org-apache-catalina-startup-bootstrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!