简体   繁体   中英

Maven error on dependency: missing artifact

I asked this question yesterday and it turned out to be a Maven issue. Although I was able to find a workaround (going with Geronimo instead of Java JMS) I was unable to figure out why the Java JMS solution isn't working.

I don't like to duplicate questions, but I don't believe this is a dupe because it is an entirely different original question.

So, I am trying to get JMS working with my application so I can push messages to a local queue. In my Maven pom.xml I add the following dependency declaration:

<dependencies>
    <dependency>
        <groupId>javax.jms</groupId>
        <artifactId>jms</artifactId>
        <version>1.1</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

And right off the bat get a (red) highlighted error ( using Eclipse ) stating:

Missing artifact javax.jms:jms:jar:1.1

When I replace this with another JMS API, such as Geronimo, the error goes away. Is this a problem with the reference (Java) JMS dependency? Or is something configured wrong in my sandbox?

You can see in maven repo browser here http://mvnrepository.com/artifact/javax.jms/jms that size of artifact is 0 bytes. Seems some problems or special policy for that artifact.

The jms 1.1 jar is not available in the default maven repository - you need to add a reference to one of other public repositories (jboss one for eg)

This answer has details https://stackoverflow.com/a/5272660/672586

The error might come because of the log4j transitive dependencies. You can exclude such dependencies as given below.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM