Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing artifact "sun.jdk:jconsole:jar:jdk"

When adding Arquillian to a Maven build I get the above exception in Eclipse:

Missing artifact sun.jdk:jconsole:jar:jdk

    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <version>1.1.7.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-persistence-dbunit</artifactId>
        <version>1.0.0.Alpha7</version>
    </dependency>

(The message is not the problem, but that Eclipse refuses to compile the project because of it. Maven works, though.)

Naturally the first thing I did was trying to exclude it from the Maven dependencies (wildfly-arquillian-container-managed is where the dependency tree states the dependency comes from):

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-arquillian-container-managed</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>jconsole</artifactId>
                <groupId>sun.jdk</groupId>
            </exclusion>
        </exclusions>
    </dependency> 

There was no change. I tried to start Eclipse with -vm C:\Program Files\Java\jdk1.8.0_60\bin. And tried to edit the JDK in "Preferences -> Installed JREs" to contain the JAR in the tools directory. But nothing works.

What can I do?

like image 276
Steffi S. Avatar asked Oct 20 '15 12:10

Steffi S.


2 Answers

I put my dependencies like this and it works fine:

<dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-arquillian-container-embedded</artifactId>
        <version>8.1.0.CR1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.15</version>
        <scope>test</scope>
    </dependency>
    <!-- Arquillian -->

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-embedded</artifactId>
        <version>8.1.0.CR1</version>
        <exclusions>
            <exclusion>
                <groupId>sun.jdk</groupId>
                <artifactId>jconsole</artifactId>
            </exclusion>
        </exclusions>
        <scope>test</scope>
    </dependency>

See that the exclusion tag is in the "wildfly-embedded" dependency...

Don't forget to command "mvn install" and click right button at project and "Maven Update", if it doesn't work try delete folder "~/.m2/repository" and download all the dependencies again.

like image 133
Mateus Pegoraro Avatar answered Sep 19 '22 09:09

Mateus Pegoraro


Alastair, thanks for solving the problem. The cause lies in the the pom of the transient dependency org.wildfly:wildfly-cli (8.2.0.Final). There you can find the following dependency declaration:

<dependency>
            <groupId>sun.jdk</groupId>
            <artifactId>jconsole</artifactId>
            <version>jdk</version>
            <scope>system</scope>
            <systemPath>${java.home}/../lib/jconsole.jar</systemPath>
</dependency>

Actually, the jar is located in ${java.home}/lib/jconsole.jar.

P.S.: The version is also insufficient. So, I deleted this version from my local maven repository.

like image 22
Olaf Kroh Avatar answered Sep 21 '22 09:09

Olaf Kroh