Code Monkey home page Code Monkey logo

Comments (5)

alexsnaps avatar alexsnaps commented on June 23, 2024

I wrote this small test:

    javax.cache.CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
    CacheConfiguration cacheConfiguration = new CacheConfiguration();
    cacheConfiguration.setTimeToLiveSeconds(60 * 60 * 24 * 365 * 10);
    cacheConfiguration.setTimeToIdleSeconds(60 * 60 * 24 * 365 * 10);
    JCacheConfiguration jCacheConfiguration = new JCacheConfiguration(cacheConfiguration);
    javax.cache.Cache cache = cacheManager.createCache("boo", jCacheConfiguration);
    cache.put("key", "Value");
    assertThat(cache.get("key"), is((Object) "Value"));

And nothing fails... Not sure what NPE you see @igmar , could you share it?

from ehcache-jcache.

igmar avatar igmar commented on June 23, 2024

I'll check when I get back from holiday. No usable laptop with me.

from ehcache-jcache.

igmar avatar igmar commented on June 23, 2024

To bring this back up :

Error in custom provider, java.lang.NullPointerException
at com.bm.common.cache.CacheModule$1.configure(CacheModule.java:78) (via modules: com.google.inject.util.Modules$OverrideModule -> com.bm.common.cache.CacheModule -> com.bm.common.cache.CacheModule$1)
at com.bm.common.cache.CacheModule$1.configure(CacheModule.java:78) (via modules: com.google.inject.util.Modules$OverrideModule -> com.bm.common.cache.CacheModule -> com.bm.common.cache.CacheModule$1)
while locating javax.cache.Cache annotated with @com.bm.common.cache.ehcache.EHCache(value=games)
for field at cache.CacheTest.cache(CacheTest.java:40)
while locating cache.CacheTest

1 error

at com.google.inject.internal.Errors.throwProvisionExceptionIfErrorsExist(Errors.java:482)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:67)
at com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:984)
at cache.CacheTest.cacheEmpty(CacheTest.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:119)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Caused by: java.lang.NullPointerException
at org.ehcache.jcache.JCacheConfiguration.(JCacheConfiguration.java:67)
at org.ehcache.jcache.JCacheConfiguration.(JCacheConfiguration.java:124)
at org.ehcache.jcache.JCacheManager.createCache(JCacheManager.java:110)
at com.bm.common.cache.ehcache.EHCacheProvider.get(EHCacheProvider.java:41)
at com.bm.common.cache.ehcache.EHCacheProvider.get(EHCacheProvider.java:18)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at com.google.inject.internal.ExposedKeyFactory.get(ExposedKeyFactory.java:54)
at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:93)
at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:80)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:80)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:62)
... 30 more

from ehcache-jcache.

igmar avatar igmar commented on June 23, 2024

I'll also do some diving, to see if I can figure out what causes this. It's a DI usage, in the Play framework in case it's relevant.

from ehcache-jcache.

igmar avatar igmar commented on June 23, 2024

It blows up in JCacheConfiguration.java :

Factory expiryPolicyFactory = cConfiguration.getExpiryPolicyFactory();
this.expiryPolicy = expiryPolicyFactory.create();

expiryPolicyFactory is null -> kaboom. No idea yet as to why.

from ehcache-jcache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.