Missing artifact com.sun.jdmk:jmxtools:jar:1.2.1

JavaEclipseMavenDependency Managementpom.xml

Java Problem Overview


I have created simple project from maven-achetype-quickstart under Eclipse Indigo, then I went to pom.xml gui editor and in dependencies tab added dependency log4j by search in appropriate dialog. Now my pom.xml looks like

<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-.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroup</groupId>
  <artifactId>Test_Maven_03</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>Test_Maven_03</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
    	<groupId>log4j</groupId>
    	<artifactId>log4j</artifactId>
    	<version>1.2.15</version>
    </dependency>
  </dependencies>
  <dependencyManagement>
<dependencies>
	<dependency>
		<groupId>junit</groupId>
		<artifactId>junit</artifactId>
		<version>3.8.1</version>
	</dependency>
</dependencies>
  </dependencyManagement>
</project>

Eclipse says my POM have many problems like

Missing artifact javax.jms:jms:jar:1.1 pom.xml /Test_Maven_03 line 2 Maven Dependency Problem

What does it mean and how to see maven feature of automatic jar downloading.

EDIT 1 If I select log4j 1.2.16 instead of 1.2.15, I get another error: Missing artifact log4j:log4j:bundle:1.2.16. So I see no automatic jar management at all.

Java Solutions


Solution 1 - Java

It's not included anymore due to licensing issues if I remember correctly. If you don't need jms functionality you can exclude jms from log4j dependency:

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
	<exclusion>
		<groupId>com.sun.jmx</groupId>
		<artifactId>jmxri</artifactId>
	</exclusion>
	<exclusion>
		<groupId>com.sun.jdmk</groupId>
		<artifactId>jmxtools</artifactId>
	</exclusion>
	<exclusion>
            <groupId>javax.jms</groupId>
            <artifactId>jms</artifactId>
    </exclusion>
</exclusions>
</dependency>

Solution 2 - Java

Change the version of log4j to 1.2.16.

The metadata for 1.2.15 is bad, as you have discovered, because the dependencies are missing from the central repository. However, there is a policy of not changing artifacts or metadata in the central maven repository, because this can lead to builds being unrepeatable. That is, a build might behave differently if an artifact or its metadata changed.

The reasoning is that it's better to work around bad metadata than cause unreproducible builds.

It's better, of course, if project maintainers are more careful about the metadata that they upload to central.

Solution 3 - Java

Use Log4J 1.2.16 (the one I linked to in your earlier question); it doesn't have the older JMX dependency and gets it from Geronimo instead.

Solution 4 - Java

The answers above (excluding JMX) are fine, so long as you don't need any of the JMX dependencies. However, you will never be able to download the JMX dependencies' .jar files from a standard maven repository. To quote Jörg Schaible-3 at nabble.com:

> This is normal and it will stay so, because Sun/Oracle never granted > distribution rights for those artifacts as separate downloads. You will have > to download them from Oracle, accepting their license, and add them to a > local repository manager.

Therefore, if you want to use JMX, you will need to download the respective jmx zip folder from Oracle's website.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSuzan CiocView Question on Stackoverflow
Solution 1 - JavaSbhklrView Answer on Stackoverflow
Solution 2 - JavaMartin EllisView Answer on Stackoverflow
Solution 3 - JavaDave NewtonView Answer on Stackoverflow
Solution 4 - JavagladclefView Answer on Stackoverflow