我正在尝试创建实例以使用xml默认文件配置开始点火,并且在xml文件中,我尝试将cacheStoreFactory
设置为class,但该文件找不到该类。
我试图将软件包添加到<constructor-arg value="com.example.TestN2.PersonStore"/>
,但是它不起作用,我什至将设置文件从ignite的存储库更改为项目的存储库,但是它不起作用。
XML文件
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="dataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/mydbname"></property>
<property name="username" value="meriem"></property>
<property name="password" value="meriem"></property>
</bean>
<bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="personCache"></property>
<!-- Set cacheStoreFactory-->
<property name="cacheStoreFactory">
<bean class="javax.cache.configuration.FactoryBuilder" factory-method="factoryOf">
<constructor-arg value="com.example.TestN2.PersonStore"/>
</bean>
</property>
<!-- Enable readThrough-->
<property name="readThrough" value="true"></property>
<property name="writeThrough" value="true"></property>
<property name="queryEntities">
<list>
<bean class="org.apache.ignite.cache.QueryEntity">
<property name="keyType" value="java.lang.Long"></property>
<property name="valueType" value="com.example.TestN2.Person"></property>
<property name="fields">
<map>
<entry key="id" value="java.lang.Long"></entry>
<entry key="name" value="java.lang.String"></entry>
<entry key="orgId" value="java.lang.Long"></entry>
<entry key="salary" value="java.lang.Integer"></entry>
</map>
</property>
</bean>
</list>
</property>
</bean>
</list>
</property>
<property name="peerClassLoadingEnabled" value="true"></property>
</bean>
使用此文件conf开始点火:
Ignite ignite =Ignition.start("F:\\Work\\TestN2\\src\\main\\java\\config\\default-config2.xml")
java.lang.RuntimeException:无法创建的实例 com.example.TestN2.PersonStore