Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CQ5 OSGi Bundle error - org.json.simple -- Cannot be resolved

Tags:

java

json

maven

aem

I'm installing an OSGi bundle on my AEM environment as a jar.

During that I get the following error after installing the bundle:

org.json.simple -- Cannot be resolved

I have declared the dependency in Maven and my program is running fine on local.

My maven dependency is as follows:

<dependency>
     <groupId>com.googlecode.json-simple</groupId>
     <artifactId>json-simple</artifactId>
     <version>1.1</version>
</dependency>

Do I need to add any more dependencies to resolve the error? I'm relatively new to maven and this is one of the first bundle that I'm developing.

like image 295
Amit Nandan Periyapatna Avatar asked Jul 13 '15 09:07

Amit Nandan Periyapatna


2 Answers

Change your maven bundle configuration

  <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <configuration>
                    <instructions>

                        <Embed-Dependency>*;scope=compile;inline=false</Embed-Dependency>
                        <Embed-Transitive>true</Embed-Transitive>

                    </instructions>
                </configuration>

            </plugin>

There are some transitive dependencies that it needs which should get fixed by code above

like image 162
Vivek Sachdeva Avatar answered Oct 16 '22 09:10

Vivek Sachdeva


Yes - you have to wrap this JAR into an OSGi bundle and deploy that bundle to AEM.

See this AEM Artilce that shows you how to use this JSON lib in AEM:

http://scottsdigitalcommunity.blogspot.ca/2013/06/posting-form-data-to-adobe-cq-using.html

This shows you exactly how to perform this use case.

like image 1
smac2020 Avatar answered Oct 16 '22 09:10

smac2020