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

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.

Upvotes: 5

Views: 2274

Answers (2)

Vivek Sachdeva
Vivek Sachdeva

Reputation: 149

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

Upvotes: 4

smac2020
smac2020

Reputation: 10734

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.

Upvotes: 1

Related Questions