有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

使用ApacheMaven打包时出现java错误

我正在尝试运行example代码。但是,我在执行命令时遇到以下问题:

[root@sandbox our_application_folder]# mvn exec:java -Dexec.mainClass="TopologyMain" -Dexec.args="src/main/resources/words.txt"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Getting-Started 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (default-cli) @ Getting-Started ---
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
[WARNING]
java.lang.ClassNotFoundException: TopologyMain
        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:281)
        at java.lang.Thread.run(Thread.java:744)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.783 s
[INFO] Finished at: 2014-09-30T03:00:25-07:00
[INFO] Final Memory: 10M/75M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default-cli) on project Getting-Started: An exception occured while executing the Java class. TopologyMain -> [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

另外,我注意到另一个错误,如下所示。我正在学习使用Storm和Maven,因此不知道如何纠正这些错误。我需要下载丢失的软件包吗

[root@sandbox our_application_folder]# mvn package 
[INFO] Scanning for projects... 
[INFO] 
[INFO]------------------------------------------------------------------------ 
[INFO] Building Getting-Started 0.0.1-SNAPSHOT 
[INFO]------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Getting-Started --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] Copying 1 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ Getting-Started --- [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! 
[INFO] Compiling 4 source files to /root/teststorm/our_application_folder/target/classes 
[INFO]------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO]------------------------------------------------------------- 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordNormalizer.java:[5,35] error: package backtype.storm.topology.base does not exist 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordNormalizer.java:[10,36] error: cannot find symbol 
[ERROR]  class BaseBasicBolt /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[9,35] error: package backtype.storm.topology.base does not exist [ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[12,33] error: cannot find symbol 
[ERROR]  class BaseBasicBolt /root/teststorm/our_application_folder/src/main/java/TopologyMain.java:[16,9] error: no suitable method found for setBolt(String,WordNormalizer) 
[ERROR]     method TopologyBuilder.setBolt(String,IBasicBolt,Integer) is not applicable
          (actual and formal argument lists differ in length)
        method TopologyBuilder.setBolt(String,IBasicBolt) is not applicable
          (actual argument WordNormalizer cannot be converted to IBasicBolt by method invocation conversion)
        method TopologyBuilder.setBolt(String,IRichBolt,Integer) is not applicable
          (actual and formal argument lists differ in length)
        method TopologyBuilder.setBolt(String,IRichBolt) is not applicable
          (actual argument WordNormalizer cannot be converted to IRichBolt by method invocation conversion) /root/teststorm/our_application_folder/src/main/java/TopologyMain.java:[18,9] error: no suitable method found for setBolt(String,WordCounter,int) 
[ERROR]     method TopologyBuilder.setBolt(String,IBasicBolt,Integer) is not applicable
          (actual argument WordCounter cannot be converted to IBasicBolt by method invocation conversion)
        method TopologyBuilder.setBolt(String,IBasicBolt) is not applicable
          (actual and formal argument lists differ in length)
        method TopologyBuilder.setBolt(String,IRichBolt,Integer) is not applicable
          (actual argument WordCounter cannot be converted to IRichBolt by method invocation conversion)
        method TopologyBuilder.setBolt(String,IRichBolt) is not applicable
          (actual and formal argument lists differ in length) /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[22,1] error: method does not override or implement a method from a supertype [ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[33,1] error: method does not override or implement a method from a supertype [ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[40,1] error: method does not override or implement a method from a supertype [ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[44,1] error: method does not override or implement a method from a supertype [INFO] 10 errors 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 7.944 s 
[INFO] Finished at: 2014-09-30T02:38:27-07:00 
[INFO] Final Memory: 13M/106M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project Getting-Started: Compilation failure: Compilation failure: 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordNormalizer.java:[5,35] error: package backtype.storm.topology.base does not exist 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordNormalizer.java:[10,36] error: cannot find symbol 
[ERROR] class BaseBasicBolt 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[9,35] error: package backtype.storm.topology.base does not exist 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[12,33] error: cannot find symbol 
[ERROR] class BaseBasicBolt 
[ERROR] /root/teststorm/our_application_folder/src/main/java/TopologyMain.java:[16,9] error: no suitable method found for setBolt(String,WordNormalizer) 
[ERROR] method TopologyBuilder.setBolt(String,IBasicBolt,Integer) is not applicable 
[ERROR] (actual and formal argument lists differ in length) [ERROR] method TopologyBuilder.setBolt(String,IBasicBolt) is not applicable 
[ERROR] (actual argument WordNormalizer cannot be converted to IBasicBolt by method invocation conversion) [ERROR] method TopologyBuilder.setBolt(String,IRichBolt,Integer) is not applicable 
[ERROR] (actual and formal argument lists differ in length) 
[ERROR] method TopologyBuilder.setBolt(String,IRichBolt) is not applicable 
[ERROR] (actual argument WordNormalizer cannot be converted to IRichBolt by method invocation conversion) 
[ERROR] /root/teststorm/our_application_folder/src/main/java/TopologyMain.java:[18,9] error: no suitable method found for setBolt(String,WordCounter,int) 
[ERROR] method TopologyBuilder.setBolt(String,IBasicBolt,Integer) is not applicable 
[ERROR] (actual argument WordCounter cannot be converted to IBasicBolt by method invocation conversion) 
[ERROR] method TopologyBuilder.setBolt(String,IBasicBolt) is not applicable 
[ERROR] (actual and formal argument lists differ in length) 
[ERROR] method TopologyBuilder.setBolt(String,IRichBolt,Integer) is not applicable 
[ERROR] (actual argument WordCounter cannot be converted to IRichBolt by method invocation conversion) 
[ERROR] method TopologyBuilder.setBolt(String,IRichBolt) is not applicable 
[ERROR] (actual and formal argument lists differ in length) 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[22,1] error: method does not override or implement a method from a supertype 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[33,1] error: method does not override or implement a method from a supertype 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[40,1] error: method does not override or implement a method from a supertype 
[ERROR] /root/teststorm/our_application_folder/src/main/java/bolts/WordCounter.java:[44,1] error: method does not override or implement a method from a supertype 
[ERROR] -> [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/MojoFailureException

共 (0) 个答案