When running my WebApp project from Eclipse most of times it run correctly. But if by mistake to stop server, I kill it in "Console" view on instead of "Stop" Server from "Servers" View. While running clean project I get this
java.lang.NullPointerException at org.eclipse.wst.common.componentcore.internal.util.VirtualReferenceUtilities.getDefaultProjectArchiveName(VirtualReferenceUtilities.java:81) at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getJavaClasspathReferences(J2EEModuleVirtualComponent.java:332) at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getNonManifestRefs(J2EEModuleVirtualComponent.java:236) at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:160) at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:208) at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:201) at org.eclipse.jst.common.internal.modulecore.SingleRootUtil.hasConsumableReferences(SingleRootUtil.java:217) at org.eclipse.jst.common.internal.modulecore.SingleRootUtil.validateSingleRoot(SingleRootUtil.java:165) at org.eclipse.jst.common.internal.modulecore.SingleRootUtil.isSingleRoot(SingleRootUtil.java:93) at org.eclipse.jst.common.internal.modulecore.SingleRootExportParticipant.canOptimize(SingleRootExportParticipant.java:84) at org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.canOptimize(FlatVirtualComponent.java:136) at org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.cacheResources(FlatVirtualComponent.java:118) at org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.fetchResources(FlatVirtualComponent.java:101) at org.eclipse.wst.web.internal.deployables.FlatComponentDeployable.members(FlatComponentDeployable.java:147) at org.eclipse.wst.server.core.internal.ModulePublishInfo.hasDelta(ModulePublishInfo.java:418) at org.eclipse.wst.server.core.internal.ServerPublishInfo.hasDelta(ServerPublishInfo.java:443) at org.eclipse.wst.server.core.internal.Server.hasPublishedResourceDelta(Server.java:1539) at org.eclipse.wst.server.core.internal.Server$ResourceChangeJob$1.visit(Server.java:214) at org.eclipse.wst.server.core.internal.Server.visitModule(Server.java:2929) at org.eclipse.wst.server.core.internal.Server.visit(Server.java:2913) at org.eclipse.wst.server.core.internal.Server$ResourceChangeJob.run(Server.java:225) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
And while launching I get this
SEVERE: Error starting static Resources java.lang.IllegalArgumentException: Document base D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Webapp does not exist or is not a readable directory at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4319) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
Please help recover from this.
I had a hard time to make it work, but thanks to "Alexander Pogrebnyak" (see deploying a war file in WTP(Eclipse) tomcat server) I was able to make Eclipse Web Projects work with Maven through m2e:
Before starting, I must say that I'm a very suspicious man, so I always start by cleaning all my projects using "Eclipse > Project > Clean..." menu (without "start a build immediately" option checked). I also do not have "Eclipse > Project > Build Automatically" option checked.
By the way, I suppose that you will have your m2e plugin installed already, or what I'm going to state has no meaning...
Well, let's start:
First, bye bye Server configuration:
1) If your have any project in a previous server configuration, remove it (right click on the server and select "Add and remove" option)
2) Clean your server work directory (right click on the server and select "Tomcat Server Work Directory")
3) Clean the compiled "leftovers" (right click on the server and select "Clean")
4) Remove your server configuration from the "Servers" tab
5) Completely delete your "Servers" project/folder (shown in your "Project Explorer" tab)
6) BONUS: I also remove my server runtime environment ("Eclipse > Window > Preferences > Server > Runtime Environments")
Second, "Maven clean" (if your web project has a "Maven nature"):
1) Right click your web project
2) "Pop up Menu > Run As > Maven clean"
This should wipe out your target folder
Third, Instal m2e WTP integration (yeah! It does not come as "default". One whole day to figure it out):
1) Open Maven "Discovery" option (Eclipse > Windows > Preferences > Maven > Discovery)
2) Press "Open Catalog" Button (a "m2e Marketplace" window should appear)
3) Scroll down until you find the "WTP Integration" option, then "check" it!
4) Press "Finish"
5) A "plugin screen like" will appear. "Next", "Next", "Agree", blah, blah, blah...
Fourth, leave Eclipse than run it again:
1) If not asked to restar Eclipse (that I find hard to believe you won't), restart it yourself!
Fifth, maven reintegration:
1) Add Maven nature to the project (Right click your web project, "Pop up Menu > Configure > Convert to Maven Project")
2) Update your maven configuration (Yeah, yeah, suspicious, I know). Right click your web project again, now with a "M" on its icon ("Pop up Menu > Maven > Update Project")
3) Run a maven install (Right click your web project, "Pop up Menu > Run As > Maven install")
4) Build your project ("Eclipse > Project > Build All")
Sixth, put it all to work:
1) Deploy and run your web application (Right click your web project, "Pop up Menu > Run As > Run on Server")
2) You will be asked to create another server configuration. It will create the "Servers" project/folder again, but that's the way it is.
That's it!!! I gotta admit, once I ran the server, it didn't work, but this time (i dunnot know why) "Log4J" libraries could not be found. After one "project clean" + "maven clean" and one "maven install" + "project build" another message stating that my Servlet class could not be found. Once again, I executed a "project clean" + "maven clean" and a "maven install" + "project build" and "voila"!!! It worked (And that's why I'm so suspicious).
I was starting to get worried with this new Juno + m2e double... Never had this kind of problem with Indigo or Ganymede... But I guess I can trust Eclipse again (can I?)
Dont do those crazy cosmic workarounds !!
This works fine:
Add to your ".project" file (hidden) these lines:
<natures> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.jsdt.core.jsNature</nature> </natures>
Enjoy !
Why? if you check that unexisting directory, well, that "../.metadata/blah/blah/tmp0/wtpwebapps/YOURPROJECT/"
is EMPTY: then your build aint creating the WAR... !!! Because maven plugin isnt understanding HE HAVE TO !
I found this after comparing two .project files from both different deploying/non-deploying projects...
Hope helped !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With