Jegadisan Sankar Kumar created OAK-3470:
-------------------------------------------

             Summary: Utils.estimateMemoryUsage has a NoClassDefFoundError when 
Mongo is not being used
                 Key: OAK-3470
                 URL: https://issues.apache.org/jira/browse/OAK-3470
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: core
    Affects Versions: 1.3.7, 1.2.6
            Reporter: Jegadisan Sankar Kumar
            Priority: Minor


When create a repository without Mongo and just a RDBMS DocumentNodeStore, a 
NoClassDefFoundError is encountered.

{code}
Exception in thread "main" java.lang.NoClassDefFoundError: 
com/mongodb/BasicDBObject
        at 
org.apache.jackrabbit.oak.plugins.document.util.Utils.estimateMemoryUsage(Utils.java:160)
        at 
org.apache.jackrabbit.oak.plugins.document.Document.getMemory(Document.java:167)
        at 
org.apache.jackrabbit.oak.cache.EmpiricalWeigher.weigh(EmpiricalWeigher.java:33)
        at 
org.apache.jackrabbit.oak.cache.EmpiricalWeigher.weigh(EmpiricalWeigher.java:27)
        at 
com.google.common.cache.LocalCache$Segment.setValue(LocalCache.java:2158)
        at 
com.google.common.cache.LocalCache$Segment.storeLoadedValue(LocalCache.java:3140)
        at 
com.google.common.cache.LocalCache$Segment.getAndRecordStats(LocalCache.java:2349)
        at 
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2316)
        at 
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
        at 
com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4721)
        at 
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.readDocumentCached(RDBDocumentStore.java:762)
        at 
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.find(RDBDocumentStore.java:222)
        at 
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.find(RDBDocumentStore.java:217)
        at 
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.<init>(DocumentNodeStore.java:448)
        at 
org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.getNodeStore(DocumentMK.java:671)
{code}

The dependencies in pom.xml are as follows
{code:xml}
<dependencies>
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>oak-jcr</artifactId>
            <version>1.2.6</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.189</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.1.3</version>
        </dependency>
    </dependencies>
{code}

And the code to recreate the issue
{code:java}
// Build the Data Source to be used.
        JdbcDataSource ds = new JdbcDataSource();
        ds.setURL("jdbc:h2:mem:oak;DB_CLOSE_DELAY=-1");
        ds.setUser("sa");
        ds.setPassword("sa");

        // Build the OAK Repository Instance
        DocumentNodeStore ns = null;
        try {
            ns = new DocumentMK.Builder()
                    .setRDBConnection(ds)
                    .getNodeStore();
        } finally {
            if (ns != null) {
                ns.dispose();
            }
        }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to