0
votes

INFO: Marking servlet MyServlet as unavailable Jun 02, 2015 12:04:05 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /MyProject threw load() exception java.lang.ClassNotFoundException: com.mycompany.myproject.servlet.MyServlet at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5407) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Jun 02, 2015 12:04:05 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-apr-8080"] Jun 02, 2015 12:04:05 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-apr-8009"] Jun 02, 2015 12:04:05 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 9837 ms

This is the console when I deploy my project in eclipse's server(tomcat).It does not create class files of .java files.But when I deployed my project's .war file in C:\apache-tomcat-7.0.41\webapps ,it runs fine. I have searched everywhere on the internet,tried changing eclipse's preference, but the problem still persists.

2
Don't have time to make a response but you need to go to your Project Properties then Deployment Assembly and make sure your sources and resources have the deploy path "WEB-INF/classes", your web content have the deploy path "/" and your libs have the deploy path "WEB-INF/lib".Nyamiou The Galeanthrope
src and WebContent was already set. Added deploy path for every jar,problem still existsbeing_ethereal
Do you use Maven to manage your project build ?Nyamiou The Galeanthrope

2 Answers

0
votes

It's clear in the error.

 java.lang.ClassNotFoundException: com.mycompany.myproject.servlet.MyServlet

Make sure that class file is present in WEB-INF/classes folder in that particular path. Sometimes it could be a result of simple typo-mistake in the web.xml file. Recheck it for any mistakes.

0
votes
  • Go to your eclipse internal webapps folder called wtpwebapps. Double click on your tomcat7 folder to display the overview. it should be under -> workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps

enter image description here

  • Double check that you have permisions in that folder and eclipse is compiling them under .metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\MyProject\WEB-INF\classes
  • On your package explorer go to your tomcat7 configuration and open your server.xml you should see something like:

If you don't check permisions or try to create the server configuration from the beggining.

<Context docBase="MyProject" path="/MyProject" reloadable="false" source="org.eclipse.jst.jee.server:MyProject"/></Host>