1
votes

I have issue most probably with either Eclipse or Tomcat. Because if I make package proj.war from console and then deploy to local Tomcat instance. It works fine. But when I try to run to server from Eclipse I got error as :-

Nov 15, 2015 8:00:30 AM org.apache.catalina.core.StandardContext listenerStart

SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333

I got 2 questions. How to fix this deployment? I'm ok with manual console build and deployment. But if I manually deploy my package to Tomcat, how can I debug? I have both eclipse and intellij. How can I debug after manual build and deployment?

Please also check the picture to verify my project structure is ok in Eclipse?

problem screenshot

2

2 Answers

1
votes

I had a similar problem when running a spring web application in an Eclipse managed tomcat. I solved this problem by adding maven dependencies in the project's web deployment assembly.

  1. Open the project's properties (e.g., right-click on the project's name in the project explorer and select "Properties").
  2. Select "Deployment Assembly".
  3. Click the "Add..." button on the right margin.
  4. Select "Java Build Path Entries" from the menu of Directive Type and click "Next".
  5. Select "Maven Dependencies" from the Java Build Path Entries menu and click "Finish".

You should see "Maven Dependencies" added to the Web Deployment Assembly definition.

maybe you have missed some jars.

0
votes

I think you should do the manual deployment to avoid these problems. IntelliJ provides Run configurations for maven project. You can deploy the application just by one click. To debug application host on Tomcat from IntelliJ. You do the following steps: 1. create file TOMCAT_HOME/bin/setenv.sh. The content of this file should be:

export JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=1043,server=y,suspend=n"
  1. On IntelliJ, choose Run > Edit Configurations. Click the "+" icon to add a new "Remote" configuration. Leave everything as default but the port. Change it to 1043.

Now when tomcat started, you can debug the application by choose Run > Debug... Then choose the configuration you just created in step 2.