27
votes

I'm using Eclipse Luna. I'm working on a Maven project. When I try to run my application on a weblogic's application server, and exception is thrown with the message:

weblogic.application.ModuleException: [HTTP:101027][WebAppModule(_auto_generated_ear_:MyAppName)] Document root: "D:\MGelbana\workspace\my-app-name\target\m2e-wtp\web-resources" does not exist.

I looked into the project's deployment assembly configuration and found the following error message: Cannot find entry: "/target/m2e-wtp/web-resources"

enter image description here

So I thought Luna's default Maven installation isn't what I need to I uninstalled it and I installed M2E-WTP from this URL (http://download.eclipse.org/m2e-wtp/releases/luna/) but I believe I ended up with the same version and same options.

I understand that this plugin has the option of generating this folder /target/m2e-wtp/web-resources which helps Eclipse to deploy an application into an application server (Run on server option)

(Which is my end goal but I'm having issues with deploying the application with it's needed dependencies. If I generate the application's WAR file by Installing the maven project and deploying the generated that WAR manually, the application works, but I need to be able to debug\run it on the application server using Eclipse.)

But this folder (i.e. /target/m2e-wtp/web-resources) isn't created !

In Eclipse's Maven > Java EE Integration > WAR project preferences > Maven archiver generated files under the build directory (I checked this option)

In the project-specific options, I only have a Maven menu and a Lifecycle mapping sub-menu and nothing to do with the maven archiver generating files or not !

So how can I direct maven to output the WTP related files ?

enter image description here

17

17 Answers

13
votes

I was struggling with the same issue for a couple of days. Ultimately the following steps worked for me.

  • Install m2e-wtp from eclipse marketplace (if it's not already installed)
  • Open Project Preferences -> Project Facets -> Runtimes -> Select the runtime of your choice (Tomcat 7 in my case)
12
votes

Just had this happen on Mars.

Fixed it by disabling the Dynamic Web Module facet and then re-enabling it.

8
votes

Got the same issue. I solved it removing the "/target/m2e-wtp/web-resources" under Deployment Assembly. Then Maven -> Update Project.

4
votes

Eclipse (Luna) will only generate the Maven Archiver files under the build path (in /target/m2e-wtp/web-resources) if it considers the project to be a "WAR Project".

From experience, this seems to be any project with the Dynamic Web Module facet. If the project is already a Faceted Form project, add the facet and build your project. If not, choose the [Configure -> Convert to Faceted Form...] menu option and go from there.

For projects imported as "Existing Maven Projects", Eclipse will usually set this for you. But if you've just checked the project out of version control or created / imported the project as a "standard" Java project, it may not have done.

3
votes

Disabling the Build Automatically option and building manually again worked for me.

2
votes

I had this issue using Weblogic. I went to (project)/target/m2e-wtp and manually created the web-resources folder.

1
votes

I had the same problem and I could solve it by adding <packaging>war</packaging> to my pom.xml file in project tag.

1
votes

Need to update maven project >right click on project >click Maven>Update project.

1
votes

Just spend a couple of hours trying every solution described in this lengthy thread... Nothing worked until I discovered something hidden in the preferences...

The solution was simple: Preferences -> Maven -> Java EE Integration -> Enable Java EE configuration

Why it was disabled in the first place will always be a mystery to me...

1
votes

goto Windows menu>preference>choose Maven>Java EE Integration>uncheck the WAR project Preferences()

0
votes

Hey I'm also facing a similar issue and I just addeed as discribed above by using this configuration bellow: Configure >> Add Projects Archives Support

0
votes

I had this issue and none of the other answers worked for me. I resolved it by right-clicking on the project in Package Explorer and choosing Build Project. This caused the missing m2e-wtp folder to appear.

0
votes

I am using linux mint and i found in ~.m2/repository ".lock" file 1- I removed it. 2- I run maven clean and it worked with me.

Note: This is my solution for many issues with maven, cause ".lock" prevent maven from doing work on disk. so i hope it help you in many other issues.

0
votes

Nothing wrong with the tomcat plugin or the application, it only needed a refresh once in a while. Also, because maven was cleaning up target. I just had to setup my maven build to also refresh the project including target folder.

Check the option to automatically refresh resources in your maven build

0
votes

1) I have fixed by deleting the lock folder from the ~.maven/repository ".lock" folder.
2) Open project preferences -> Project Facets -> Runtimes -> Select the runtime of your choice.
3) Need to update maven project >right click on project >click Maven>Update project.

Thats it, the problem is resolved for me.

0
votes

There are a couple of things to try..

  1. Like Tharaka suggested .. Install m2e-wtp from eclipse marketplace (if it's not already installed)

After this, try doing the following in sequence. One or more of these could help resolve your issue. I am using the latest Eclipse(4.18).

  1. Right click Project-> Properties -> DeploymentAssembly -> Remove /target/m2e-wtp/web-resources folder. Clean Project and run again.

  2. If no luck try this, Open project preferences -> Project Facets -> Runtimes -> Select the runtime of your choice. Ensure it's compatible with the JDK, JRE version you use. (I am using Tomcat 9 for JDK 11, JRE11)

  3. Still no luck, Right click Project -> Run As -> Maven Clean. Followed by Maven Install.

  4. Do steps 2,3,4 and clean the project and run on server again.

If this helps, do give an upvote! Thanks!

-1
votes

This due to a conflict between m2e-wtp & m2e plugin in eclipse . Uninstall the m2e plugin as it is already included as part of your m2e-wtp plugin. Restart and voila!