Yeah, there’s that =) Chun, it looks like you’re trying to give Maven the path to your topology class file, with ‘.’ as a delimiter. The argument storm.topology is actually an alias for exec.mainClass. You need that argument’s value to be the fully-qualified name of your topology class. Note that this does not include the artifact name, which is fyp-storm-try.
Maybe check out the exec maven plugin documentation if you’re still stuck: http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html Best Jake > On Apr 7, 2015, at 6:12 AM, Grant Overby (groverby) <[email protected]> > wrote: > > I don’t believe hyphens are legal in package names. > > > > “Also, unless you have a very good reason for doing so, or you don’t care > about nuking your computer, I strongly suggest you stop executing a > development project with sudo privileges." > +1 > > > Grant Overby > Software Engineer > Cisco.com <http://www.cisco.com/> > [email protected] <mailto:[email protected]> > Mobile: 865 724 4910 > > > Think before you print. > This email may contain confidential and privileged material for the sole use > of the intended recipient. Any review, use, distribution or disclosure by > others is strictly prohibited. If you are not the intended recipient (or > authorized to receive for the recipient), please contact the sender by reply > email and delete all copies of this message. > > Please click here > <http://www.cisco.com/web/about/doing_business/legal/cri/index.html> for > Company Registration Information. > > > > > > From: "Jake K. Dodd" <[email protected] <mailto:[email protected]>> > Reply-To: "[email protected] <mailto:[email protected]>" > <[email protected] <mailto:[email protected]>> > Date: Monday, April 6, 2015 at 10:43 PM > To: "[email protected] <mailto:[email protected]>" > <[email protected] <mailto:[email protected]>> > Subject: Re: Failed to execute goal > org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project : An > exception occurred while executing the Java class > > You're getting a java.lang.ClassNotFound exception because Java can't find > the class fyp-storm-try.src.jvm.Topology. > > Can you verify that the class exists in your project? Have you compiled the > project? What happens when you run 'mvn clean compile exec:java -D > storm.topology=fyp-storm-try.src.jvm.Topology'? > > Also, unless you have a very good reason for doing so, or you don't care > about nuking your computer, I strongly suggest you stop executing a > development project with sudo privileges. > > Best > > Jake K Dodd > > On Apr 6, 2015, at 18:59, Chun Yuen Lim <[email protected] > <mailto:[email protected]>> wrote: > >> Good day, I'm a newbies here. >> When I run sudo mvn exec:java -D >> storm.topology=fyp-storm-try.src.jvm.Topology at >> ~/storm/examples/fyp-storm-try/ directory, I faced an error regarding an >> exception occurred while executing the Java class, how to solve the problem? >> >> ubuntu@ip-10-0-0-101:~/storm/examples/fyp-storm-try$ sudo mvn -e >> exec:javasudo mvn exec:java -D storm >> .topology=fyp-storm-try.src.jvm.Topology >> [INFO] Scanning for projects... >> [WARNING] >> [WARNING] Some problems were encountered while building the effective model >> for org.apache.storm:fyp-storm-try:jar:0.9.4 >> [WARNING] 'reporting.plugins.plugin.version' for >> org.apache.maven.plugins:maven-javadoc-plugin is missing. @ >> org.apache.storm:storm:0.9.4, >> /root/.m2/repository/org/apache/storm/storm/0.9.4/storm-0.9.4.pom, line 694, >> column 21 >> [WARNING] 'reporting.plugins.plugin.version' for >> org.apache.maven.plugins:maven-surefire-report-plugin is missing. @ >> org.apache.storm:storm:0.9.4, >> /root/.m2/repository/org/apache/storm/storm/0.9.4/storm-0.9.4.pom, line 660, >> column 21 >> [WARNING] >> [WARNING] It is highly recommended to fix these problems because they >> threaten the stability of your build. >> [WARNING] >> [WARNING] For this reason, future Maven versions might no longer support >> building such malformed projects. >> [WARNING] >> [INFO] >> >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] Building fyp-storm-try 0.9.4 >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] >> [INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ fyp-storm-try >>> >> [INFO] >> [INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ fyp-storm-try <<< >> [INFO] >> [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ fyp-storm-try --- >> [WARNING] >> java.lang.ClassNotFoundException: fyp-storm-try.src.jvm.Topology >> at java.net.URLClassLoader$1.run(URLClassLoader.java:366) >> at java.net.URLClassLoader$1.run(URLClassLoader.java:355) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.net.URLClassLoader.findClass(URLClassLoader.java:354) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:425) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:358) >> at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285) >> at java.lang.Thread.run(Thread.java:745) >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] BUILD FAILURE >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] Total time: 3.524s >> [INFO] Finished at: Mon Apr 06 03:43:18 UTC 2015 >> [INFO] Final Memory: 9M/22M >> [INFO] >> ------------------------------------------------------------------------ >> [ERROR] Failed to execute goal >> org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project >> fyp-storm-try: An exception occured while executing the Java class. >> fyp-storm-try.src.jvm.Topology -> [Help 1] >> [ERROR] >> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e >> switch. >> [ERROR] Re-run Maven using the -X switch to enable full debug logging. >> [ERROR] >> [ERROR] For more information about the errors and possible solutions, please >> read the following articles: >> [ERROR] [Help >> 1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException >> <http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException> >> >> >> My pom.xml as below: >> ?xml version="1.0" encoding="UTF-8"?> >> >> <project xmlns="http://maven.apache.org/POM/4.0.0 >> <http://maven.apache.org/POM/4.0.0>" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance >> <http://www.w3.org/2001/XMLSchema-instance>" >> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >> <http://maven.apache.org/POM/4.0.0>http://maven.apache.org/xsd/maven-4.0.0.xsd >> <http://maven.apache.org/xsd/maven-4.0.0.xsd>"> >> <modelVersion>4.0.0</modelVersion> >> <parent> >> <artifactId>storm</artifactId> >> <groupId>org.apache.storm</groupId> >> <version>0.9.4</version> >> <relativePath>../../pom.xml</relativePath> >> </parent> >> >> <groupId>org.apache.storm</groupId> >> <artifactId>fyp-storm-try</artifactId> >> <packaging>jar</packaging> >> >> <name>fyp-storm-try</name> >> >> >> <dependencies> >> <dependency> >> <groupId>junit</groupId> >> <artifactId>junit</artifactId> >> <scope>test</scope> >> </dependency> >> <dependency> >> <groupId>org.testng</groupId> >> <artifactId>testng</artifactId> >> <version>6.8.5</version> >> <scope>test</scope> >> </dependency> >> <dependency> >> <groupId>org.mockito</groupId> >> <artifactId>mockito-all</artifactId> >> <scope>test</scope> >> </dependency> >> <dependency> >> <groupId>org.easytesting</groupId> >> <artifactId>fest-assert-core</artifactId> >> <version>2.0M8</version> >> <scope>test</scope> >> </dependency> >> <dependency> >> <groupId>org.jmock</groupId> >> <artifactId>jmock</artifactId> >> <version>2.6.0</version> >> <scope>test</scope> >> </dependency> >> <dependency> >> <groupId>org.twitter4j</groupId> >> <artifactId>twitter4j-stream</artifactId> >> <version>3.0.3</version> >> </dependency> >> <dependency> >> <groupId>org.apache.storm</groupId> >> <artifactId>storm-core</artifactId> >> <version>${project.version}</version> >> <!-- keep storm out of the jar-with-dependencies --> >> <scope>provided</scope> >> </dependency> >> <dependency> >> <groupId>commons-collections</groupId> >> <artifactId>commons-collections</artifactId> >> <version>3.2.1</version> >> </dependency> >> <dependency> >> <groupId>com.google.guava</groupId> >> <artifactId>guava</artifactId> >> </dependency> >> </dependencies> >> >> <build> >> <sourceDirectory>src/jvm</sourceDirectory> >> <testSourceDirectory>test/jvm</testSourceDirectory> >> <resources> >> <resource> >> <directory>${basedir}/multilang</directory> >> </resource> >> </resources> >> >> <plugins> >> <!-- >> Bind the maven-assembly-plugin to the package phase >> this will create a jar file without the storm dependencies >> suitable for deployment to a cluster. >> --> >> <plugin> >> <artifactId>maven-assembly-plugin</artifactId> >> <configuration> >> <descriptorRefs> >> <descriptorRef>jar-with-dependencies</descriptorRef> >> </descriptorRefs> >> <archive> >> <manifest> >> <mainClass /> >> </manifest> >> </archive> >> </configuration> >> <executions> >> <execution> >> <id>make-assembly</id> >> <phase>package</phase> >> <goals> >> <goal>single</goal> >> </goals> >> </execution> >> </executions> >> </plugin> >> >> <plugin> >> <groupId>com.theoryinpractise</groupId> >> <artifactId>clojure-maven-plugin</artifactId> >> <extensions>true</extensions> >> <configuration> >> <sourceDirectories> >> <sourceDirectory>src/clj</sourceDirectory> >> </sourceDirectories> >> </configuration> >> <executions> >> <execution> >> <id>compile</id> >> <phase>compile</phase> >> <goals> >> <goal>compile</goal> >> </goals> >> </execution> >> </executions> >> </plugin> >> >> <plugin> >> <groupId>org.codehaus.mojo</groupId> >> <artifactId>exec-maven-plugin</artifactId> >> <version>1.2.1</version> >> <executions> >> <execution> >> <phase>test</phase> >> <goals> >> <goal>exec</goal> >> </goals> >> </execution> >> </executions> >> <configuration> >> <executable>java</executable> >> <includeProjectDependencies>true</includeProjectDependencies> >> <includePluginDependencies>false</includePluginDependencies> >> <classpathScope>compile</classpathScope> >> <mainClass>${storm.topology}</mainClass> >> </configuration> >> </plugin> >> </plugins> >> </build> >> </project> >>
