This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven Build failure with NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven Build failure with NullPointerException" Watch "Maven Build failure with NullPointerException" New topic
Author

Maven Build failure with NullPointerException

Saritha Penumudi
Ranch Hand

Joined: Aug 18, 2003
Posts: 147
I am trying to setup Maven with RAD7.
I have created Maven project for simple web application. (struts2+jsp).
I have added dependency for struts2-core in pom.xml.
But when I run pom.xml I am getting following exception. I don't see rootcause for this exception which is making more harder for me to trouble shoot.
Have any of you encountered same exception?

Versions that I am using:
Maven:apache-maven-2.0.9
Struts2

Exception in thread "main" java.lang.NullPointerException
at sun.reflect.AccessorGenerator.getClassName(AccessorGenerator.java:387)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:304)
at sun.reflect.MethodAccessorGenerator.generateSerializationConstructor(MethodAccessorGenerator.java:113)
at sun.reflect.ReflectionFactory.newConstructorForSerialization(ReflectionFactory.java:341)
at com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.getMungedConstructor(Sun14ReflectionProvider.java:81)
at com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.newInstance(Sun14ReflectionProvider.java:61)
at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:543)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:375)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:301)
at org.apache.maven.plugin.war.util.WebappStructureSerializer.<init>(WebappStructureSerializer.java:25)
at org.apache.maven.plugin.war.AbstractWarMojo.<init>(AbstractWarMojo.java:237)
at org.apache.maven.plugin.war.WarMojo.<init>(WarMojo.java:44)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1263)
at org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:69)
at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:203)
at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:125)
at org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:45)
at org.codehaus.plexus.DefaultComponentLookupManager.lookup(DefaultComponentLookupManager.java:147)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:491)
at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:779)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:564)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)

pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.SimpleApp</groupId>
<artifactId>SimpleApp</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>ADCApp Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.0.11</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>SimpleApp</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

Any help will be greatly appreciated.

Thanks
Saritha Penumudi
Ranch Hand

Joined: Aug 18, 2003
Posts: 147
I found the solution.. Following plugin details were missing from my pom.xml. adding below section has fixed this

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
</plugin>
 
jQuery in Action, 2nd edition
 
subject: Maven Build failure with NullPointerException
 
Similar Threads
how do i send a email test report from maven
Error in Maven while doing clean install
IOException using Maven plugin axis2-java2wsdl
Maven Error - Package does not exist, Symbols not recognised
Maven 2 EJB 3.0