MojoExecutionException: 403 Forbidden

deepur
Participant II

Hi All ,

I am geting this error when running

mvn install -Ptest -Dusername=******* -Dpassword=******* -Dorg=******

but i can see jar has been downloaded and present .

/tmp/apim-apigee/forecastweatherapi/gateway/forecastweatherapi

But i see this below error , could anyone help

Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.1.6:deploy (deploy-bundle) on project forecastweatherapi: MojoExecutionException: 403 Forbidden [ERROR] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> [ERROR] <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> [ERROR] <TITLE>ERROR: The request could not be satisfied</TITLE> [ERROR] </HEAD><BODY> [ERROR] <H1>403 ERROR</H1> [ERROR] <H2>The request could not be satisfied.</H2> [ERROR] <HR noshade size="1px"> [ERROR] This distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests. [ERROR] We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner. [ERROR] <BR clear="all"> [ERROR] If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation. [ERROR] <BR clear="all"> [ERROR] <HR noshade size="1px"> [ERROR] <PRE> [ERROR] Generated by cloudfront (CloudFront) [ERROR] Request ID: gZVezinVbY5kJTj19hEaRmuCYjt6yLJeXqM_k7ROVKchNTcHfBJiWQ== [ERROR] </PRE> [ERROR] <ADDRESS> [ERROR] </ADDRESS> [ERROR] </BODY></HTML>

0 10 517
10 REPLIES 10

@deepu pangala - not sure what this error is. Usually 403 forbidden means the user credentials you are using is forbidden from doing that operation. Can you confirm from the Maven command console output (on your terminal) that it is creating the zip (in your target directory) and then making the Apigee Management API call to import the zip ? I have not see this cloudfront error before. Is this some sort of a Corportate proxy you need to bypass to hit the Internet ? If yes, then you need to setup additional variables in your MAVEN_OPTS or settings.xml for Maven to use

Hi @Sai Saran Vaidyanathan , Yes it is creating target bundle after this command , but 404 error is coming . is there any alternative other than hitting to internet . please suggest . or what option should be used .

@deepu pangala - are you deploying this to Apigee in SaaS or your private cloud. You will need to share more info like the console logs when you run the mvn command. Also can you share the pom file details (please exclude sensitive info, if any, before sharing). In your pom file there should be a host url within the profile. Can you confirm you are able to ping it from your terminal?

Hi @Sai Saran Vaidyanathan , I am deploying to SAAS .yes host url is under profile . i am unable to ping the apigee.com from server.

below has the shared-pom.xml

<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>apigee</groupId> <artifactId>parent-pom</artifactId> <packaging>pom</packaging> <version>1.0</version> <pluginRepositories> <pluginRepository> <id>central</id> <name>Maven Plugin Repository</name> <url>http://repo1.maven.org/maven2</url> <layout>default</layout> <snapshots> <enabled>false</enabled> </snapshots> <releases> <updatePolicy>never</updatePolicy> </releases> </pluginRepository> </pluginRepositories> <properties> <main.basedir>${project.basedir}</main.basedir> </properties> <build> <plugins> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>2.5</version> </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <overwrite>true</overwrite> <encoding>UTF-8</encoding> <echo message="basedir parent : ${basedir}"/> <outputDirectory>${basedir}/target/apiproxy</outputDirectory> <resources> <resource> <directory>apiproxy</directory> </resource> </resources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>io.apigee.build-tools.enterprise4g</groupId> <artifactId>apigee-edge-maven-plugin</artifactId> <version>1.1.6</version> <executions> <execution> <id>configure-bundle</id> <phase>package</phase> <goals> <goal>configure</goal> </goals> </execution> <execution> <id>deploy-bundle</id> <phase>install</phase> <goals> <goal>deploy</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <!-- This is where you add the environment specific properties under various profile names --> <profiles> <profile> <id>test</id> <properties> <org>my-org-name</org> <options>validate</options> <apigee.profile>test</apigee.profile> <apigee.env>test</apigee.env> <apigee.hosturl>https://apigee.com/edge</apigee.hosturl> <apigee.apiversion>v1</apigee.apiversion> <apigee.org>${org}</apigee.org> <apigee.username>${username}</apigee.username> <apigee.password>${password}</apigee.password> <apigee.options>${options}</apigee.options> </properties> </profile> </profiles> </project>

below is 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"> <parent> <artifactId>parent-pom</artifactId> <groupId>apigee</groupId> <version>1.0</version> <relativePath>../shared-pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <groupId>apigee</groupId> <artifactId>forecastweatherapi</artifactId> <version>1.0</version> <name>forecastweatherapi</name> <packaging>pom</packaging> </project>

Then you need to by pass using the proxy server. Pass those values to Maven command using MAVEN_OPTS

Thankyou @Sai Saran Vaidyanathan , I have doubt how to do it .

one small query ,how postman can deploy the api proxies ,KVM and target servers to apigee .

I see management api calls are success from same server where maven deployment failed , please help me understand how that is possible .

curl -X GET -u email:password \
"https://api.enterprise.apigee.com/v1/organizations/{org_name}/apis?count=5"

Postman works because it uses your browser settings (goes through corp proxy)

Reg MAVEN_OPTS, if you are using your command prompt/terminal, just export that variable with the proxy settings.. something like

export MAVEN_OPTS="-Dhttp.proxyHost=http://host -Dhttp.proxyPort=some_port -Dhttps.proxyHost=http://host -Dhttps.proxyPort=some_port"

@Sai Saran Vaidyanathan Thank you ,

curl commands from same server are working that was the doubt .

Hi @ssvaidya , I am able to deploy from apigeetool from the server .

is it good to automate apigee deployment with apigeetool or is maven is recommended ?

You can find an example here that gives you a working Jenkins container with pipelines that uses the apigee maven plugins to deploy an API proxy, as well as run unit and integration tests

https://github.com/apigee/maven-jenkins-ci-demo