开发者

Not able to start Tomcat for MAven Project inside Eclipse

开发者 https://www.devze.com 2023-03-27 23:00 出处:网络
Not able to start Tomcat for maven project in Eclipse I am getting: java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher

Not able to start Tomcat for maven project in Eclipse I am getting:

java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher

while starting tomcat.

the same is working outsi开发者_运维百科de eclipse(making the war and deploying in Tomcat)

Can any one suggest what to do?


My answer will be slightly off-topic but If I dare, I really recommend using jetty and using hot deployment in a separate process, not to launch it from within maven, but as a real server in /etc/init.d. Then you could deploy your app easily with an external script, activable from within eclipse, that will do a hot deploy of context in jetty.

It takes time to get this config but it's the fastest I have found and uses much less memory than using jetty within eclipse, and much much less than using tomcat. Hot deploy is also quite interesting in jetty.

You build cycle will look like

  • edit / save from eclipse
  • build / package through maven from eclipse (eclipse indigo is a charm for that)
  • deploy your app in jetty through a external tool script from eclipse.

Regards, Stéphane


It has to do with tomcat looking for those classes in src/main/webapp/WEB-INF/lib, You can add the dependency plugin to your pom.xml like this.

   <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.3</version>
        <executions>
            <execution>
                <phase>install</phase>
                <goals>
                    <goal>copy-dependencies</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <outputDirectory>src/main/webapp/WEB-INF/lib</outputDirectory>
        </configuration>
    </plugin>

This plugin will copy all the pom dependencies to WEB-INF/lib and tomcat can find all the jars when you it out of workspace

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号