Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
I commented below line: #spring.cache.cache-names=users,cannedReports I am creating cache explicitly in CacheConfiguration class: if (cm.getCache("users") == null) cm.createCache("users", cacheConfiguration); if (cm.getCache("cannedReports") == null) cm.createCache("cannedReports", createCustomCacheConfiguration()); This ensures that cache is created according to JCache API. Now you can enable Java method cache using @CacheResult @CacheKey annotations. -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
I commented below line: #spring.cache.cache-names=users,cannedReports I am creating cache explicitly in CacheConfiguration class: if (cm.getCache("users") == null) cm.createCache("users", cacheConfiguration); if (cm.getCache("cannedReports") == null) cm.createCache("cannedReports", createCustomCacheConfiguration()); This ensures that cache is created according to JCache API. Now can enable Java method cache using @CacheResult @CacheKey annotations. -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
Hello, As I mentioned above, this exception indicates that the cache with the given name already exists in the cluster. Thanks, S. пт, 17 авг. 2018 г., 10:52 daya airody : > Hi Slava, > > other reply is about issues in caching Spring proxied objects. > > I am also seeing "Cache already exists" issue. Could you please throw some > light on this? > > Thanks in advance, > --daya-- > > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
Hi Slava, other reply is about issues in caching Spring proxied objects. I am also seeing "Cache already exists" issue. Could you please throw some light on this? Thanks in advance, --daya-- -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
Hi, looks like your question is already answered here http://apache-ignite-users.70518.x6.nabble.com/values-retrieved-from-the-cache-are-wrapped-with-JdkDynamicAopProxy-while-using-springboot-and-JCache-tp23258p23426.html Thanks, S. пн, 13 авг. 2018 г. в 15:14, daya airody : > Hi slava, > > I have uploaded my code at below link: > https://github.com/daya-airody/ignite-caching > > You need uncomment below lines in application.properties before running > startup.sh. > > spring.cache.jcache.config=classpath:example-cache.xml > spring.cache.cache-names=users,cannedReports > > When you run startup.sh, it throws below error: > > org.apache.ignite.cache.CacheExistsException: Failed to start cache (a > cache > with the same name is already started): users > > Please review my code and help me debug this issue. > Thanks in advance, > --daya-- > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
Hi slava, I have uploaded my code at below link: https://github.com/daya-airody/ignite-caching You need uncomment below lines in application.properties before running startup.sh. spring.cache.jcache.config=classpath:example-cache.xml spring.cache.cache-names=users,cannedReports When you run startup.sh, it throws below error: org.apache.ignite.cache.CacheExistsException: Failed to start cache (a cache with the same name is already started): users Please review my code and help me debug this issue. Thanks in advance, --daya-- -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
Hi, You can create a cache via CacheManager instance using Ignite CacheConfiguration or MutableConfiguration: public class ExampleNodeStartup { public static void main(String[] args) throws Exception { CachingProvider provider = Caching.getCachingProvider(); CacheManager manager = provider.getCacheManager(); Cache c1 = manager.createCache("my-test-cache-1", new MutableConfiguration<>()); CacheConfiguration cfg = new CacheConfiguration<>("my-test-cache-2"); cfg.setCacheMode(CacheMode.REPLICATED); cfg.setBackups(2); Cache c2 = manager.createCache(cfg.getName(), cfg); } } Moreover, you can provide your own Ignite configuration as well: public class ExampleNodeStartup { public static void main(String[] args) throws Exception { URI igniteCfg = "//projects//ignite//examples//config//example-cache.xml"; CachingProvider provider = Caching.getCachingProvider(); CacheManager manager = provider.getCacheManager(igniteCfg, ExampleNodeStartup.class.getClassLoader()); Cache default = manager.getCache("default"); } } All these examples work as expected, without any errors/exceptions. So, I owuld suggest creating a small project, that reproduces the issue you mentioned, and upload it on GitHub so that the community can take a look at this. Thanks. вт, 7 авг. 2018 г. в 20:45, daya airody : > Hi slava, > > thanks for your comments. I am creating the cache directly using JCache API > below: > --- > @Bean > public JCacheManagerCustomizer cacheManagerCustomizer() { > return cm -> { > Configuration cacheConfiguration = > createCacheConfiguration(); > > if (cm.getCache("users") == null) > cm.createCache("users", cacheConfiguration); > if (cm.getCache("cannedReports") == null) > cm.createCache("cannedReports", > createCustomCacheConfiguration()); > }; > } > -- > Even though I have created these caches using JCache API ( and not through > Ignite API), when I restart my application, cache.getCacheManager() is > returning null within JCacheMetrics constructor. This is a blocker. > > Any help is appreciated. > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
Hi slava, thanks for your comments. I am creating the cache directly using JCache API below: --- @Bean public JCacheManagerCustomizer cacheManagerCustomizer() { return cm -> { Configuration cacheConfiguration = createCacheConfiguration(); if (cm.getCache("users") == null) cm.createCache("users", cacheConfiguration); if (cm.getCache("cannedReports") == null) cm.createCache("cannedReports", createCustomCacheConfiguration()); }; } -- Even though I have created these caches using JCache API ( and not through Ignite API), when I restart my application, cache.getCacheManager() is returning null within JCacheMetrics constructor. This is a blocker. Any help is appreciated. -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
Hello, > org.apache.ignite.cache.CacheExistsException: Failed to start cache (a cache with the same name is already started): users This exception means that the cache is already created in the cluster. Please consider using Ignite#getOrCreateCache() method instead of Ignite#createCache() [1] This method allows to get an existing cache with the given name or creates a new one. [1] https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/Ignite.html#getOrCreateCache-org.apache.ignite.configuration.CacheConfiguration- By the way, please take a look at this page: https://apacheignite-mix.readme.io/docs/spring-caching this page provides information about Spring Caching. perhaps, the following GitHub project will be useful as well https://github.com/Romeh/spring-boot-ignite Thanks!
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
There is a problem with using spring.cache.cache-names=users,cannedReports When the SpringBoot application is restarted, it will throw below error: Caused by: org.apache.ignite.cache.CacheExistsException: Failed to start cache (a cache with the same name is already started): users at org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheChangeRequest(GridCacheProcessor.java:4358) at org.apache.ignite.internal.processors.cache.GridCacheProcessor.dynamicStartCache(GridCacheProcessor.java:2945) at org.apache.ignite.internal.processors.cache.GridCacheProcessor.dynamicStartCache(GridCacheProcessor.java:2884) at org.apache.ignite.internal.IgniteKernal.createCache(IgniteKernal.java:2724) -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: While enabling JCache, JCacheMetrics is throwing NullPointerException in getCacheManager with spring boot
I had to remove all the caches from ignite config file: This ensures that none of the caches loaded by JCache are created using ignite API. If I programmatically create cache and then add items to those caches, I don't get JCacheMetrics error. cacheManager.createCache( "myCache", new MutableConfiguration<>()); But, this means I can't configure these caches using Ignite's cache settings from the ignite config file. I am missing something here. Could you please help? Thanks. -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/