For some reason log4j 1.2.15 has a compile time dependency on JMX even if you’re not going to compile log4j. Go figure. I’m not the first one to point this out since there is a bug report issued.
What’s worse is that the jars are not in any maven repository due to Sun licensing restrictions. So what do you do? There are two things you can do.
- Install them to your local repository.
- Say no thanks
To install the jars to your local repository:
Get the jars from Sun. Download the “JMX 1.2.1 Reference Implementation”.
Then rename them to include the version.
copy jmxtools.jar jmxtools-1.2.1.jar copy jmxri.jar jmxri-1.2.1.jar
Then install them to your local repo:
mvn install:install-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar -Dfile=jmxtools-1.2.1.jar mvn install:install-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=jmxri-1.2.1.jar
If you also need JMS download them from Sun too.
To say “No thanks”:
You can see the log4j build dependencies at their site. Here they are.
| GroupId | ArtifactId | Version |
|---|---|---|
| com.sun.jmx | jmxri | 1.2.1 |
| com.sun.jdmk | jmxtools | 1.2.1 |
| javax.jms | jms | 1.1 |
| javax.mail | 1.4 |
So, you can just say “I don’t want them” by excluding them.
<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>
















Development notes by Gene De Lisa on topics relating to
Java and various open source projects such as
the Spring Framework, Hibernate and others.
Sorry, no comments yet.