Expand my Community achievements bar.

SOLVED

Restful web services

Avatar

Level 7

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

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. 

View solution in original post

15 Replies

Avatar

Level 10

Hi Rama,

Did you included the "Adobe Public Maven Repository" after copying the setting.xml to user->m2? If you include the Adobe's public repository(<profile> Adobe public repository</profile> then It will work.

I have done many times, It worked for me.

Also try to install the package that attached in the article(AEMRestful-webservices61-1.0.zip) for AEM6.1 for your reference.

Thanks,
Ratna Kumar.

Avatar

Level 10

The -DcqVersion="5.6.1" is only metadata and will not impact your OSGi bundle. 

Also - this is the .m2 settings.xml file that works perfectly for me. See attachment. 

Avatar

Level 7

Hi all,

Tried all these without success, including copying the attached settings.xml to my .m2..

Are these versions OK?

Using Java 1.7; Maven 3.0.3. 

Could I show this using Adobe Connect now?

I would guess that it takes a few mins for you to crack it out.

Thanks,

Rama.

Avatar

Level 10

Clear your folders and Maven and then try setting up maven following this: 

https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

Lets get Maven working as a starting point.

Avatar

Level 4

nsvsrk wrote...

Hi all,

Tried all these without success, including copying the attached settings.xml to my .m2..

Are these versions OK?

Using Java 1.7; Maven 3.0.3. 

Could I show this using Adobe Connect now?

I would guess that it takes a few mins for you to crack it out.

Thanks,

Rama.

 

If Scott's last suggestion doesn't work, (i.e. cleaning everything out to get maven working), please run "mvn -eX", (i.e. with the switches to turn on full/verbose debugging), and then paste the first couple of errors in your maven log file, (i.e. redirect output from the mvn command to a file). This should provide a much better idea as to what is going on with your maven installation.

Avatar

Level 7

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.

Avatar

Level 10

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-manage...

Avatar

Level 4

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-manage...

 

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.

Avatar

Administrator

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/...

 

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

Avatar

Level 7

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

Avatar

Level 10

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. 

Avatar

Level 7

Hi,

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

Please suggest your convenient time for the connect.

Thanks,

Rama.

Avatar

Correct answer by
Level 10

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. 

Avatar

Level 7

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.

Avatar

Level 2

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.