• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to deply Maven Webapplication in Tomcat Eclipse.

 
Ranch Hand
Posts: 157
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am new to Maven. I am trying to write my first Webapplicaiton using Maven and Spring... MyFirstMavenWebApp.

I used the eclipse and tomcat. Using eclipse i generated one Maven webapp using achtype web-app. after writing some java files.. i just ran Maven Clean,package and i got the classes, dependent jars and all the resources copied to target/MyFirstMavenWebApp folder and a war file also created.

But i could not see this project in my Tomcat add/remove tab.. so i just changed the Web application facets to Dynamic Web project.. now i am able to add the project to tomcat...

But unfortuanately tomcat is taking the src/main/webapps as base directlry and there i dont have any classes or jars copied.. so my deployment is failing....

When i copy the war file from target folder to WebApps directory of Tomcat outside the eclipse ... its working fine..

Can you help to solve this..

I need Tomcat in clipse to point to the target/MyFirstMavenWebApp instead of src/main/webapps..

 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no need to manually add facets. Install m2e-wtp plugin via Help > Install new software. You can then deploy maven web app projects to Tomcat without any problems.

PS: I'll move this post to the IDE and tools forum, since the problem is not related to Spring.
 
Bala Tilak
Ranch Hand
Posts: 157
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I already have m2e-wtp plugin .. do i need to specify that plug in in pom.xml ??
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bala Gangadhar wrote:I already have m2e-wtp plugin .. do i need to specify that plug in in pom.xml ??


m2e-wtp is an Eclipse plugin. It doesn't go into pom.xml. A pom.xml should be written in such a way that it has absolutely no dependencies on your IDE or any software installed only on your system. It should build from any system that has maven installed.

If you have Web Development Tools plugin installed (which it appears you do considering that you can add dynamic web facet and create Tomcat server runtimes) and m2e and m2e-wtp installed, you don't need anything else. I'm not sure why it's not working for you.
Can you describe the exact steps you are trying? For example, I don't see have tab called Tomcat. Where are you seeing it?
Can you create a new fresh maven web app project without manually adding any facet and see if it's working?
 
Bala Tilak
Ranch Hand
Posts: 157
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for your help Karthik.... I Got it...
Steps i followed..

1. I added below entry in pom.xml in plugins..
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>;
<server>TomcatServer</server>
<path>/MyContexName</path>
</configuration>
</plugin>

2. I followed the configuration as mentioned in below webpage for Tomcat7
http://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/
3. (If you got 403-Forbidden error ) Then you need to allow the eclipse to access tomcat's home page.. this can be achieved by double clicking the server in eclipse and changing the Server locations to actual tomcat installation folder and deploy path to webapps folder under actual tomcat installation folder (Refer : http://stackoverflow.com/questions/23182576/error-403-when-try-to-deploy-a-maven-project-with-tomcat-maven-plugin)
 
reply
    Bookmark Topic Watch Topic
  • New Topic