Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We start with the helper libraries Jakarta Commons Collections and Jackrabbit Commons. Fortunately the latest releases of both libraries already come built ready as OSGi bundles. So we just grab the respective libraries from the Maven 2 repository and install them as is:

Code Block
osgi> install http://repo1.maven.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar<url>
Bundle id is 6

osgi> 01.05.2008 20:31:33.553 *INFO* [Framework Event Dispatcher] org.apache.commons.collections BundleEvent INSTALLED
start 6

osgi> 01.05.2008 20:31:38.374 *INFO* [Framework Event Dispatcher] org.apache.commons.collections BundleEvent RESOLVED
01.05.2008 20:31:38.374 *INFO* [Framework Event Dispatcher] org.apache.commons.collections BundleEvent STARTED
install http://repo1.maven.org/maven2/org/apache/jackrabbit/jackrabbit-jcr-commons/1.4.2/jackrabbit-jcr-commons-1.4.2.jar
Bundle id is 7
01.05.2008 20:32:58.959 *INFO* [Framework Event Dispatcher] org. <url>
Bundle id is 7
01.05.2008 20:32:58.959 *INFO* [Framework Event Dispatcher] org.apache.jackrabbit.jackrabbit-jcr-commons BundleEvent INSTALLED

osgi> start 7
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Import-Package: javax.jcr; version="0.0.0"
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:305)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:252)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:260)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:150)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:300)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:285)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:221)
        at java.lang.Thread.run(Thread.java:619)

osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.3.2.R33x_v20080105
1       ACTIVE      org.eclipse.osgi.services_3.1.200.v20070605
2       ACTIVE      org.apache.sling.osgi.log_2.0.0.incubator-SNAPSHOT
4       ACTIVE      org.eclipse.equinox.cm_3.2.0.v20070116
5       ACTIVE      org.apache.felix.scr_1.0.0
6       ACTIVE      org.apache.commons.collections_3.2.1
7       INSTALLED   org.apache.jackrabbit.jackrabbit-jcr-commons_1.4.2

osgi> 

...

The Sling JCR API and Base Bundles can be installed directly from the Apache Snapshot Repository, which we just do now:

Code Block
osgi> install http://people.apache.org/repo/m2-snapshot-repository/org/apache/sling/org.apache.sling.jcr.api/2.0.0-incubator-SNAPSHOT/org.apache.sling.jcr.api-2.0.0-incubator-20080430.113337-29.jar
Bundle<url>
Bundle id is 8

osgi> 01.05.2008 20:37:21.866 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.api BundleEvent INSTALLED
start 8
01.05.2008 20:37:28.099 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.api BundleEvent RESOLVED
01.05.2008 20:37:28.100 *INFO* [Framework Event Dispatcher] org.apache.jackrabbit.jackrabbit-jcr-commons BundleEvent RESOLVED

osgi> 01.05.2008 20:37:28.100 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.api BundleEvent STARTED
install http://people.apache.org/repo/m2-snapshot-repository/org/apache/sling/org.apache.sling.jcr.base/2.0.0-incubator-SNAPSHOT/org.apache.sling.jcr.base-2.0.0-incubator-20080501.182241-31.jar
Bundle id <url>
Bundle id is 9
01.05.2008 20:38:45.563 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.base BundleEvent INSTALLED

osgi> start 9
01.05.2008 20:38:51.069 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.base BundleEvent RESOLVED

01.05.2008 20:38:51.069 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.base BundleEvent STARTED
osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.3.2.R33x_v20080105
1       ACTIVE      org.eclipse.osgi.services_3.1.200.v20070605
2       ACTIVE      org.apache.sling.osgi.log_2.0.0.incubator-SNAPSHOT
4       ACTIVE      org.eclipse.equinox.cm_3.2.0.v20070116
5       ACTIVE      org.apache.felix.scr_1.0.0
6       ACTIVE      org.apache.commons.collections_3.2.1
7       RESOLVED    org.apache.jackrabbit.jackrabbit-jcr-commons_1.4.2
8       ACTIVE      org.apache.sling.jcr.api_2.0.0.incubator-SNAPSHOT
9       ACTIVE      org.apache.sling.jcr.base_2.0.0.incubator-SNAPSHOT

osgi>

...

Code Block
osgi> start 7

osgi> 01.05.2008 20:39:03.845 *INFO* [Framework Event Dispatcher] org.apache.jackrabbit.jackrabbit-jcr-commons BundleEvent STARTED
ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.3.2.R33x_v20080105
1       ACTIVE      org.eclipse.osgi.services_3.1.200.v20070605
2       ACTIVE      org.apache.sling.osgi.log_2.0.0.incubator-SNAPSHOT
4       ACTIVE      org.eclipse.equinox.cm_3.2.0.v20070116
5       ACTIVE      org.apache.felix.scr_1.0.0
6       ACTIVE      org.apache.commons.collections_3.2.1
7       ACTIVE      org.apache.jackrabbit.jackrabbit-jcr-commons_1.4.2
8       ACTIVE      org.apache.sling.jcr.api_2.0.0.incubator-SNAPSHOT
9       ACTIVE      org.apache.sling.jcr.base_2.0.0.incubator-SNAPSHOT

osgi> 
osgi> 

Jackrabbit Repository Bundles

Finally we install and start the Jackrabbit Repository and Text Extractor Bundles:

Code Block

osgi> install <url>
01.05.2008 20:45:57.183 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.jackrabbit-text-extractors BundleEvent INSTALLED
Bundle id is 10

osgi> install <url>
Bundle id is 11

osgi> 01.05.2008 21:19:05.079 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.jackrabbit.server BundleEvent INSTALLED
start 10

osgi> 01.05.2008 21:19:27.219 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.jackrabbit-text-extractors BundleEvent STARTED
start 11
01.05.2008 21:19:30.940 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.jackrabbit.server BundleEvent RESOLVED
01.05.2008 21:19:31.058 *INFO* [OSGi Console] org.apache.sling.jcr.jackrabbit.server.Activator Creating default config for Jackrabbit in jackrabbit
01.05.2008 21:19:31.075 *INFO* [OSGi Console] org.apache.sling.jcr.jackrabbit.server.Activator verifyConfiguration: Created configuration org.apache.sling.jcr.jackrabbit.server.SlingServerRepository-1209669571062-0 for org.apache.sling.jcr.jackrabbit.server.SlingServerRepository
01.05.2008 21:19:31.096 *INFO* [OSGi Console] org.apache.sling.jcr.jackrabbit.server Service [org.apache.sling.jcr.jackrabbit.server.JndiRegistrationSupport,26] ServiceEvent REGISTERED
01.05.2008 21:19:31.153 *INFO* [SCR Component Actor] org.apache.sling.jcr.jackrabbit.server Using JNDI context {java.naming.provider.url=http://incubator.apache.org/sling, java.naming.factory.initial=org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory} to register repositories
01.05.2008 21:19:31.153 *INFO* [OSGi Console] org.apache.sling.jcr.jackrabbit.server Service [org.apache.sling.jcr.jackrabbit.server.RmiRegistrationSupport,27] ServiceEvent REGISTERED
01.05.2008 21:19:31.155 *INFO* [SCR Component Actor] org.apache.sling.jcr.jackrabbit.server Using RMI Registry port 1099
01.05.2008 21:19:31.156 *INFO* [SCR Component Actor] org.apache.sling.jcr.jackrabbit.server Service [org.apache.sling.jcr.jackrabbit.server.SlingServerRepository,28] ServiceEvent REGISTERED

osgi> 01.05.2008 21:19:31.169 *INFO* [Framework Event Dispatcher] org.apache.sling.jcr.jackrabbit.server BundleEvent STARTED
01.05.2008 21:19:31.283 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl Starting repository...
01.05.2008 21:19:31.294 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.fs.local.LocalFileSystem LocalFileSystem initialized at path jackrabbit/repository
01.05.2008 21:19:31.433 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.nodetype.NodeTypeRegistry no custom node type definitions found
01.05.2008 21:19:31.453 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.fs.local.LocalFileSystem LocalFileSystem initialized at path jackrabbit/version
01.05.2008 21:19:32.555 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager Database: Apache Derby / 10.2.1.6 - (452058)
01.05.2008 21:19:32.555 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager Driver: Apache Derby Embedded JDBC Driver / 10.2.1.6 - (452058)
01.05.2008 21:19:33.060 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.fs.local.LocalFileSystem LocalFileSystem initialized at path jackrabbit/version/blobs
01.05.2008 21:19:33.105 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl initializing workspace 'default'...
01.05.2008 21:19:33.106 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.fs.local.LocalFileSystem LocalFileSystem initialized at path jackrabbit/workspaces/default
01.05.2008 21:19:33.620 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager Database: Apache Derby / 10.2.1.6 - (452058)
01.05.2008 21:19:33.620 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager Driver: Apache Derby Embedded JDBC Driver / 10.2.1.6 - (452058)
01.05.2008 21:19:33.870 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.fs.local.LocalFileSystem LocalFileSystem initialized at path jackrabbit/workspaces/default/blobs
01.05.2008 21:19:33.914 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl workspace 'default' initialized
01.05.2008 21:19:34.043 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.fs.local.LocalFileSystem LocalFileSystem initialized at path jackrabbit/repository/index
01.05.2008 21:19:34.865 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.query.lucene.SearchIndex Index initialized: jackrabbit/repository/index Version: 2
01.05.2008 21:19:34.868 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.fs.local.LocalFileSystem LocalFileSystem initialized at path jackrabbit/workspaces/default/index
01.05.2008 21:19:34.869 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.query.lucene.SearchIndex Index initialized: jackrabbit/workspaces/default/index Version: 2
01.05.2008 21:19:34.870 *INFO* [SCR Component Actor] org.apache.jackrabbit.core.RepositoryImpl Repository started
01.05.2008 21:19:35.017 *INFO* [SCR Component Actor] org.apache.sling.jcr.jackrabbit.server Service [org.apache.sling.jcr.jackrabbit.server.SlingServerRepository-1209669571062-0,29] ServiceEvent REGISTERED
01.05.2008 21:19:35.018 *INFO* [SCR Component Actor] org.apache.sling.jcr.jackrabbit.server Repository bound to JNDI as jackrabbit
01.05.2008 21:19:35.164 *INFO* [SCR Component Actor] org.apache.sling.jcr.jackrabbit.server Using private RMI Registry at 1099
01.05.2008 21:19:35.165 *INFO* [SCR Component Actor] org.apache.sling.jcr.jackrabbit.server Repository bound to //bslm-046.corp.day.com:1099/jackrabbit
ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.3.2.R33x_v20080105
1       ACTIVE      org.eclipse.osgi.services_3.1.200.v20070605
2       ACTIVE      org.apache.sling.osgi.log_2.0.0.incubator-SNAPSHOT
4       ACTIVE      org.eclipse.equinox.cm_3.2.0.v20070116
5       ACTIVE      org.apache.felix.scr_1.0.0
6       ACTIVE      org.apache.commons.collections_3.2.1
7       ACTIVE      org.apache.jackrabbit.jackrabbit-jcr-commons_1.4.2
8       ACTIVE      org.apache.sling.jcr.api_2.0.0.incubator-SNAPSHOT
9       ACTIVE      org.apache.sling.jcr.base_2.0.0.incubator-SNAPSHOT
10      ACTIVE      org.apache.sling.jcr.jackrabbit-text-extractors_1.4.0.incubator-SNAPSHOT
11      ACTIVE      org.apache.sling.jcr.jackrabbit.server_2.0.0.incubator-SNAPSHOT

osgi> 

Wow! After starting the Text Extractors and Jackrabbit Server bundles, the repository is immediately starting and is then available as an OSGi service of type javax.jcr.Repository and over RMI using the RMI URL //localhost:1099/jackrabbit

That's it. Now, you can install more bundles and enjoy the fun of programming the Content Repository for Java API.

This is a complete list of the links to the files we needed during download. Note, that some links are behind a mirroring scripts (mostly the Equinox download links).

Description

Link

Equinox OSGi Framework

org.eclipse.osgi_3.3.2.R33x_v20080105.jar

OSGi Compendium Services API

org.eclipse.osgi.services_3.1.200.v20070605.jar

Sling OSGi LogService Implementation

org.apache.sling.osgi.log-2.0.0-incubator-20080430.113337-26.jar

Equinox OSGi Configuration Admin Service Implementation

org.eclipse.equinox.cm_3.2.0.v20070116.jar

Felix OSGi Declarative Service Implementation

org.apache.felix.scr-1.0.0.jar

Jakarta Commons Collections

commons-collections-3.2.1.jar

Jackrabbit Commons

jackrabbit-jcr-commons-1.4.2.jar

Sling JCR API Bundle

org.apache.sling.jcr.api-2.0.0-incubator-20080430.113337-29.jar

Sling JCR Base Bundle

org.apache.sling.jcr.base-2.0.0-incubator-20080501.182241-31.jar

Sling Jackrabbit Text Extractors Bundle

org.apache.sling.jcr.jackrabbit-text-extractors-1.4.0-0003-incubator-20080430.113337-9.jar

Sling Jackrabbit Embedded Repository Bundle

org.apache.sling.jcr.jackrabbit.server-2.0.0-incubator-20080501.191424-29.jar