This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Unable to deply Maven Webapplication in Tomcat Eclipse.

 
Ranch Hand
Posts: 136
2
  • Mark post as helpful
  • send pies
  • 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
  • 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: 136
2
  • Mark post as helpful
  • send pies
  • 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
  • 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: 136
2
  • Mark post as helpful
  • send pies
  • 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)
 
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!