[jbosscache-issues] [JBoss JIRA] (JBCACHE-1611) Incompatible Berkeley DB (JE) Version

wolfgang haefelinger (Created) (JIRA) jira-events at lists.jboss.org
Wed Dec 14 06:42:09 EST 2011


Incompatible Berkeley DB (JE) Version
-------------------------------------

                 Key: JBCACHE-1611
                 URL: https://issues.jboss.org/browse/JBCACHE-1611
             Project: JBoss Cache
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Cache loaders
    Affects Versions: 3.2.7.GA
         Environment: $ java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
geronimo at lhasa:~/Workspace/nosuchmeth
$ uname -a
Darwin lhasa 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

            Reporter: wolfgang haefelinger
            Assignee: Manik Surtani
            Priority: Critical


When trying to use Berkeley as cache loader (org.jboss.cache.loader.bdbje.BdbjeCacheLoader), I'm ending up in a "NoSuchMethodError", like shown below.

{code}
Caused by: java.lang.NoSuchMethodError: com.sleepycat.je.EnvironmentConfig.setAllowCreate(Z)Lcom/sleepycat/je/EnvironmentConfig;
	at org.jboss.cache.loader.bdbje.BdbjeCacheLoader.start(BdbjeCacheLoader.java:214)
	at org.jboss.cache.loader.CacheLoaderManager.startCacheLoader(CacheLoaderManager.java:464)
	... 13 more
{code}

My code is simple enough, nothing more than getting a cache up and running:

{code:java}
static public void main(String... args) throws Exception {
        
            Cache cache;
            String cacheconfig = "my-jboss-cache.xml";

            System.out.format("creating JBoss cache ..");
            CacheFactory factory = new DefaultCacheFactory();

            /* create and start my cache */
            System.out.format("loading cache config from %s",cacheconfig);
            
            cache = factory.createCache(cacheconfig);         /* throws NoSuchMethod Exception */
            System.out.format("creating JBoss cache - done.");
        }
{code}

It took me some time to dig into the problem, but here is the catch. The Berkeley engine I'm using is "je-3.2.76.jar". Decompiling class "com.sleepycat.je.EnvironmentConfig" reveals that "setAllowCreate(boolean)"'s signature is 

{code}
$ javap -s -classpath je-3.2.76.jar com.sleepycat.je.EnvironmentConfig | fgrep -A 1 setAllow
public void setAllowCreate(boolean);
  Signature: (Z)V
{code}

whereas a method returning "com.sleepycat.je.EnvironmentConfig" is expected. To put it in other words, this version of JBossCache has been compiled against a different version of Berkeley DB.

Now, which version of Berkeley introduced that change? It appears to be changed from version JE 4.0.71 onwards, according to [1]. The changelog states the following:

{quote}
All public void setFoo() methods in com.sleepycat.je.*Config have been changed to return this instead of void. This allows multiple set calls to be placed on one line, similar to StringBuffer calls. For example, it is now possible to do the following:
EnvironmentConfig envConf = new EnvironmentConfig();
envConf.setAllowCreate(true).setTransactional(true);
This will require users to recompile their code. [#17021]
{quote}
 
The quote is almost correct. Not must users recompile their code, *frameworks like JBossCache must also clearly mention in their documentation the exact requirements they impose*.

References:
[1] http://download.oracle.com/otndocs/products/berkeleydb/html/je/je-40117-changelog.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosscache-issues mailing list