2013-02-07 35 views
4

我正在嘗試使用父maven模塊ism-maven製作一個maven模塊web_service_client。 該模塊包含生成的WS類。我沒有改變任何東西。我正在使用IntelliJ IDEA 11.1.2。無法找到符號構造函數服務(URL,QName,WebServiceFeature [])

這是我的web_service_client的pom.xml。

<?xml version="1.0" encoding="UTF-8"?> 
<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"> 
    <parent> 
     <artifactId>ism-maven</artifactId> 
     <groupId>sk.tuke.ism</groupId> 
     <version>1.0</version> 
    </parent> 
    <modelVersion>4.0.0</modelVersion> 

    <artifactId>web_service_client</artifactId> 


</project> 

後我跑web_service_client的行家編譯,我得到這個錯誤:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project web_service_client: Compilation failure: Compilation failure: 
[ERROR] \Users\Marek\Dropbox\ism-maven\web_service_client\src\main\java\sk\tuke\ism\webclient\Service1.java:[46,8] cannot find symbol 
[ERROR] symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[]) 
[ERROR] location: class javax.xml.ws.Service 
[ERROR] \Users\Marek\Dropbox\ism-maven\web_service_client\src\main\java\sk\tuke\ism\webclient\Service1.java:[54,8] cannot find symbol 
[ERROR] symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[]) 
[ERROR] location: class javax.xml.ws.Service 
[ERROR] \Users\Marek\Dropbox\ism-maven\web_service_client\src\main\java\sk\tuke\ism\webclient\Service1.java:[62,8] cannot find symbol 
[ERROR] symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[]) 
[ERROR] location: class javax.xml.ws.Service 
[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 

我在這裏找到關於此錯誤的一些文章,但我在這個領域是新的,我解決不了這個問題。

感謝您的幫助。

回答

4

似乎生成的代碼使用JAX-WS 2.2。你可以嘗試在你的pom.xml覆蓋默認的版本,並設置目標= 2.1或目標= 2.0:

  <executions> 
       <execution> 
        <goals> 
         <goal>wsimport</goal> 
        </goals> 
        <configuration> 
         <target>2.1</target> 
+0

感謝您的回答,但問題出在我的IDE maven配置中,我從內部maven資源切換到我自己的maven安裝並解決了問題。 – user1554427

+0

嘗試了這麼多事情後,終於奏效了!謝謝franpas! – Lenymm

1

我有完全相同的問題和答案franpas幫我解決它。這是我的解決方案,它可以創建類並正確編譯。我也在linux上使用本地maven 3.1安裝。

 <plugin> 
      <groupId>org.jvnet.jax-ws-commons</groupId> 
      <artifactId>jaxws-maven-plugin</artifactId> 
      <version>2.3</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>wsimport</goal> 
        </goals> 
        <configuration> 
         <target>2.1</target> 
         <verbose>true</verbose> 
         <!-- Fix naming resolution due to ChangeOrderResponse duplicate stanza --> 
         <args> 
          <arg>-B-XautoNameResolution</arg> 
         </args> 
         <wsdlDirectory>src/main/wsdl</wsdlDirectory> 
         <wsdlFiles> 
          <wsdlFile>changeorder.wsdl</wsdlFile> 
         </wsdlFiles> 
         <packageName>com.whatever.service 
         </packageName> 
        </configuration> 
       </execution> 
      </executions> 

      <dependencies> 
       <dependency> 
        <groupId>com.sun.xml.ws</groupId> 
        <artifactId>jaxws-tools</artifactId> 
        <version>2.2.8</version> 
       </dependency> 

       <dependency> 
        <groupId>javax.xml.ws</groupId> 
        <artifactId>jaxws-api</artifactId> 
        <version>2.2.11</version> 
       </dependency> 
      </dependencies> 

     </plugin> 
相關問題