baimu7 opened a new issue, #12318:
URL: https://github.com/apache/ignite/issues/12318

   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:      
   `<bean id="grid.cfg" 
class="org.apache.ignite.configuration.IgniteConfiguration">
       <property name="peerClassLoadingEnabled" value="true"/>
       <property name="deploymentMode" value="CONTINUOUS"/>
   </bean>`
       
   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:
   `<bean id="grid.cfg" 
class="org.apache.ignite.configuration.IgniteConfiguration">
       <property name="peerClassLoadingEnabled" value="true"/>
       <property name="deploymentMode" value="CONTINUOUS"/>
       <property name="deploymentSpi">
           <bean class="org.apache.ignite.spi.deployment.uri.UriDeploymentSpi">
               <property name="temporaryDirectoryPath" 
value="/tmp/temp_ignite_libs"/>
               <property name="uriList">
                   <list>
                       <value>file://freq=2000@/Users/name/deploy</value>
                   </list>
               </property>
           </bean>
       </property>
   </bean>`
           
   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.`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to