Trying to access Oracle's Maven repository - oracle

I'm attempting to access Oracle's repository. Oracle doesn't make it easy. However, I'm attempting to follow the documentation that Oracle provided.
I've:
Approved the licensing agreement on my system (in case there's some sort of cookie that needs to be set).
Set both M2_HOME and MAVEN_HOME to /usr/share/apache-maven.
Created an Oracle account.
Added the Oracle Repository to my settings.xml file.
Downloaded wagon-http 2.8 and put it in my $M2_HOME/libs/ext directory.
Generated a master password and put it in $HOME/.m2/settings-security.xml
Generated an encrypted password.
Added the Oracle Maven Repository to my $HOME/.m2/settings.xml file as specified.
Configured HTTP Wagon and added that to my $HOME/.m2/settings.xml file.
My project POM looks like this:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.vegicorp</groupId>
<artifactId>testMe</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>testMe</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>wls-api</artifactId>
<version>12.1.2</version>
</dependency>
</dependencies>
</project>
My settings.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<server>
<username>qazwart</username>
<password>swordfish</password>
<id>central</id>
</server>
<server>
<username>qazwart</username>
<password>swordfish</password>
<id>snapshots</id>
</server>
<server>
<id>maven.oracle.com</id>
<username>qazwart#foo.com</username>
<password>{swordfish=}</password>
<configuration>
<basicAuthScope>
<host>ANY</host>
<port>ANY</port>
<realm>OAM 11g</realm>
</basicAuthScope>
<httpConfiguration>
<all>
<params>
<property>
<name>http.protocol.allow-circular-redirects</name>
<value>%b,true</value>
</property>
</params>
</all>
</httpConfiguration>
</configuration>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<id>maven.oracle.com</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://maven.oracle.com</url>
<layout>default</layout>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://repo.vegicorp.net/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://repo.vegicorp.net/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven.oracle.com</id>
<url>https://maven.oracle.com</url>
</pluginRepository>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://repo.vegicorp.net/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://repo.vegicorp.net/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
When I run Maven, I get this:
$ mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building testMe 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://maven.oracle.com/commons-io/commons-io/2.4/commons-io-2.4.pom
Downloading: http://repo.vegicorp.net/artifactory/libs-release/commons-io/commons-io/2.4/commons-io-2.4.pom
Downloaded: http://repo.vegicorp.net/artifactory/libs-release/commons-io/commons-io/2.4/commons-io-2.4.pom (10 KB at 69.4 KB/sec)
Downloading: https://maven.oracle.com/com/oracle/wls-api/12.1.2/wls-api-12.1.2.pom
Downloading: http://repo.vegicorp.net/artifactory/libs-release/com/oracle/wls-api/12.1.2/wls-api-12.1.2.pom
Downloading: http://repo.vegicorp.net/artifactory/libs-snapshot/com/oracle/wls-api/12.1.2/wls-api-12.1.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.787 s
[INFO] Finished at: 2015-06-15T16:37:56-04:00
[INFO] Final Memory: 9M/156M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project testMe: Could not resolve dependencies for project com.vegicorp:testMe:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.oracle:wls-api:jar:12.1.2: Failed to read artifact descriptor for com.oracle:wls-api:jar:12.1.2: Could not transfer artifact com.oracle:wls-api:pom:12.1.2 from/to maven.oracle.com (https://maven.oracle.com): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
It appears that I don't have access to the Oracle repository although I accepted the licensing agreement and am using the account I've created. Is there something I'm missing? If I remove the reference to wls-api.jar in my pom.xml, it works.

From your settings.xml I can see that you use Artifactory. Why won't you define Oracle's repository as a remote in Artifactory? That will make the access much easier. Here's a simple guide on how to do so.
And, of course, here's the official user guide on it.
I am with JFrog, the company behind Bintray and [artifactory], see my profile for details and links.

For anybody that has spent any time fighting with this ... make sure that the ID of the oracle repository in your POM is the same as the ID of the server defined in your Settings.xml.
This is not documented anywhere but it appears that maven just does not request authorization if these IDs do not match. It does not attempt it based upon the URL as other solutions appear to suggest.

I think you missed accepting the Oracle Maven repository terms and conditions. https://www.oracle.com/webapps/maven/register/license.html

Related

Maven not using configured repositories to resolve all dependencies

Hello I am trying to build a jar using maven behind a corporate proxy with our own artifactory server.
We are building using docker gitlab runners and I am using the maven:3-jdk-8 image which is running Apache Maven 3.5.4.
The build starts fine by downloading the dependencies from our artifactory but when the maven-assembly-plugin tries to package our output into a jar I get the following error in debug mode:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single (package-jar-with-dependencies) on project <my-project>: Failed to create assembly: Unable to resolve dependencies for assembly 'jar-with-dependencies': Failed to resolve dependencies for assembly: Unable to get dependency information for org.hibernate.validator:hibernate-validator:jar:6.0.13.Final: Failed to process POM for org.hibernate.validator:hibernate-validator:jar:6.0.13.Final: Non-resolvable import POM: Could not transfer artifact org.jboss.shrinkwrap:shrinkwrap-bom:pom:1.2.3 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Name or service not known
[ERROR] org.hibernate.validator:hibernate-validator:jar:6.0.13.Final
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (https://artifactory.corp.net/, releases=true, snapshots=false)
[ERROR] Path to dependency:
[ERROR] 1) <my-project>
[ERROR] 2) org.springframework.boot:spring-boot-starter-web:jar:2.1.0.RELEASE: Unknown host repo.maven.apache.org: Name or service not known
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2.1:single (package-jar-with-dependencies) on project <my-project>: Failed to create assembly: Unable to resolve dependencies for assembly 'jar-with-dependencies'
The glaring issue would seem to be that maven is trying to retrieve hibernate-validator from repo.maven.apache.org rather than my local corporate artifactory.
I have verified that the jar in question does indeed exist in my artifactory. I have built the project locally (outside of docker maven version 3.6.1 bundled with Intellij) with identical settings and didn't have any problems.
Any ideas what I'm doing wrong?
Some possibly useful files
The effective settings generated by help:effective-settings
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<localRepository>path-to-my-repo</localRepository>
<servers>
<server>
<username>username</username>
<password>***</password>
<id>central</id>
</server>
<server>
<username>username</username>
<password>***</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Artifactory</name>
<url>https://artifactory.corp.net/</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>Artifactory</name>
<url>https://artifactory.corp.net/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Artifactory</name>
<url>https://artifactory.corp.net/</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>Artifactory</name>
<url>https://artifactory.corp.net/</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
<pluginGroups>
<pluginGroup>org.apache.maven.plugins</pluginGroup>
<pluginGroup>org.codehaus.mojo</pluginGroup>
</pluginGroups>
</settings>
The plugin configuration from the pom file
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>package-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>the.main.class</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
It is very likely that this is the result of a missing mirror configuration in the settings.xml.
If you want to send every request to your artifactory, you need to specify it as a mirror. Otherwise, repository definitions from POMs may be used as well.

Failure to find the jar file on nexus repository, was cashed in the local repository

I have faced with a next problem:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (default) on project mdw: Execution default of goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run failed: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Failure to find com.oracle:ojdbc7:jar:12.1.0.2 in **Here nexus url** was cached in the local repository, resolution will not be reattempted until the update interval of eict-plugins has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (default) on project mdw: Execution default of goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run failed: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Failure to find com.oracle:ojdbc7:jar:12.1.0.2 in **Here nexus url** was cached in the local repository, resolution will not be reattempted until the update interval of eict-plugins has elapsed or updates are forced
when maven building my project.
How can it be resolved, any suggestions ?
I tried looking and could not find an oracle version of ojdbc7. Could you try with the below and see if this helps.
<dependency>
<groupId>com.github.noraui</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
This artefact is available only on Oracle repository , to let maven download it you must declare the Oracle repository in your pom.xml :
<dependencies>
.............
<dependecy>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
<dependency>
.............
</dependencies>
<repositories>
<repository>
<id>maven.oracle.com</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://maven.oracle.com</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven.oracle.com</id>
<url>https://maven.oracle.com</url>
</pluginRepository>
</pluginRepositories>
You must have an Oracle account to be authenticated for the download, add this in of your settings.xml file :
<server>
<id>maven.oracle.com</id>
<username>your_oracle_username</username>
<password>your_oracle_password</password>
<configuration>
<basicAuthScope>
<host>ANY</host>
<port>ANY</port>
<realm>OAM 11g</realm>
</basicAuthScope>
<httpConfiguration>
<all>
<params>
<property>
<name>http.protocol.allow-circular-redirects</name>
<value>%b,true</value>
</property>
</params>
</all>
</httpConfiguration>
</configuration>

Using multiple repositories in maven cause download failure

I have som trouble when using multiple repositories in maven. Ass additinal information we use artifactory as local repository.
I have the following maven settings
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<username></username>
<password></password>
<id>central</id>
</server>
<server>
<username></username>
<password></password>
<id>snapshots</id>
</server>
<server>
<username></username>
<password></password>
<id>Dataproces</id>
</server>
<server>
<username></username>
<password></password>
<id>Dataproces-snapshot</id>
</server>
</servers>
<profiles>
<profile>
<id>artifactory</id>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://server/artifactory/libs-snapshot</url>
</repository>
<repository>
<id>Dataproces</id>
<name>Dataproces-releases</name>
<url>https://server/artifactory/libs-release-local</url>
</repository>
<!-----------PROBLEM------------>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>Dataproces-snapshot</id>
<name>Dataproces-snapshot</name>
<url>https://server/artifactory/libs-snapshot-local</url>
</repository>
<!-----------PROBLEM------------>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://server/artifactory/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>https://server02:8439/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>https://server02:8439/artifactory/pluginssnapshot</url>
</pluginRepository>
</pluginRepositories>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
</profiles>
<!-- activeProfiles | List of profiles that are active for all builds. | -->
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
If I outcomment the "Dataproces-snapshot" it installs fine, but when I add the repository maven suddenly wont install, because of the missing pom. The error log :
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MinSagSilkeborg Controller 0.1
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: https://server02:8439/artifactory/libs-snapshot-local/dk/kmd/doc2mail/webservice/1/webservice-1.pom
[INFO] Downloading: https://server02:8439/artifactory/libs-snapshot-local/dk/kmd/doc2mail/jcommander/1/jcommander-1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.401 s
[INFO] Finished at: 2016-04-06T11:47:03+02:00
[INFO] Final Memory: 15M/741M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MinSagSilkeborg-Controller: Could not resolve dependencies for project dk.dataproces.MinSagSilkeborg:MinSagSilkeborg-Controller:jar:0.1: Failed to collect dependencies at dk.kmd.doc2mail:webservice:jar:1: Failed to read artifact descriptor for dk.kmd.doc2mail:webservice:jar:1: Could not transfer artifact dk.kmd.doc2mail:webservice:pom:1 from/to Dataproces-snapshot (https://server/artifactory/libs-snapshot-local): Failed to transfer https://server/artifactory/libs-snapshot-local/dk/kmd/doc2mail/webservice/1/webservice-1.pom. Error code 409, Conflict -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
How come maven installs without any problem when the specified repository is outcommented ?
I know the pom file for the artifact is missing.

WSO2 DeveloperStudio CAR Maven deployment exception

Using wso2 developer studio guide and following the istructions at the following page:
https://docs.wso2.com/display/DVS370/Deploying+a+CAR+File+with+the+Maven+Plug-In#DeployingaCARFilewiththeMavenPlug-In-DeployCARfiletotheWSO2ESBserver
i'm not able to deploy a CAR archive in my runnging wso2 esb 4.8.1 instance as i got this exception during maven build:
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) # provaplugin ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.524s
[INFO] Finished at: Mon May 11 18:17:18 CEST 2015
[INFO] Final Memory: 22M/338M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project provaplugin: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
MojoExecutionException - Apache Maven - Apache Software Foundation
cwiki.apache.org
and this exception in the wso2's console:
ERROR - ApplicationManager Error occurred while deploying Carbon Application
org.wso2.carbon.CarbonException: Error while extracting Carbon Application : provaplugin_1.0.0.car
at org.wso2.carbon.application.deployer.AppDeployerUtils.extractCarbonApp(AppDeployerUtils.java:440)
at org.wso2.carbon.application.deployer.internal.ApplicationManager.deployCarbonApp(ApplicationManager.java:198)
at org.wso2.carbon.application.deployer.CappAxis2Deployer.deploy(CappAxis2Deployer.java:114)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)
at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.runAxisDeployment(CarbonDeploymentSchedulerTask.java:79)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:124)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.FileNotFoundException: /media/ubuntu/CodeHome/TEST%20GREG/wso2esb-4.8.1/repository/deployment/server/carbonapps/provaplugin_1.0.0.car (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:214)
at java.util.zip.ZipFile.<init>(ZipFile.java:144)
at java.util.zip.ZipFile.<init>(ZipFile.java:115)
at org.wso2.carbon.application.deployer.AppDeployerUtils.extract(AppDeployerUtils.java:653)
at org.wso2.carbon.application.deployer.AppDeployerUtils.extractCarbonApp(AppDeployerUtils.java:438)
... 20 more
[2015-05-11 18:17:22,729] ERROR - CappAxis2Deployer Error while deploying carbon application /media/ubuntu/CodeHome/TEST GREG/wso2esb-4.8.1/repository/deployment/server/carbonapps/provaplugin_1.0.0.car
java.lang.NullPointerException
at org.wso2.carbon.application.deployer.internal.ApplicationManager.revertDeployedArtifacts(ApplicationManager.java:301)
at org.wso2.carbon.application.deployer.internal.ApplicationManager.deployCarbonApp(ApplicationManager.java:275)
at org.wso2.carbon.application.deployer.CappAxis2Deployer.deploy(CappAxis2Deployer.java:114)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)
at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.runAxisDeployment(CarbonDeploymentSchedulerTask.java:79)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:124)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
But it's weird to me as the archive provaplugin_1.0.0.car is present in /repository/deployment/server/carbonapps/
This is the car pom.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.provaplugin</groupId>
<artifactId>provaplugin</artifactId>
<version>1.0.0</version>
<packaging>carbon/application</packaging>
<name>provaplugin</name>
<description>provaplugin</description>
<properties>
<com.example.provaDeploy.proxy-service_._adminEndpoint>capp/EnterpriseServiceBus</com.example.provaDeploy.proxy-service_._adminEndpoint>
<artifact.types>jaggery/app=zip,service/rule=aar,lib/library/bundle=jar,synapse/message-processors=xml,synapse/endpointTemplate=xml,synapse/proxy-service=xml,synapse/message-store=xml,carbon/application=car,registry/resource=zip,lib/dataservice/validator=jar,synapse/endpoint=xml,web/application=war,synapse/sequence=xml,synapse/configuration=xml,lib/registry/handlers=jar,synapse/task=xml,service/meta=xml,webapp/jaxws=war,synapse/api=xml,cep/bucket=xml,bpel/workflow=zip,lib/registry/filter=jar,service/dataservice=dbs,synapse/local-entry=xml,synapse/priority-executor=xml,synapse/event-source=xml,synapse/template=xml,lib/carbon/ui=jar,service/axis2=aar,synapse/sequenceTemplate=xml,wso2/gadget=dar,lib/synapse/mediator=jar</artifact.types>
</properties>
<dependencies>
<dependency>
<groupId>com.example.provaDeploy.proxy-service</groupId>
<artifactId>adminEndpoint</artifactId>
<version>1.0.0</version>
<type>xml</type>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
<repository>
<id>wso2-maven2-repository-1</id>
<url>http://dist.wso2.org/maven2</url>
</repository>
<repository>
<id>wso2-nexus-repository-1</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
<pluginRepository>
<id>wso2-maven2-repository-1</id>
<url>http://dist.wso2.org/maven2</url>
</pluginRepository>
<pluginRepository>
<id>wso2-nexus-repository-1</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<buildcommands />
<projectnatures>
<projectnature>org.wso2.developerstudio.eclipse.distribution.project.nature</projectnature>
</projectnatures>
</configuration>
</plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>maven-car-plugin</artifactId>
<version>2.0.9</version>
<extensions>true</extensions>
<executions>
<execution>
<id>car</id>
<phase>package</phase>
<goals>
<goal>car</goal>
</goals>
</execution>
</executions>
<configuration />
</plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>maven-car-deploy-plugin</artifactId>
<version>1.0.9</version>
<extensions>true</extensions>
<configuration>
<carbonServers>
<CarbonServer>
<trustStorePath>/media/ubuntu/CodeHome/TEST GREG/wso2esb-4.8.1/repository/resources/security/wso2carbon.jks</trustStorePath>
<trustStorePassword>wso2carbon</trustStorePassword>
<trustStoreType>JKS</trustStoreType>
<serverUrl>https://localhost:9445</serverUrl>
<userName>admin</userName>
<password>admin</password>
<operation>deploy</operation>
</CarbonServer>
</carbonServers>
</configuration>
</plugin>
</plugins>
</build>
</project>
http://maven.apache.org/POM/4.0.0
maven.apache.org
I get the same exception when i try deploy the car directly from eclipse ide on the developer studio WSO2Carbon server.
What's wrong?
This issue occurs when there is a space in the capp path, which is related to this issue. And, this has been fixed in the later version.
You should specify the repositories in the Distribution Management.
Maven Distribution Management
Inside project add following distributionManagement repository.
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
.........
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Internal repo</name>
<url>file:///home/thara/testesb/in</url>
</repository>
</distributionManagement>
............
</project>
For the above example I gave my file system (Linux).

Why is Maven uploading incorrectly snapshots to release repository?

I'm trying to use the maven-deploy-plugin to upload releases and snapshots into a Nexus repository. However I run across this error
[INFO] [deploy:deploy {execution: default-deploy}]
[INFO] Retrieving previous build number from nexus
Uploading: http://localhost:8081/nexus/content/repositories/snapshots/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120605.140242-20.jar
56K uploaded (edr-app-1.0.4-20120605.140242-20.jar)
[INFO] Uploading project information for edr-app 1.0.4-20120605.140242-20
[INFO] Retrieving previous metadata from nexus
[INFO] Uploading repository metadata for: 'artifact info.afilias.edr:edr-app'
[INFO] Retrieving previous metadata from nexus
[INFO] Uploading repository metadata for: 'snapshot info.afilias.edr:edr-app:1.0.4-SNAPSHOT'
[INFO] Retrieving previous build number from nexus
Uploading: http://localhost:8081/nexus/content/repositories/snapshots/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120605.140242-20.tar.gz
4286K uploaded (edr-app-1.0.4-20120605.140242-20.tar.gz)
[INFO] [deploy:deploy-file {execution: default}]
Uploading: http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4/edr-app-1.0.4.tar.gz
89530K uploaded (edr-app-1.0.4.tar.gz)
[INFO] Uploading project information for edr-app 1.0.4
[INFO] Retrieving previous metadata from remote-repository
[INFO] Uploading repository metadata for: 'artifact info.afilias.edr:edr-app'
[INFO] Retrieving previous build number from remote-repository
[INFO] repository metadata for: 'snapshot info.afilias.edr:edr-app:1.0.4-SNAPSHOT' could not be found on repository: remote-repository, so will be created
Uploading: http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120605.140242-20.tar.gz
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying attached artifact /home/mren/trunk2/target/edr-app-1.0.4-SNAPSHOT.tar.gz: Error deploying artifact: Failed to transfer file: http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120605.140242-20.tar.gz. Return code is: 400
Here's my configuration in the pom.xml:
<project>
...
<distributionManagement>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
...
<build>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<file>target/edr-install-1.0.4-${revision}.tar.gz</file>
<url>${project.distributionManagement.repository.url}</url>
<packaging>tar.gz</packaging>
<artifactId>artifactId</artifactId>
<groupId>groupId</groupId>
<version>1.0.4-${revision}</version>
</configuration>
</execution>
</executions>
</plugin>
...
</build>
...
</project>
And from my settings.xml file:
<settings>
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<profiles>
<profile>
<id>nexus</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://localhost:8081/nexus/content/repositories/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<name>Snapshots</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</settings>
I'm sure this configuration worked at one point, but now it's spitting out an error. Not sure what is wrong.
And the nexus log tells me that it's trying to upload a snapshot into a release repository
jvm 1 | 2012-06-04 14:16:31 INFO [tp1706427008-35] - org.sonatype.nexus.proxy.maven.maven2.M2Repository - Storing of item releases:/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120604.181534-1.tar.gz is forbidden by Maven Repository policy. Because releases is a RELEASE repository
jvm 1 | 2012-06-04 14:16:31 ERROR [tp1706427008-35] - org.sonatype.nexus.rest.ContentPlexusResource - Got exception during processing request "PUT http://localhost:8081/nexus/content/repositories/releases/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120604.181534-1.tar.gz": Storing of item releases:/info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120604.181534-1.tar.gz is forbidden by Maven Repository policy. Because releases is a RELEASE repository
Your settings.xml is incorrect. Please configure Maven to use Nexus correctly following the book chapter. Specifically use the mirror settings and the url in there and not specific urls for repository and pluginRepository.
It interferes with your correct Maven pom and ends up trying to deploy a snapshot into a release repository, which is incorrect.
In addition it will be important that you use the correct goal/command. Do not use deploy-file goal directly or so.
Just run the command
mvn clean deploy
on the build.
And another clarification. Maven will deploy whatever is determined from the version. If it ends in -SNASPHOT is is a development version and be published to the snapshot repo (and will allow redeploys incrementing the version number) and if it does not it is considered a release and will deploy to the release repo. A project can not be a snapshot and a release at the same time. It is one or the other.
Do not mix the two concepts of release and snapshot!
And in terms of getting additional artifacts deployed I would either pull them out into a separate project/module if they are not associated or if they are look into the attach-artifact goal of the build helper plugin.
It's because you are telling Maven to deploy a file that looks like a snapshot. Take a look at your deploy:deploy-file config. The ${revision} has the same format as a snapshot so Nexus nacks it:
target/edr-install-1.0.4-${revision}.tar.gz becomes: info/afilias/edr/edr-app/1.0.4-SNAPSHOT/edr-app-1.0.4-20120605.140242-20.tar.gz
For reference the regex that Maven and Nexus use to decide what a snapshot is/is not is covered here:
http://www.sonatype.com/people/2008/05/maven-code-how-to-detect-if-you-have-a-snapshot-version/
The other thing I would recommend is don't use deploy:deploy-file, instead use the buildhelper:attach to attach this tar.gz and then the file will be named appropriately, avoiding all of the hacking you did with the revision.

Resources