Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pom.xml shows multiple errors on including log4j dependency

I have just created a new java project and configured it as a 'maven project' in eclipse. pom.xml file is autogenerated. It has no error at this point. I've added the log4j dependency in the auto generated pom.xml file and it shows a few errors that are shown below the pom.xml file.

<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-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Log4JPactice</groupId>
<artifactId>Log4JPactice</artifactId>
<version>0.0.1-SNAPSHOT</version>

    <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
        </dependency>   
    </dependencies>
</project>

Error:

Multiple annotations found at this line:
    - Missing artifact javax.jms:jms:jar:1.1
    - ArtifactTransferException: Failure to transfer com.sun.jdmk:jmxtools:jar:1.2.1 from https://maven-repository.dev.java.net/nonav/repository was cached in the local repository, resolution will not be reattempted until the update interval of java.net has elapsed or 
     updates are forced. Original error: Could not transfer artifact com.sun.jdmk:jmxtools:jar:1.2.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): No connector available to access repository java.net (https://maven-repository.dev.java.net/nonav/
     repository) of type legacy using the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory
    - ArtifactTransferException: Failure to transfer javax.jms:jms:jar:1.1 from https://maven-repository.dev.java.net/nonav/repository was cached in the local repository, resolution will not be reattempted until the update interval of java.net has elapsed or updates are 
     forced. Original error: Could not transfer artifact javax.jms:jms:jar:1.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): No connector available to access repository java.net (https://maven-repository.dev.java.net/nonav/repository) of type legacy using 
     the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory
    - ArtifactTransferException: Failure to transfer com.sun.jmx:jmxri:jar:1.2.1 from https://maven-repository.dev.java.net/nonav/repository was cached in the local repository, resolution will not be reattempted until the update interval of java.net has elapsed or updates 
     are forced. Original error: Could not transfer artifact com.sun.jmx:jmxri:jar:1.2.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): No connector available to access repository java.net (https://maven-repository.dev.java.net/nonav/repository) of type 
     legacy using the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory
    - Missing artifact com.sun.jdmk:jmxtools:jar:1.2.1
    - Missing artifact com.sun.jmx:jmxri:jar:1.2.1

Eclipse used: Eclipse Juno

Any idea about this error?

Update: On running mvn install from the command line I get the following error:

    Failed to execute goal on project Log4JPactice: Could not resolve dependencies for project Failed to execute goal on project Log4JPactice: Could not resolve dependencies 
for project Log4JPactice:Log4JPactice:jar:0.0.1-SNAPSHOT: 
The following artifacts could not be resolved: javax.jms:jms:jar:1.1, 
com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: 
Could not transfer artifact javax.jms:jms:jar:1.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): 
No connector available to access repository 
java.net (https://maven-repository.dev.java.net/nonav/repository) of type legacy 
using the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory -> [Help 1]
like image 610
PhantomReference Avatar asked Dec 16 '13 13:12

PhantomReference


3 Answers

You can exclude those dependencies, as you probably don't need them

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.15</version>
    <exclusions>
        <exclusion>
            <groupId>com.sun.jdmk</groupId>
            <artifactId>jmxtools</artifactId>
        </exclusion>
        <exclusion>
            <groupId>com.sun.jmx</groupId>
            <artifactId>jmxri</artifactId>
        </exclusion>
        <exclusion>
            <groupId>javax.jms</groupId>
            <artifactId>jms</artifactId>
        </exclusion>
    </exclusions>
</dependency>
like image 174
mavroprovato Avatar answered Nov 14 '22 09:11

mavroprovato


I used this and it worked

<dependencies>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

But its not working with version 1.2.15 may be a version issue

like image 34
JustTry Avatar answered Nov 14 '22 10:11

JustTry


my solution is:

<repositories>
    <repository>
        <id>repository.jboss.org-public</id>
        <name>JBoss.org Maven repository</name>
        <url>https://repository.jboss.org/nexus/content/groups/public</url>
    </repository>
</repositories>
like image 1
zond Avatar answered Nov 14 '22 08:11

zond