Expand my Community achievements bar.

SOLVED

Question regarding OSGI Bundles

Avatar

Level 2

When I am trying to create a OSGI bundle, let's say I miss a jar or two. I am getting an error

org.apache.commons.net.ftp -- Cannot be resolved
org.apache.log4j from log4j.over.slf4j (4)
org.apache.log4j.spi -- Cannot be resolved
org.apache.log4j.xml -- Cannot be resolved
org.apache.lucene.document -- Cannot be resolved
org.apache.lucene.index -- Cannot be resolved
org.apache.lucene.search -- Cannot be resolved
org.apache.oro.text.perl -- Cannot be resolved
org.apache.tools.ant -- Cannot be resolved
org.apache.tools.ant.taskdefs -- Cannot be resolved
org.apache.tools.ant.taskdefs.compilers -- Cannot be resolved

 

I can add the log4j in the Project dependencies. But how can I make sure it gets updated in the Manifest file? or Do I have to delte this project & start over?

Just FYI - I am not using Maven, I am using Eclipse.

1 Accepted Solution

Avatar

Correct answer by
Level 10

When using Eclipse to create an OSGi bundle - it is recommended that you use an Eclipse Plug-in project.

See these community articles that talk about using Eclipse plug-in project to build an OSGi bundle for CQ:

http://scottsdigitalcommunity.blogspot.ca/2013/08/querying-and-persisting-adobe-aem-data.html (Queries MySQL using JDBC API)

http://scottsdigitalcommunity.blogspot.ca/2012/07/creating-custom-cq-email-services.html (create an OSGI bundle that performs email operations)

Remember when using an Eclipse Plug-in project - remove all version information from the Manifest file in the Export and Import sections. For example:

Manifest-Version: 1.0

Bundle-ManifestVersion: 2
Bundle-Name: CustomerJDBC10
Bundle-SymbolicName: CustomerJDBC10
Bundle-Version: 1.0.0
Export-Package: com.adobe.test,
com.mysql.jdbc,
com.mysql.jdbc.authentication,
com.mysql.jdbc.exceptions,
com.mysql.jdbc.exceptions.jdbc4,
com.mysql.jdbc.integration.c3p0,
com.mysql.jdbc.integration.jboss,
com.mysql.jdbc.interceptors,
com.mysql.jdbc.jdbc2.optional,
com.mysql.jdbc.jmx,
com.mysql.jdbc.log,
com.mysql.jdbc.profiler,
com.mysql.jdbc.util,
org.gjt.mm.mysql
Import-Package: javax.xml.transform,
javax.xml.parsers,
javax.net,
org.slf4j,
javax.xml.transform.stax,
javax.naming,
javax.xml.transform.stream,
org.xml.sax.helpers,
javax.sql,
javax.net.ssl,
org.w3c.dom,
javax.management,
javax.transaction.xa,
javax.xml.stream,
javax.xml.transform.dom,
javax.xml.transform.sax,
org.xml.sax,
javax.naming.spi
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

For community members interested in building an OSGi bundle using Maven -- see:

http://scottsdigitalcommunity.blogspot.ca/2013/02/querying-adobe-experience-manager-data.html (Queries the JCR using the JCR API)

http://scottsdigitalcommunity.blogspot.ca/2013/08/creating-aem-applications-that-use.html (uses the QUeryBuilder API within an OSGi)

Here is a community article that talks about various ways in which you can build OSGi bunldes for CQ:

http://scottsdigitalcommunity.blogspot.ca/2012/12/exploring-different-ways-in-which-you.html

Hope this helps

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

When using Eclipse to create an OSGi bundle - it is recommended that you use an Eclipse Plug-in project.

See these community articles that talk about using Eclipse plug-in project to build an OSGi bundle for CQ:

http://scottsdigitalcommunity.blogspot.ca/2013/08/querying-and-persisting-adobe-aem-data.html (Queries MySQL using JDBC API)

http://scottsdigitalcommunity.blogspot.ca/2012/07/creating-custom-cq-email-services.html (create an OSGI bundle that performs email operations)

Remember when using an Eclipse Plug-in project - remove all version information from the Manifest file in the Export and Import sections. For example:

Manifest-Version: 1.0

Bundle-ManifestVersion: 2
Bundle-Name: CustomerJDBC10
Bundle-SymbolicName: CustomerJDBC10
Bundle-Version: 1.0.0
Export-Package: com.adobe.test,
com.mysql.jdbc,
com.mysql.jdbc.authentication,
com.mysql.jdbc.exceptions,
com.mysql.jdbc.exceptions.jdbc4,
com.mysql.jdbc.integration.c3p0,
com.mysql.jdbc.integration.jboss,
com.mysql.jdbc.interceptors,
com.mysql.jdbc.jdbc2.optional,
com.mysql.jdbc.jmx,
com.mysql.jdbc.log,
com.mysql.jdbc.profiler,
com.mysql.jdbc.util,
org.gjt.mm.mysql
Import-Package: javax.xml.transform,
javax.xml.parsers,
javax.net,
org.slf4j,
javax.xml.transform.stax,
javax.naming,
javax.xml.transform.stream,
org.xml.sax.helpers,
javax.sql,
javax.net.ssl,
org.w3c.dom,
javax.management,
javax.transaction.xa,
javax.xml.stream,
javax.xml.transform.dom,
javax.xml.transform.sax,
org.xml.sax,
javax.naming.spi
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

For community members interested in building an OSGi bundle using Maven -- see:

http://scottsdigitalcommunity.blogspot.ca/2013/02/querying-adobe-experience-manager-data.html (Queries the JCR using the JCR API)

http://scottsdigitalcommunity.blogspot.ca/2013/08/creating-aem-applications-that-use.html (uses the QUeryBuilder API within an OSGi)

Here is a community article that talks about various ways in which you can build OSGi bunldes for CQ:

http://scottsdigitalcommunity.blogspot.ca/2012/12/exploring-different-ways-in-which-you.html

Hope this helps