Showing posts with label WST. Show all posts
Showing posts with label WST. Show all posts

Friday, March 26, 2010

Eclipse J2EE & IAM - NullPointerException

An internal error occurred during: "Updating classpath container: ...".
java.lang.NullPointerException
    at org.eclipse.wst.common.componentcore.internal.resources.
        VirtualResource.removeLink(VirtualResource.java:300)
    at org.eclipse.iam.wtp.core.internal.war.MavenWarClasspathListener.
        addOverlayWarFolders(MavenWarClasspathListener.java:89)
    at org.eclipse.iam.wtp.core.internal.war.MavenWarClasspathListener.
        resolved(MavenWarClasspathListener.java:57)
You've seen this error in Eclipse? This error occurs on the Eclipse J2EE in conjunction with Eclipse IAM. If you are writing a web application using maven as the build system - your welcome.
On the Internet I found a temporary solution - every time I load the eclipse and it compiles all projects, I should in web applications delete the folder .settings. However, it is not easy and may not be long-term solution.
After a long search for a solution was found.
In the file .project is necessary to add in a tag natures:
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
Furthermore, in the folder .settings need to create or modify file org.eclipse.wst.common.component. It should contain:
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="your-webapp">
         <module-type module-type-id="jst.web">
             <version>2.4</version>
             <property name="context-root" value="your-webapp"/>
             <property name="java-output-path" value="/target/classes/"/>
         </module-type>
         <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/classes"/>
     </wb-module>
</project-modules>
"your-webapp" should be replaced by the name of your project.

I advise you add this file to the version control system.