Restful web services | Community
Skip to main content
New Participant
February 4, 2016
Solved

Restful web services

  • February 4, 2016
  • 15 replies
  • 3771 views

Hi,

Pl refer to URL: https://helpx.adobe.com/experience-manager/using/restful-services.html

Using Java 1.7; Maven 3.0.3. AEM 6.1..

Copied settings.xml from this tutorial to users/<my user name>/.m2.

When I ran mvn archetype:generate command, I am getting the following error. 

[WARNING] Checksum validation failed, expected <html> but is 81ffbd1712afe8cdf13
8b570c0fc9934742c33c1 for http://repo.adobe.com/nexus/content/groups/public/org/
apache/maven/plugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.pom
Downloaded: http://repo.adobe.com/nexus/content/groups/public/org/apache/maven/p
lugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.pom (178 B at 0.1 K
B/sec)
[WARNING] The POM for org.apache.maven.plugins:maven-archetype-plugin:jar:2.4 is
 invalid, transitive dependencies (if any) will not be available, enable debug l
ogging for more details
Downloading: http://repo.adobe.com/nexus/content/groups/public/org/apache/maven/
plugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.jar
[WARNING] Checksum validation failed, expected <html> but is 81ffbd1712afe8cdf13
8b570c0fc9934742c33c1 for http://repo.adobe.com/nexus/content/groups/public/org/
apache/maven/plugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.jar
[WARNING] Checksum validation failed, expected <html> but is 81ffbd1712afe8cdf13
8b570c0fc9934742c33c1 for http://repo.adobe.com/nexus/content/groups/public/org/
apache/maven/plugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.jar
Downloaded: http://repo.adobe.com/nexus/content/groups/public/org/apache/maven/p
lugins/maven-archetype-plugin/2.4/maven-archetype-plugin-2.4.jar (178 B at 0.2 K
B/sec)
[WARNING] The POM for org.apache.maven.plugins:maven-archetype-plugin:jar:2.4 is
 invalid, transitive dependencies (if any) will not be available, enable debug l
ogging for more details
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.890s
[INFO] Finished at: Thu Feb 04 20:47:03 IST 2016
[INFO] Final Memory: 3M/107M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to parse plugin descriptor for org.apache.maven.plugins:maven-arc
hetype-plugin:2.4 (C:\Users\ra847757\.m2\repository\org\apache\maven\plugins\mav
en-archetype-plugin\2.4\maven-archetype-plugin-2.4.jar): error in opening zip fi
le -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginDescript
orParsingException
E:\AdobeCQ>java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

Since this is the basis for executing many Adobe tutorials, please suggest asap.

Also,mvn archetype:generate command has  -DcqVersion="5.6.1". If not for this command, will it affect when deployed on to AEM 6.1?

Appreciate your help.

Thanks,

Rama.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

send me an email scottm@adobe.com and we will set it up. 

issue was eclipse version - use Version: Indigo Service Release 2 to ensure that the MF file is updated with packages. I will update articles too. 

15 replies

New Participant
August 9, 2017

I was able to use Eclipse Oxygen (Mac) to do this and it successfully pulled in the Exported Packages and Import-Package. Neon didn't work for me and I'd had a difficult time getting Indigo SR2 to run. I also used the OSGi versions of the httpclient and httpcore packages.

nsvsrkAuthor
New Participant
February 8, 2016

Hi Scott,

The issue was completely resolved.
You spent a lot of time with me on the connect, explaining the problem, which was found to be the Eclipse version.
I appreciate all your time and efforts, without which I would be going in circles.

Thanks,

Rama.

smacdonald2008
smacdonald2008Accepted solution
New Participant
February 8, 2016

send me an email scottm@adobe.com and we will set it up. 

issue was eclipse version - use Version: Indigo Service Release 2 to ensure that the MF file is updated with packages. I will update articles too. 

nsvsrkAuthor
New Participant
February 8, 2016

Hi,

I am available now and will be awake till 11 PM IST.

Please suggest your convenient time for the connect.

Thanks,

Rama.

smacdonald2008
New Participant
February 8, 2016

If you use Eclipse plug-in project and import the JARs specified in the article - the Export section will not be blank. They will export the packages in the JAR files. We can setup a connect session - i want to see why you are getting a blank export section in the MF file. 

nsvsrkAuthor
New Participant
February 8, 2016

Hi,

In the Runtime tab, "Exported Packages', "Package Visibility" and "Classpath" sections are blank.

Scott's last suggestion says that we dont have to add/delete any packages, but remove any version info.

I checked up MANIFEST.MF and it also does not have any export packages (below). But it does have 3 lines for versions.

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: HttpBundle
Bundle-SymbolicName: httpBundle
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.7

Does it sound good?

How Exported Packages and  Import-Package header in MANIFEST.MF are  populated?

Could we set up a 5 minute Connect session to close this?

Appreciate your help.

Thanks,

Rama.

[UPDATE] - Use Eclipse version Version: Indigo Service Release 2

kautuk_sahni
Employee
February 8, 2016

Hi

I also have checked this helpx article (https://helpx.adobe.com/experience-manager/using/restful-services.html) in my instance (AEM 6.1), it is working perfectly fine.

To answer the question "please help me understand how to go about determining which classes to export and import when I create OSGI bundles", Please find below the reference article to help you with understanding this:

//The dependencies between bundles are expressed statically in terms of packages and dynamically in terms of services. A package is familiar to Java programmers. For example, a Java program may depend on a class org.foo.X, from package org.foo, and a bundle containing that program would either need to contain org.foo.X or depend on the package org.foo. Package dependencies are specified in the bundle manifest, for example:

Import-Package: org.foo

A bundle which provides a package for use by other bundles must export the package in its manifest. For example:

Export-Package: org.foo

Link:-http://www.eclipse.org/virgo/documentation/virgo-documentation-3.6.0.M01/docs/virgo-user-guide/html/ch02s02.html

 

Coming back to the article, just follow the steps mentioned in the article, 

Step 1:- Run the following Maven command:

mvn archetype:generate -DarchetypeRepository=https://repo.adobe.com/nexus/content/groups/public/ -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.2 -DgroupId=com.adobe.restservice  -DartifactId=restful -Dversion=1.0-SNAPSHOT -Dpackage=com.adobe.restservice  -DappsFolderName=myproject -DartifactName="My Project" -DcqVersion="5.6.1" -DpackageGroup="My Company"

Step 2:- mvn eclipse:eclipse

Step 3:- Add Java files to the Maven project using Eclipse 

Step 4:- Including HTTP client packages to CQ (This step is important, this is helping us to add external libs to our project. Here external jars are converted to OSGI and then installed in console which would be later used by our main component as a dependency).

How to create it

// 

 

Exported Packages (Runtime tab, select all)

//

 

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
au4liferz
New Participant
February 8, 2016

smacdonald2008 wrote...

Follow the steps - when you use Eclipse plug-in project to wrap the 3rd party JARs - Eclipse will populate the Export sections in the MF files. You do not need to add or remove any packages from the MF file. Just remove the versions beside the packages in the MF file. Then continue the steps to build the OSGi bundle that holds the 3rd party JARS. 

See this thread for full explanation:

http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__7kkg-_im_trying_toimple.html

 

I was never able to get Eclipse to populate the Export-package section automatically. I had to select the files to populate both the Export-package, and Import-package sections. I thought the dependency management function in Eclipse would help, but that didn't work either.

smacdonald2008
New Participant
February 7, 2016

Follow the steps - when you use Eclipse plug-in project to wrap the 3rd party JARs - Eclipse will populate the Export sections in the MF files. You do not need to add or remove any packages from the MF file. Just remove the versions beside the packages in the MF file. Then continue the steps to build the OSGi bundle that holds the 3rd party JARS. 

See this thread for full explanation:

http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__7kkg-_im_trying_toimple.html

nsvsrkAuthor
New Participant
February 7, 2016

Hi all,

Now Build is working fine, thanks to your guidance.

My mistake was to use variable M2_HOME as opposed to M3_HOME.

Now, I have a new stumbling block. Did not quite understand how to carry out the following steps in the URL: https://helpx.adobe.com/experience-manager/using/restful-services.html

11. Make sure that the Exported Packages list is populated.

12. Make sure these packages have been added under the Export-Package header in MANIFEST.MF. Remove the version information in the MANIFEST.MF file. Version numbers can cause conflicts when you upload the OSGi bundle to Adobe CQ.

13. Also make sure that the Import-Package header in MANIFEST.MF is  populated.

In the Runtime tab, hit Add button to add Exported Packages.

Thought that I am asked to add http client and http core packages, that I downloaded from internet.

There are many http client packages and none for http core.

Please elaborate this step.

I am using Eclipse Luna.

Appreciate your help.

Thanks,

Rama.