2

I integrated Tomcat 8.5 with Eclipse and yet when I start the server and go to http://localhost:8080 or http://localhost:8080/psite (the configured Eclipse project with index.html) I get the 404 error each time.

  1. I tried to "Switch location" - didn't work.
  2. The "Server Configuration" part in the server Overview screen is missing on my Eclipse (Neon).
  3. Under Window->Preferences->Runtime Environments: I used "Search" to find the Tomcat installation directory. If I use "Add" the "Next" button is perma-greyed-out and I can't configure the path.
  4. No logs are created in the logs folder.
  5. Installed tomcat with installer, configured JRE path there. Same behavior happen when I used the tomcat core extracted zip and not installer.
  6. Update - If i start Tomcat from cmd i can get to localhost:8080 just fine (thanks Sasikumar) - but what's wrong with my Eclipse? do i need to reinstall it?

-

Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/8.5.11
Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Jan 10 2017 21:02:52 UTC
Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         8.5.11.0
Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Program Files\Java\jdk1.8.0_121\jre
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_121-b13
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         C:\Program Files\Apache Software Foundation\Tomcat 8.5
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.5
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 8.5\endorsed
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Feb 16, 2017 3:41:31 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_121\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_121/bin/server;C:/Program Files/Java/jre1.8.0_121/bin;C:/Program Files/Java/jre1.8.0_121/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;;C:\Users\Nadav\eclipse\java-neon\eclipse;;.
Feb 16, 2017 3:41:31 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Feb 16, 2017 3:41:32 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Feb 16, 2017 3:41:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Feb 16, 2017 3:41:32 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Feb 16, 2017 3:41:32 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1436 ms
Feb 16, 2017 3:41:32 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Feb 16, 2017 3:41:32 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.11
Feb 16, 2017 3:41:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [http-nio-8080]
Feb 16, 2017 3:41:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [ajp-nio-8009]
Feb 16, 2017 3:41:32 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 246 ms

Eclipse Tomcat Overview

Log from Workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\logs"

127.0.0.1 - - [16/Feb/2017:15:37:39 +0200] "GET / HTTP/1.1" 404 988
0:0:0:0:0:0:0:1 - - [16/Feb/2017:15:37:43 +0200] "GET / HTTP/1.1" 404 988
127.0.0.1 - - [16/Feb/2017:15:40:57 +0200] "GET / HTTP/1.1" 404 988
0:0:0:0:0:0:0:1 - - [16/Feb/2017:15:40:59 +0200] "GET / HTTP/1.1" 404 988
127.0.0.1 - - [16/Feb/2017:15:41:32 +0200] "GET / HTTP/1.1" 404 988
0:0:0:0:0:0:0:1 - - [16/Feb/2017:15:41:34 +0200] "GET / HTTP/1.1" 404 988
127.0.0.1 - - [16/Feb/2017:16:06:00 +0200] "GET / HTTP/1.1" 404 988
0:0:0:0:0:0:0:1 - - [16/Feb/2017:16:06:06 +0200] "GET /manager HTTP/1.1" 404 1002

enter image description here

Ned
  • 355
  • 2
  • 9
  • 24
  • got to http://localhost:8080/manager use admin as username password that is default or check the config file for other options and see what is the path for the jar deployed or check if it is even deployed. You can also check the log file if there were any errors when the jar was deployed. – StackFlowed Feb 16 '17 at 14:05
  • Thanks, localhost:8080/manager gets 404 also. No logs were created in the logs folder. I used the Tomcat installation "wizard" to configure the correct JRE path, it should be ok. – Ned Feb 16 '17 at 14:07
  • Try this one: http://stackoverflow.com/questions/6665245/deploy-webapp-from-eclipse-to-tomcat-root-context In particular, double-click the server, go to "modules" (a tab on the bottom of the screen) and check if your app is really mapped on /psite – Igor Deruga Feb 16 '17 at 14:11
  • Also, you can go to C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\log and check the log files, they are sometimes more verbose than the console output. – Igor Deruga Feb 16 '17 at 14:12
  • Added the log and overview of server in Eclipse (no modules tab). I think i might need to reinstall Eclipse. – Ned Feb 16 '17 at 14:21
  • deploy your ear in tomcat and run tomcat8.5 separately using cmd. check whether you are able to get home or not? – Sasikumar Murugesan Feb 16 '17 at 14:27
  • Activating from cmd and i can get to localhost:8080 just fine! any idea how i fix my eclipse integration? – Ned Feb 16 '17 at 14:36
  • If you don't have modules tab, maybe your modules are not deployed? Can you also insert a screenshot of your "Servers" view? – Igor Deruga Feb 16 '17 at 14:44
  • P.S.: when you start it from CMD you are not using the same CATALINA_HOME. Your application is not deployed in this case. – Igor Deruga Feb 16 '17 at 14:45

2 Answers2

1

When you start your tomcat from eclipse, it changes CATALINA_BASE:

-Dcatalina.base=C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0

This way, you'll never have manager application running in eclipse: it is completely empty. You have an empty ROOT application deployed by default. Now, I suspect that you haven't added your app to the Server in the Servers view (right click on your tomat and choose "Add or Remove"). The console output should mention that psite was deployed in this case. You can also go to the catalina base folder and check the wtpwebapps folder for your app.

Igor Deruga
  • 1,504
  • 1
  • 10
  • 18
  • That's my bad, in an act of fury i deleted the project and server. The results i uploaded here were from Eclipse without a site configured. I added it again now, adding the request images also. Same results. Looking for catalina base foldier now. – Ned Feb 16 '17 at 15:02
  • What is the contents of this folder: C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps ? – Igor Deruga Feb 16 '17 at 15:10
  • psite and ROOT. ROOT -> WEB-INF -> web.xml psite -> META-INF/WEB-INF ... i can list the contents if it's important. – Ned Feb 16 '17 at 15:13
  • No, I just wanted to make sure that it is there... So, my answer is not valid now, because your app is well deployed. I think that there's something wrong with the app configuration... You can check context.xml in your server (ctrl+shift+r or find it in the project explorer). Also, just try loading http://localhost:8080/psite/index.html – Igor Deruga Feb 16 '17 at 15:22
  • You can also re-check modules (after double-clicking), since you had none when the application was not deployed. – Igor Deruga Feb 16 '17 at 15:29
  • full path (index.html) return 404 still, modules are still missing, nothing in context or server XMLs about psite though. – Ned Feb 16 '17 at 15:44
  • I found a solution through this post: https://github.com/OneBusAway/onebusaway/wiki/Setting-Up-a-Tomcat-Server-in-Eclipse after adding the server, double-click the name in the servers window. then change the "server locations" selection to "Use tomcat Installation". that way it will use the proper CATALINA_BASE. – Derek Wade Dec 11 '18 at 23:03
0

Try this.

Make sure you've added the project psite to the tomcat8.5 using server view>add or Run As->Run on Server

Now got package explorer (or) project explorer find Server folder.

Expand it then find server.xml inside the folder of tomcat8.5.

Now open the sever.xml and at the end of the file make sure you've this configuration.

<Context docBase="psite" path="/psite" reloadable="true" source="org.eclipse.jst.j2ee.server:psite"/>

If not stop the server modify it and start the server and then try.

Ravi MCA
  • 2,491
  • 4
  • 20
  • 30