4

I am trying to make a maven module web_service_client with parent maven module ism-maven. This module contains generated WS classes. I did not change anything. I am using IntelliJ IDEA 11.1.2.

This is my pom.xml of web_service_client.

    <?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>

After i ran maven compilation of web_service_client, I got this error:

[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

I found here some articles about this error but I am new in this field and I could not resolve this problem.

Thanks for your help.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
user1554427
  • 225
  • 7
  • 12

2 Answers2

6

It seems that the generated code uses JAX-WS 2.2. You could try to override default version and set target=2.1 or target=2.0 in your pom.xml:

            <executions>
                <execution>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <target>2.1</target>
franpas
  • 114
  • 5
  • Thanks for answer, but problem was in my IDE maven configuration, where I switch from internal maven resources to my own maven instalation and the problem was resolved. – user1554427 Mar 07 '13 at 17:39
  • After trying so many things this finally worked! Thank you franpas! – Lenymm Sep 10 '13 at 07:20
1

I was having the exact same problem and franpas answer helped me to fix it. Here is my solution that creates the classes and compiles correctly. I am also using a local maven 3.1 installation on linux.

        <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>
Chris Hinshaw
  • 6,967
  • 2
  • 39
  • 65