maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Chang <thomas200...@yahoo.de>
Subject Re: Get "java.lang.NoClassDefFoundError" though the class is in the classpath
Date Thu, 08 Sep 2011 12:21:12 GMT
Hi,

How do you mean "Move the dependency there"? 

I run the mvn -X and get followings:

...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.125s
[INFO] Finished at: Thu Sep 08 14:14:08 CEST 2011
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase
or a goal in the format <plugin-prefix>:<goal>
 or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.
Available lifecycle phases are: validate, initialize, generate-sources
, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources,
process-test-sources, generate-te
st-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package,
package, pre-integration-test, integration-
test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site,
site, post-site, site-deploy. -> [Help 1]
org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specified for this
build. You must specify a valid lifecycle phase o
r a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.
Available lifecycle phase
s are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources,
compile, process-classes, generate-te
st-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile,
process-test-classes, test, prepare-package
, package, pre-integration-test, integration-test, post-integration-test, verify, install,
deploy, pre-clean, clean, post-clean, pre-site, s
ite, post-site, site-deploy.
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:104)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR]
[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/NoGoalSpecifiedException
...


And my pom.xml looks as follow:

...
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>
        <!-- jax-ws -->
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.1.5</version>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-impl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.xml.bind</groupId>
                    <artifactId>jaxb-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.xml.stream</groupId>
                    <artifactId>stax-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.xml.soap</groupId>
                    <artifactId>saaj-api</artifactId>
                </exclusion>
                <!-- saaj-impl.jar darf auf keinen Fall im WAR landen! Dies
führt zu 
                    einem Fehler bei pbv-internet-ear.ear -->
                <exclusion>
                    <groupId>com.sun.xml.messaging.saaj</groupId>
                    <artifactId>saaj-impl</artifactId>
                </exclusion>
                <!-- Bei JBoss 'activation' muss ausgeschlossen -->
                <!-- <exclusion> -->
                <!-- <groupId>javax.activation</groupId> -->
                <!-- <artifactId>activation</artifactId> -->
                <!-- </exclusion> -->
            </exclusions>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
            <!-- Bei JBoss 'activation' muss ausgeschlossen -->
            <!-- <exclusions> -->
            <!-- <exclusion> -->
            <!-- <groupId>javax.activation</groupId> -->
            <!-- <artifactId>activation</artifactId> -->
            <!-- </exclusion> -->
            <!-- </exclusions> -->
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.1.9</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.stream</groupId>
            <artifactId>stax-api</artifactId>
            <version>1.0-2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>C:/Program Files/Java/jdk1.7.0/lib/tools.jar</systemPath>
        </dependency>
    </dependencies>
    <build>
        <finalName>TestWebService</finalName>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>1.10</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsgen</goal>
                        </goals>
                        <configuration>
                            <sei>com.wei.chen.MyWeb</sei>
                            <!--for demo purpose only, the webapp
does not -->
                            <!--need the generated wsdl files -->
                            <genWsdl>true</genWsdl>
                            <keep>true</keep>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
...
--- Wayne Fay <waynefay@gmail.com> schrieb am Mi, 7.9.2011:

Von: Wayne Fay <waynefay@gmail.com>
Betreff: Re: Get "java.lang.NoClassDefFoundError" though the class is in the classpath
An: "Maven Users List" <users@maven.apache.org>
Datum: Mittwoch, 7. September, 2011 16:18 Uhr

> I know the class "com.sun.mirror.apt.AnnotationProcessorFactory" is in the tools.jar
so I've add the dependency in the pom.xml as follow:
>
>             <systemPath>C:/Program Files/Java/jdk1.7.0/lib/tools.jar</systemPath>
>
> As I run mvn dependency:build-classpath to check the included jars I can see the tools.jar
in included.

You probably don't want this in your build classpath but perhaps added
to the classpath of the jaxws plugin, right? Move the dependency there
and try again with mvn -X to see the full classpath used for that
plugin execution.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message