Code Deployment Issue
- Dominant language
- Java
- Stars
- 5.1k
- Forks
- 1.9k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
I implemented an AffinityFunction interface class called AvgAffinityFunction. However, when the client configures and creates a cache using the AvgAffinityFunction class, the server reports an error saying that the AvgAffinityFunction class is not found. I tried deploying the AvgAffinityFunction class on the server using the three methods mentioned in the documentation, but all attempts failed. Could you suggest where my configuration might be incorrect? I am using JDK 8 and Ignite version 2.15. Below are the three deployment methods I tried and the corresponding errors:
1. Peer Class Loading
Server-side configuration:
`
`
Despite enabling peer class loading, the server still reports a class not found error.
2. Local Directory and URL Deployment
I attempted local directory and URL deployment with the following configuration:
`
file://freq=2000@/Users/name/deploy
`
Error:
`class org.apache.ignite.IgniteException: Failed to instantiate Spring XML application context (make sure all classes used in Spring configuration are present at CLASSPATH) [springUrl=file:/Users/name/ignite/node1/config/default-config.xml]
at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1150)
at org.apache.ignite.Ignition.start(Ignition.java:328)
at org.apache.ignite.startup.cmdline.CommandLineStartup.main(CommandLineStartup.java:365)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to instantiate Spring XML application context (make sure all classes used in Spring configuration are present at CLASSPATH) [springUrl=file:/Users/name/ignite/node1/config/default-config.xml]
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:381)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:103)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:97)
at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:698)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:883)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:808)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:678)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:647)
at org.apache.ignite.Ignition.start(Ignition.java:325)
... 1 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grid.cfg' defined in URL [file:/Users/tangxiaosong.5/ignite/node1/config/default-config.xml]: Cannot create inner bean 'org.apache.ignite.spi.deployment.uri.UriDeploymentSpi#702657cc' of type [org.apache.ignite.spi.deployment.uri.UriDeploymentSpi] while setting bean property 'deploymentSpi'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.ignite.spi.deployment.uri.UriDeploymentSpi] for bean with name 'org.apache.ignite.spi.deployment.uri.UriDeploymentSpi#702657cc' defined in URL [file:/Users/name/ignite/node1/config/default-config.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.ignite.spi.deployment.uri.UriDeploymentSpi
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:389)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1702)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1447)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:375)
... 9 more
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.ignite.spi.deployment.uri.UriDeploymentSpi] for bean with name 'org.apache.ignite.spi.deployment.uri.UriDeploymentSpi#702657cc' defined in URL [file:/Users/tangxiaosong.5/ignite/node1/config/default-config.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.ignite.spi.deployment.uri.UriDeploymentSpi
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:488)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:374)
... 22 more
Caused by: java.lang.ClassNotFoundException: org.apache.ignite.spi.deployment.uri.UriDeploymentSpi
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:284)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:469)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1551)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1478)
... 24 more
Failed to start grid: Failed to instantiate Spring XML application context (make sure all classes used in Spring configuration are present at CLASSPATH) [springUrl=file:/Users/name/ignite/node1/config/default-config.xml]
Note! You may use 'USER_LIBS' environment variable to specify your classpath.`
Contributor guide
Research direction
Start with node1/config/default-config.xml and the startup stack trace, focusing on the UriDeploymentSpi class-loading failure. Read the peer class loading, deployment SPI, and USER_LIBS configuration entry points mentioned in the report, then reproduce the Ignite 2.15 startup; done means the node starts and the server can resolve AvgAffinityFunction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devops, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100