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

When adding Arquillian to the Maven assembly, I get an exception above 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 a problem, but Eclipse refuses to compile the project because of this. Maven works, though.)

Naturally, the first thing I did was try to exclude it from Maven dependencies ( wildfly-arquillian-container-managed is where the dependency tree states that 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 were no changes. I tried to start Eclipse using -vm C:\Program Files\Java\jdk1.8.0_60\bin . And he tried to edit the JDK in "Preferences → Installed JREs" to contain the JAR in the tool directory. But nothing works.

What can I do?

+10
eclipse maven wildfly jboss-arquillian
source share
7 answers

I put my dependencies this way 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 exception tag is in the "wildfly-embedded" dependencies ...

Do not forget to specify the command "mvn install" and click the right button in the project and "Maven Update", if it does not work, try deleting the folder "~ / .m2 / repository" and downloading all the dependencies again.

+9
source share

Alastair, thanks for solving the problem. The reason lies in the pom 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, jar is in ${java.home}/lib/jconsole.jar .

PS: the version is also not enough. So, I removed this version from my local maven repository.

+5
source share

I came across this while working on a Windows computer. The project itself worked perfectly on my Ubuntu machine. However, the collection of the project failed with this particular message, caused by the transitional dependency org.wildfly:wildfly-ejb .

Missing artifact sun.jdk: jconsole: jar: jdk

I did not feel that it was necessary to change the configuration of the project, since it should work fine in all environments, and therefore, the Windows environment itself must have been wrong. My first thought was that Eclipse itself somehow uses the JRE instead of the JDK.

So, I checked java -version in CMD and seems to point to the JRE installed somewhere in the /Program Files folder, while I always manually installed the JDK in the /Java folder. Then I checked the %PATH% environment variable in the Windows settings. It seems to include /ProgramData/Oracle/Java/javapath . This folder contained several symbolic links in the JRE in the /Program Files folder. This was actually used to run Eclipse and complete all of its tasks. When I deleted it (there was already JDK/bin further in setting %PATH% ) and restarted Eclipse and re-executed the Maven build, the error disappeared.

No changes needed to configure pom.xml or Eclipse. Just keep track of which Windows installs and updates everything for you in the background and checks your %PATH% if it still has a JDK at the top.

+2
source share

The cause of the problem is that jconsole.jar is part of jdk, so it is not distributed like a regular maven package.

Typically, a pom.xml project inserts this jconsole.jar as a system package, i.e. he doesn't even try to download them from the maven central repository. Although this could be extended along this path.

The simplest solution to the problem is to use jdk, which contains this jconsole.jar .

Alternatively, you can download this jar from anywhere, only you must make it available in the path to the compilation classes.

Or you can also change pom.xml or install the package manually in the local maven repository, since the others are responding.

+2
source share

I spent most of the day struggling with this problem. A simple solution is to manually install the missing jar from your jdk using maven, something like:

c: \ workspace \ prism> mvn install: install-file -Dfile = C: \ java \ jdk \ lib \ jconsole.jar -DgroupId = sun.jdk -DartifactId = jconsole -Dversion = 1.8 -Dpackaging = war.

Who knows why eclipse cannot do this ...

+1
source share

Perhaps this is more of a workaround than the right solution, somehow I solved this problem by deleting the "activebydefault" profile in pom. Thus, Eclipse will not complain about "Missing artifact sun.jdk: jconsole: jar: jdk", but the JUnit test will not run in Eclipse - since I use testing only from the maven test, and not for Eclipse built into JUnit, just you need to specify which profile identifier you want to work with.

0
source share

I ran into the same problem, but none of this was an ideal solution for me. Steps to solve:

  1. Check if you are pointing to the JDK location correctly: echo $ JAVA_HOME
  2. Open pom.xml from the IDE (I have an eclipse), select the Dependency Hierarchy and search for jconsole. If you see jconsole, then this is because sometimes jconsole is indicated as interdependence, and the specified path cannot be recognized. Excluding this jar, we will solve the problem.

Dependency hierarchy

Interdependent jconsole

Excluding jconsole

0
source share

All Articles