You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by devis76 <de...@flexvalley.com> on 2016/11/03 11:29:14 UTC

Question about Class Not found

Hi,
i have a simple Pojo

public class Client implements Serializable 
private static final long serialVersionUID = 2747772722162744232L;
@QuerySqlField
private final Date registrationDate;
@QuerySqlField(index = true)
private final String lwersion;
...

I have create simple Cache<String,Client>...
cacheCfg.setBackups(0);
cacheCfg.setName(ctx.name());
cacheCfg.setCacheMode(PARTITIONED);


When i use a Query

	QueryCursor<List&lt;?>> qryx = cache
													 .query(new SqlFieldsQuery("select * from " +
valueType.getSimpleName()));
			List<V> list = new ArrayList<V>();
			for (List<?> row : qryx) {
				logger.trace("Query {} List size {}", cache.getName(), row.size());
				logger.trace("Query {} List size {} {}", cache.getName(), row.get(0),
row.get(1));
				logger.trace("Query Cache  {} Key found {} {}", cache.getName(),
row.get(0));
				list.add((V) row.get(1));
			}
			qryx.close();
			return list;

When i run this query with a single node all works fine.

When i'll start second Karaf the "last node started" throw a Class Not
Found....
have you any suggestion please?






--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Question-about-Class-Not-found-tp8685.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Question about Class Not found

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Hi,

I can only guess which class in was not found, but I think you have not
loaded jar on each nodes.
You have several tricks:
1) Copy jar into classpath on each nodes
2) Turn on peertopeer class loader[1].
3) Use query entry [2], without field annotation and method setIndexTypes

[1]: o.a.i.configuration.IgniteConfiguration#setPeerClassLoadingEnabled
[2]:
https://apacheignite.readme.io/docs/sql-queries#configuring-sql-indexes-using-queryentity

On Thu, Nov 3, 2016 at 2:29 PM, devis76 <de...@flexvalley.com>
wrote:

> Hi,
> i have a simple Pojo
>
> public class Client implements Serializable
> private static final long serialVersionUID = 2747772722162744232L;
> @QuerySqlField
> private final Date registrationDate;
> @QuerySqlField(index = true)
> private final String lwersion;
> ...
>
> I have create simple Cache<String,Client>...
> cacheCfg.setBackups(0);
> cacheCfg.setName(ctx.name());
> cacheCfg.setCacheMode(PARTITIONED);
>
>
> When i use a Query
>
>         QueryCursor<List&lt;?>> qryx = cache
>
>                                .query(new SqlFieldsQuery("select * from " +
> valueType.getSimpleName()));
>                         List<V> list = new ArrayList<V>();
>                         for (List<?> row : qryx) {
>                                 logger.trace("Query {} List size {}",
> cache.getName(), row.size());
>                                 logger.trace("Query {} List size {} {}",
> cache.getName(), row.get(0),
> row.get(1));
>                                 logger.trace("Query Cache  {} Key found {}
> {}", cache.getName(),
> row.get(0));
>                                 list.add((V) row.get(1));
>                         }
>                         qryx.close();
>                         return list;
>
> When i run this query with a single node all works fine.
>
> When i'll start second Karaf the "last node started" throw a Class Not
> Found....
> have you any suggestion please?
>
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Question-about-Class-Not-found-tp8685.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov

Re: Question about Class Not found

Posted by devis76 <de...@flexvalley.com>.
Hi,
here my imports
import com.flexvalley.api.cluster.svc.ICacheCluster;
import com.flexvalley.api.cluster.svc.IClusterService;
import com.flexvalley.api.cluster.svc.IMessagesCluster;
import com.flexvalley.api.cluster.svc.INodeService;
import com.flexvalley.module.mqtt.api.MQTTServiceNames;
import com.flexvalley.service.cluster.maps.ClusterMapServiceImpl;
import org.apache.ignite.*;
import org.apache.ignite.cache.affinity.AffinityUuid;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.osgi.IgniteAbstractOsgiContextActivator;
import org.apache.ignite.osgi.classloaders.OsgiClassLoadingStrategyType;
import org.apache.ignite.plugin.segmentation.SegmentationPolicy;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceDescriptor;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import
org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder;
import
org.apache.ignite.spi.loadbalancing.roundrobin.RoundRobinLoadBalancingSpi;
import org.jetbrains.annotations.Nullable;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.cache.configuration.FactoryBuilder;
import javax.cache.expiry.CreatedExpiryPolicy;
import javax.cache.expiry.Duration;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import static org.apache.ignite.cache.CacheMode.PARTITIONED;








--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Question-about-Class-Not-found-tp8685p8717.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Question about Class Not found

Posted by Raul Kripalani <ra...@apache.org>.
Hi,

Could you please paste the OSGi imports of the bundle that contains the
Activator?

Could you also post a full stacktrace?

Thanks.

On 3 Nov 2016 19:31, "Denis Magda" <dm...@gridgain.com> wrote:

> *Raul*, could you assist with this issue?
>
> —
> Denis
>
> On Nov 3, 2016, at 8:39 AM, devis76 <de...@flexvalley.com> wrote:
>
> Hi,
> i have found my problem, but i have no idea how to resolve.
>
> Activator extends IgniteAbstractOsgiContextActivator
> @Override
> public IgniteConfiguration igniteConfiguration() {
> cfg.setPeerClassLoadingEnabled(false);
> RoundRobinLoadBalancingSpi spiRRLB = new RoundRobinLoadBalancingSpi();
> // Configure SPI to use global round-robin mode.
> spiRRLB.setPerTask(false);
> // Override default load balancing SPI.
> cfg.setLoadBalancingSpi(spiRRLB);
> }
>
>
>
>
> [1]First Karaf start it's ok!... my QueryCursor "cache.query(new
> SqlFieldsQuery("select * from ClientUpdate")
>
> 2)Second Karaf(same bundles/packages as [1],different Machine, when Start
> the first bundle is Cluster/Activator/Configuration and later  i receive
> soon a ClassNotFound from Query, think because it's
> RoundRobinLoadBalancingSpi... this lock and currupt my Global cluster until
> i'll will shutdown the karaf[2]...
> ClassNotFound is throw because karaf[2] has not completed boot sequence...
>
> have you any suggestion please?
> Devis
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Question-about-Class-Not-found-tp8685p8696.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>
>
>

Re: Question about Class Not found

Posted by Denis Magda <dm...@gridgain.com>.
Raul, could you assist with this issue?

—
Denis

> On Nov 3, 2016, at 8:39 AM, devis76 <de...@flexvalley.com> wrote:
> 
> Hi,
> i have found my problem, but i have no idea how to resolve.
> 
> Activator extends IgniteAbstractOsgiContextActivator
> @Override
> 	public IgniteConfiguration igniteConfiguration() {
> cfg.setPeerClassLoadingEnabled(false);
> 	RoundRobinLoadBalancingSpi spiRRLB = new RoundRobinLoadBalancingSpi();
> 		// Configure SPI to use global round-robin mode.
> 		spiRRLB.setPerTask(false);
> 		// Override default load balancing SPI.
> 		cfg.setLoadBalancingSpi(spiRRLB);
> }
> 
> 
> 
> 
> [1]First Karaf start it's ok!... my QueryCursor "cache.query(new
> SqlFieldsQuery("select * from ClientUpdate") 
> 
> 2)Second Karaf(same bundles/packages as [1],different Machine, when Start
> the first bundle is Cluster/Activator/Configuration and later  i receive
> soon a ClassNotFound from Query, think because it's
> RoundRobinLoadBalancingSpi... this lock and currupt my Global cluster until
> i'll will shutdown the karaf[2]...
> ClassNotFound is throw because karaf[2] has not completed boot sequence...
> 
> have you any suggestion please?
> Devis
> 
> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Question-about-Class-Not-found-tp8685p8696.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Question about Class Not found

Posted by devis76 <de...@flexvalley.com>.
Hi,
i have found my problem, but i have no idea how to resolve.

Activator extends IgniteAbstractOsgiContextActivator
@Override
	public IgniteConfiguration igniteConfiguration() {
cfg.setPeerClassLoadingEnabled(false);
	RoundRobinLoadBalancingSpi spiRRLB = new RoundRobinLoadBalancingSpi();
		// Configure SPI to use global round-robin mode.
		spiRRLB.setPerTask(false);
		// Override default load balancing SPI.
		cfg.setLoadBalancingSpi(spiRRLB);
}




[1]First Karaf start it's ok!... my QueryCursor "cache.query(new
SqlFieldsQuery("select * from ClientUpdate") 

2)Second Karaf(same bundles/packages as [1],different Machine, when Start
the first bundle is Cluster/Activator/Configuration and later  i receive
soon a ClassNotFound from Query, think because it's
RoundRobinLoadBalancingSpi... this lock and currupt my Global cluster until
i'll will shutdown the karaf[2]...
ClassNotFound is throw because karaf[2] has not completed boot sequence...

have you any suggestion please?
Devis



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Question-about-Class-Not-found-tp8685p8696.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.