Expand my Community achievements bar.

SOLVED

Mass Uploading files to the DAM

Avatar

Former Community Member
In regards to the following article:
 
https://helpx.adobe.com/experience-manager/using/multiple-digital-assets.html
 
When ever I'm trying to execute the .jar file it gives me the following error:
 
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/entity/mime/content/ContentBody
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
    at java.lang.Class.getMethod0(Class.java:2856)
    at java.lang.Class.getMethod(Class.java:1668)
    at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.apache.http.entity.mime.content.ContentBody
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 6 more
 
I'm creating this in eclipse not intelliJ, so I made a parent maven project then made a maven module with the source code provided in the article
I've also added the dependencies to the module pom.xml (tried adding dependencies to parent project pom.xml as well)
I created the jar file by doing a mvn clean install on the parent project. Not sure what I'm doing wrong here?
Is there a different way to package a .jar file using a maven project/module combo?
 
Thanks
1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I recreated project on IntelliJ, works fine.

Thanks Scott!

View solution in original post

7 Replies

Avatar

Level 10

 This example AEM app consists of 2 parts:

1 client java app built with IntilliJ IDE

2 A custom sling servlet that uses AssetManager API.

You are missing required libs in the client

        <dependency>

           <groupId>org.apache.httpcomponents</groupId>

            <artifactId>httpmime</artifactId>

            <version>4.1-beta1</version>

        </dependency>

 

. That is why you are getting the exception.  

Sometimes Eclipse is not as stable as IntilliJ IDE with Maven. You can try using the free 30 day trial of IntilliJ.

Now for the Sling servlet,   follow the instructions in the document. Use the same Maven commands. Then, you can build and deploy the bundle via the felix console.  

Avatar

Correct answer by
Former Community Member

I recreated project on IntelliJ, works fine.

Thanks Scott!

Avatar

Level 10

Both the client app and the example sling servlet can be downloaded from the article. Read the readme for the client app.  Deploy the servlet as shown in the article. Make sure to configure the XML file as well. This community code has  been tested on 5.5 and 5.6 as discussed in the article.

Avatar

Level 10

When working with Maven and Java, IntilliJ IDE is far superior. 

Avatar

Level 10

If you have additional issues, email me at scottm@adobe.com.  I will setup a connect session to get you up and running.

Avatar

Former Community Member

I added the jar files manually and still getting this error. All dependencies were added as well. This programing is running and compiling on eclipse but when executing the jar file it gives the mentioned exception.

Avatar

Level 10
Try running the client app from Eclipse. If you add the pom dependencies to the pom file, it will work like it does from intilliJ.
The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----