2012-11-25 75 views
2

我有花5天不解決這一個問題: 當執行mvn exec:java它不能正確解析配置參數,拋出了以下錯誤:未能執行目標org.codehaus.mojo的exec-Maven的插件

"Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1:java (default-cli) on project poll-translator: An exception occured while executing the Java class. null: InvocationTargetException: Error creating bean with name 'serviceLocator' defined in class path resource [META-INF/dsol/dsol.xml]: Cannot resolve reference to bean 'dsol-service-proxy' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dsol-service-proxy' defined in class path resource [META-INF/dsol/dsol.xml]: Instantiation of bean failed; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.NullPointerException-->null -> [Help 1]" 

這是POM配置中使用的文件(使用阿帕奇Maven的3.0.4)

<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/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<parent> 
    <groupId>org.dsol</groupId> 
    <artifactId>dsol-parent</artifactId> 
    <version>1-SNAPSHOT</version> 
    <relativePath>../dsol/dsol-parent/pom.xml</relativePath> 
</parent> 

<groupId>org.dsol.project</groupId> 
<artifactId>poll-translator</artifactId> 
<version>0.1-SNAPSHOT</version> 

<properties> 
    <dsol.version>0.1-SNAPSHOT</dsol.version> 
</properties> 

<repositories> 
    <repository> 
     <id>dsol.internal</id> 
     <url>http://maven.dsol-lang.net:8080/archiva/repository/internal/</url> 
    </repository> 
    <repository> 
     <id>dsol.snapshots</id> 
     <url>http://maven.dsol-lang.net:8080/archiva/repository/snapshots/</url> 
    </repository> 
</repositories> 

<dependencies> 
    <dependency> 
     <groupId>org.dsol</groupId> 
     <artifactId>dsol-interpreter</artifactId> 
     <version>${dsol.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.dsol</groupId> 
     <artifactId>dsol-default-planner-plugin-impl</artifactId> 
     <version>${dsol.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-transports-http-jetty</artifactId> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 
      <version>1.1</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>java</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <mainClass>org.dsol.engine.DSOLServer</mainClass> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>com.thoughtworks.paranamer</groupId> 
      <artifactId>paranamer-maven-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>run</id> <!-- id is optional --> 
        <configuration> 
         <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> 
         <outputDirectory>${project.build.outputDirectory}</outputDirectory> 
        </configuration> 
        <goals> 
         <goal>generate</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
    <pluginManagement> 
     <plugins> 
      <!--This plugin's configuration is used to store Eclipse m2e settings 
       only. It has no influence on the Maven build itself. --> 
      <plugin> 
       <groupId>org.eclipse.m2e</groupId> 
       <artifactId>lifecycle-mapping</artifactId> 
       <version>1.0.0</version> 
       <configuration> 
        <lifecycleMappingMetadata> 
         <pluginExecutions> 
          <pluginExecution> 
           <pluginExecutionFilter> 
            <groupId> 
             com.thoughtworks.paranamer 
            </groupId> 
            <artifactId> 
             paranamer-maven-plugin 
            </artifactId> 
            <versionRange> 
             [2.3,) 
            </versionRange> 
            <goals> 
             <goal>generate</goal> 
            </goals> 
           </pluginExecutionFilter> 
           <action> 
            <execute /> 
           </action> 
          </pluginExecution> 
         </pluginExecutions> 
        </lifecycleMappingMetadata> 
       </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build> 

Idon't不知道問題在哪裏,我該如何解決它!你能幫我嗎?

Regards, Sana。

+1

聽起來像一個類路徑或「春天」的問題。沒有看到更多的POM,你可能是SooL –

回答

1

問題在於你的彈簧配置,而不是你的maven配置。 在你的情況下,當春天試圖創建dsol-service-proxy對象時,它的構造函數需要 serviceLocator這導致serviceLocator和彈簧在創建serviceLocator時遇到了一些問題。檢查您的dsol.xml並確保serviceLocator配置正確。

+0

我檢查了我的DSOL.xml文件,但是我沒有找到有關serviceLocator字段的任何指示符!這裏是DSOL文件的代碼: Orchestration_Interface = service.PollTranslator 類= actions.PollTranslatorConcreteActions Service_Context = pollTranslator Service_Port = 8088 Classpath_Folder =的/ tmp/classpath中 #服務= classpath中:DSOL-組成-services.xml的 #操作=類路徑:abstract_actions.xml ##應用程序專用屬性 #[METHOD_NAME] .goal = #[METHOD_NAME] .initial_state = bingAPIKey = 5AC69AFC18A833033B8F5D123BAFA0F6768FDC5A –

+0

另一個問題,請,你是什麼意思 「Spring配置」 是什麼意思? –

+0

好的,最後工作!我只是修改了main的文件的類路徑位置,並且都是正確的..非常感謝你們兩個 –

0

另一個可能的解決方案是,如果您有類似這樣的東西,請考慮將ANDROID_HOME添加到環境路徑變量中。

相關問題