1

I have a maven project which is actually supposed to be a scheduler. In that project, I have a pom.xml for dependencies. There is a dependency as activation-1.0.2.jar. pom is throwing an error as Missing artifact javax.activation:activation:jar:1.0.2. Although I have not mentioned any dependency for this jar anywhere in my pom, still I am getting this error. May be some other jar depends on it, but how to get that. or how to resolve it. Please help.

<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>com.bajaj</groupId>
<artifactId>VehicleMasterScheduler</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>abc</name>
<url>http://repo.maven.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>2.2.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.3</version>
    </dependency>
    <!-- http://mvnrepository.com/artifact/wsdl4j/wsdl4j -->
    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
        <version>1.6.2</version>
    </dependency>
    <!-- http://mvnrepository.com/artifact/log4j/log4j -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <!-- http://mvnrepository.com/artifact/log4j/apache-log4j-extras -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>apache-log4j-extras</artifactId>
        <version>1.2.17</version>
    </dependency>
    <!-- http://mvnrepository.com/artifact/org.apache.commons/commons-io -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>
    <!-- http://mvnrepository.com/artifact/javax.xml/jaxrpc-api -->
    <dependency>
        <groupId>javax.xml</groupId>
        <artifactId>jaxrpc-api</artifactId>
        <version>1.1</version>
    </dependency>
    <!-- http://mvnrepository.com/artifact/commons-cli/commons-cli -->
    <dependency>
        <groupId>commons-cli</groupId>
        <artifactId>commons-cli</artifactId>
        <version>1.4</version>
    </dependency>
    <!-- http://mvnrepository.com/artifact/commons-logging/commons-logging -->
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.2</version>
    </dependency>
    <!-- http://mvnrepository.com/artifact/commons-discovery/commons-discovery -->
    <dependency>
        <groupId>commons-discovery</groupId>
        <artifactId>commons-discovery</artifactId>
        <version>0.5</version>
    </dependency>
    <dependency>
        <groupId>uk.org.simonsite</groupId>
        <artifactId>log4j-rolling-appender</artifactId>
        <version>20140925-0909</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20170516</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.soap</groupId>
        <artifactId>saaj-api</artifactId>
        <version>1.3</version>
    </dependency>
</dependencies>
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.bajaj.main.AutomationMain</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins> <!-- did NOT work without this -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
        </plugin>
    </plugins>
</build>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>2.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.3</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/wsdl4j/wsdl4j -->
        <dependency>
            <groupId>wsdl4j</groupId>
            <artifactId>wsdl4j</artifactId>
            <version>1.6.2</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/log4j/log4j -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/log4j/apache-log4j-extras -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>apache-log4j-extras</artifactId>
            <version>1.2.17</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/org.apache.commons/commons-io -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/javax.xml/jaxrpc-api -->
        <dependency>
            <groupId>javax.xml</groupId>
            <artifactId>jaxrpc-api</artifactId>
            <version>1.1</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/commons-cli/commons-cli -->
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.4</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/commons-logging/commons-logging -->
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/commons-discovery/commons-discovery -->
        <dependency>
            <groupId>commons-discovery</groupId>
            <artifactId>commons-discovery</artifactId>
            <version>0.5</version>
        </dependency>
        <dependency>
            <groupId>uk.org.simonsite</groupId>
            <artifactId>log4j-rolling-appender</artifactId>
            <version>20140925-0909</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20170516</version>
        </dependency>
    </dependencies>
</dependencyManagement>

Anuj Sharma
  • 111
  • 1
  • 1
  • 9
  • Could you please share the complete error you are receiving? – Praveen Nov 29 '17 at 05:36
  • Failed to execute goal on project VehicleMasterScheduler: Could not resolve dependencies for project com.bajaj:VehicleMasterScheduler:jar:1.0: Failure to find javax.activation:activation:jar:1.0.2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced – Anuj Sharma Nov 29 '17 at 05:46
  • If you are using eclipse, right-click on project --> Maven --> Update Project --> Check the Force Update Snapshots/Releases --> Ok That should solve the issue – Anirudh Nov 29 '17 at 06:40
  • [this is a 12 year old dependency file and only the .pom exists in central anymore](http://search.maven.org/#artifactdetails%7Cjavax.activation%7Cactivation%7C1.0.2%7Cjar) –  Nov 29 '17 at 07:04

2 Answers2

4

Try making a force update like below,

mvn clean install -U

Edit:
On further investigation , I found that the jar is missing in maven central repository http://central.maven.org/maven2/

You have to include some other repository which contains the artifact (jar) in your pom file to ensure it downloads from the other location,

<repositories>
    <repository>
        <id>adobe-public</id>
        <url>https://repo.adobe.com/nexus/content/repositories/public/</url>
    </repository>
</repositories>
Praveen
  • 1,791
  • 3
  • 20
  • 33
  • Failed to execute goal on project VehicleMasterScheduler: Could not resolve dependencies for project com.bajaj:VehicleMasterScheduler:jar:1.0: Could not find artifact javax.activation:activation:jar:1.0.2 in central (https://repo.maven.apache.org/maven2) – Anuj Sharma Nov 29 '17 at 06:13
  • @AnujSharma you can check my updated answer – Praveen Nov 29 '17 at 06:38
  • @praveen's solution worked for me earlier but it's broken recently as Adobe repo is down; https://repo.adobe.com/nexus/content/repositories/public/. Resolved the activation jar issue as below. Downloaded the activation jar to local and resolved it in maven from the system path. javax.activation activation 1.0.2 system ${project.basedir}/lib/required/activation-1.0.2.jar – Ricky Boy Jul 30 '18 at 17:38
  • @RickyBoy I could see the repo is working fine now. However, I had the same problem where the artifact was not founded at all. I used to install the artifactory in the remote repo provided for us in the organization level. – Praveen Jul 31 '18 at 07:13
0

This worked for me.

  1. Download Java Activation Framework

http://www.oracle.com/technetwork/java/javase/jaf-136260.html

and then

http://download.oracle.com/otn-pub/java/jaf/1.0.2-fcs/jaf-1_0_2-upd2.zip

  1. Extract "jaf-1.0.2"

  2. Run at folder "jaf-1.0.2"

mvn install:install-file -Dfile=activation.jar -DgroupId=javax.activation -DartifactId=activation -Dversion=1.0.2 -Dpackaging=jar

Anuj Sharma
  • 111
  • 1
  • 1
  • 9
  • This will work only from your local machine and resolves your current problem. However, If you have your code in some repository which is build through CI/CD tools like Jenkins/bamboo will cause the same error. – Praveen Nov 29 '17 at 07:00