4

Apache CXF ツール wsdl2java を使用して Java コードを生成しました。私のサービスのコメントでは、Jaxws API 2.2 を推奨する必要があると書かれていますが、それが何を意味するのかわかりません。私のMaven POMにはこれがあります:

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

ビルド時に、Maven で次のエラーが発生します。

シンボル symbol が見つかりません: コンストラクタ Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])

JAX-WS API 2.2 を確認しましたが、実際にはこのコンストラクターが含まれています...どうすればよいですか?

4

1 に答える 1

7

JAX-WS は JDK の一部です。新しいバージョンを使用するには、承認されたディレクトリに配置する必要があります。Maven でこれを行うには、maven-compiler-plugin で構成する必要があります。

このページには、悲惨な詳細があります。

重要なスニペットは次のとおりです。

   <!-- Don't forget to use endorsed with JAX-WS 2.2 on Java 6 !! -->
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
      <source>1.6</source>
      <target>1.6</target>
      <compilerArguments>
        <endorseddirs>${project.build.directory}/endorsed</endorseddirs>
      </compilerArguments>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.3</version>
    <executions>
      <execution>
        <phase>validate</phase>
        <goals>
          <goal>copy</goal>
        </goals>
        <configuration>
          <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
          <silent>true</silent>
          <artifactItems>
            <artifactItem>
              <groupId>javax.xml.bind</groupId>
              <artifactId>jaxb-api</artifactId>
              <version>2.2.4</version>
              <type>jar</type>
            </artifactItem>
            <artifactItem>
              <groupId>javax.xml.ws</groupId>
              <artifactId>jaxws-api</artifactId>
              <version>2.2.8</version>
              <type>jar</type>
            </artifactItem>
          </artifactItems>
        </configuration>
      </execution>
    </executions>
  </plugin>
于 2013-03-30T19:16:08.817 に答える