Attaching ignite config. A failed code is a simple execution of hibernate
query. Here is bigger stacktrace:
Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast
to [Ljava.io.Serializable;
at
org.hibernate.cache.internal.StandardQueryCache.get(StandardQueryCache.java:189)
at org.hibernate.loader.Loader.getResultFromQueryCache(Loader.java:2587)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2495)
at org.hibernate.loader.Loader.list(Loader.java:2467)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502)
at
org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:384)
at
org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1490)
at
org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1445)
at
org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1414)
at org.hibernate.query.Query.getResultList(Query.java:146)
at
com.aaa.bbb.base.dataload.dao.GenericJpaQueryDAO.executeGenericQuery(GenericJpaQueryDAO.java:55)
For now I created 'dirty' workaround to continue with my testing:
org.apache.ignite.cache.hibernate.HibernateQueryResultsRegion#get
@Override
public Object get(SharedSessionContractImplementor
sharedSessionContractImplementor, Object key) throws CacheException {
Object result = super.get(sharedSessionContractImplementor, key);
if (result instanceof List) {
List list = (List) result;
if (list.size() > 1) {
for (int i = 1; i < list.size(); i++) {//first element in
list is id, skip it
Object row = list.get(i);
if (row != null && row.getClass().isArray())
{//convert Object[] to Serializable[]
Object[] rowArr = (Object[]) row;
list.set(i, Arrays.copyOf(rowArr, rowArr.length,
Serializable[].class));
}
}
}
}
return result;
}
On Mon, Jun 25, 2018 at 9:41 PM aealexsandrov <[email protected]>
wrote:
> Hi,
>
> Could you please provide some more details: cache configuration, an example
> of code that was failed and logs?
>
> BR,
> Andrei
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- Basic configuration for atomic cache. -->
<bean id="atomic-cache" class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
<property name="cacheMode" value="PARTITIONED"/>
<property name="atomicityMode" value="ATOMIC"/>
<property name="writeSynchronizationMode" value="FULL_SYNC"/>
</bean>
<!-- Basic configuration for transactional cache. -->
<bean id="transactional-cache" class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
<property name="cacheMode" value="PARTITIONED"/>
<property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="writeSynchronizationMode" value="FULL_SYNC"/>
</bean>
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!--
Specify the name of the caching grid (should correspond to the
one in Hibernate configuration).
-->
<property name="peerClassLoadingEnabled" value="true"/>
<property name="igniteInstanceName" value="hibernate-grid"/>
<property name="failureDetectionTimeout" value="120000"/>
<!--
Specify cache configuration for each L2 cache region (which corresponds
to a full class name or a full association name).
-->
<property name="cacheConfiguration">
<list>
<!--
Configurations for entity caches.
-->
<bean parent="transactional-cache">
<property name="name" value="default_cache"/>
</bean>
<!-- Configuration for update timestamps cache. -->
<bean parent="atomic-cache">
<property name="name" value="org.hibernate.cache.spi.UpdateTimestampsCache"/>
</bean>
<!-- Configuration for query result cache. -->
<bean parent="atomic-cache">
<property name="name" value="org.hibernate.cache.internal.StandardQueryCache"/>
</bean>
</list>
</property>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<!--<property name="localAddress" value="192.168.149.1"/>-->
<property name="joinTimeout" value="3000"/>
<property name="ipFinder">
<!--org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryVmIpFinder-->
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<!-- list of static IP addresses-->
<property name="addresses">
<list>
<!--
IP Address and optional port range.
You can also optionally specify an individual port.
-->
<!--<value>192.168.149.1</value>-->
<!--<value>perf_ignite01</value>-->
<value>127.0.0.1</value>
<!--<value>192.168.210.116</value>-->
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>