Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325671

Summary: WtpDirContext throws NullPointerException when reloading a Maven project
Product: [WebTools] WTP ServerTools Reporter: Mariano Eloy Fernández Osca <mariano.fernandez>
Component: jst.serverAssignee: jst.server <jst.server-inbox>
Status: CLOSED DUPLICATE QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
A complete Eclipse project configured to reproduce the error. none

Description Mariano Eloy Fernández Osca CLA 2010-09-18 04:33:58 EDT
Build Identifier: 20100617-1415

I'm trying to set up Maven + WTP to hot deploy changes onto a Tomcat 6.0 server. I'm using Tomcat's "Serve modules without publishing" options to speed up things.
To accomplish this I needed to twist a little bit MVN and JDT config to put compiled classes directly to WEB-INF/classes so 
These are the main configuration files I'm working around.

org.eclipse.wst.common.component
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="mvnweb">
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<property name="context-root" value="mvnweb"/>
<property name="java-output-path" value="/src/main/webapp/WEB-INF/classes"/>
</wb-module>
</project-modules>

pom.xml
  	<outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory>

Default output folder in Java Build Path is set to /src/main/webapp/WEB-INF/classes.

Everything looks fine, server starts up, but when changing a single line on a servlet a NullPointerException is thrown by org.eclipse.jst.server.tomcat.loader.WtpDirContext.file(WtpDirContext.java:209)


Reproducible: Always

Steps to Reproduce:
1. Set up a project as described above
2. Start up Tomcat
3. Change a single line on a Servlet and save it
4. Watch for that error stacktrace on the server's console
Comment 1 Mariano Eloy Fernández Osca CLA 2010-09-18 04:35:57 EDT
Created attachment 179165 [details]
A complete Eclipse project configured to reproduce the error.
Comment 2 Mariano Eloy Fernández Osca CLA 2010-09-18 04:36:51 EDT
Extra things to run the project:

- m2eclipse plugin
- Apache Tomcat 6.0
Comment 3 Mariano Eloy Fernández Osca CLA 2010-09-18 04:40:26 EDT
The final goal is to set up a web project in Eclipse combined with Maven and make it work in such a way that changes made to classes are visible as quickly as possible.
That's why I'm trying to skip publishing web resources, thus pointing WTP directly to src/main/webapp, and also changing Java sources default output directory (/target/classes) to WEB-INF/classes.
Comment 4 Mariano Eloy Fernández Osca CLA 2010-09-18 07:38:43 EDT
Searching for "WtpDircontext" in Google pointed me to Bug 318492.

*** This bug has been marked as a duplicate of bug 318492 ***