Unable to deploy my spring web project to overshadow the tomcat backend server. (Java.lang.ClassNotFoundException when starting tomcat)

when i use external tomcat everything is ok. but I need to deploy my project on the internal eclipse tomcat server in order to be able to use the DCEVM class hot swap. When I try to start the tomcat server from eclipse, it says that it cannot find one of my service classes that I mentioned in my spring security configuration file as a bean. I also tried adding the project to the tomcat class path, but this did not solve my problem.

UPDATE

I found out that the problem is that when I deploy my web project for an eclipse tomcat server, no .class is copied to:

C:\Users\Meysam\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\villapweb\WEB-INF\classes 

in fact, this folder contains my src / java / main structure, but .class is not copied in it.

the lib folder is good though (for example, all dependencies of maven and other copies of the material in the path that is supposed to be)

I think there might be something wrong with the m2e-wtp plugin. I do not know what!

I am using eclipse 4.3 BTW.

solvable

I solved this problem as follows:

  • right click on project in eclipse> properties> project face
  • in the right pane, select the runtime and select the target server. Apply and approx.
  • in the list of server modules, right-click on the project module and click on the working directory to work with the module
  • right click on the server itself and you can clear the working directory of the server and tomcat one by one.
  • If this does not work, try running the project> clean and also switch the "build automatically" option in the project menu.

Here it is. tomcat now copies all .class files to the target server, and you do not see a ClassNotFound exception when tomcat starts.

+7
eclipse classnotfoundexception tomcat startup
source share
4 answers

[Copied to response section]

I solved this problem as follows:

  • right click on project in eclipse> properties> project face
  • in the right pane, select the runtime and select the target server. Give expression and ok.
  • in the list of server modules
  • right-click on the project module and right-click the working directory of the clean module on the server itself and you can clear the tomcat working and server working directory after another
  • If this does not work, try to execute the project> clear, and also switch "build automatically" in the project

Here it is. tomcat now copies all .class files to the target server, and you do not see a ClassNotFound exception when tomcat starts.

+8
source share

I followed the steps in response, but it still wonโ€™t work for me, therefore, in addition to performing these steps once, I found that performing an update on the target after clean install โ€œRepublishโ€ status on the server automatically, so when the server is executed, all changes in the compiled classes (new classes and changes in existing ones) are then copied to wtpwebapp when the server starts.

+1
source share

I had the same problem in a Web Dynamic project converted to a Maven project.

I found an error in the properties -> Deployment Panel -> right panel. It was source=src folder and deploy path=WEB-INF/classes . Classes were not found by Eclipse.

Changed to source=target/classes .

0
source share

I had almost the same problem - one of my projects did not fall into the deployment area (its bank). What I did was 1) remove the application from tomcat 2) clean the tomcat work directory 3) the most important thing: the project is clean - that's it . Then I added the application again and ... the problem is resolved

0
source share

All Articles