[infinispan-issues] [JBoss JIRA] (ISPN-5457) Infinispan with Wildfly 8.2 random fails using key2StringMapper

Flemming Harms (JIRA) issues at jboss.org
Tue May 12 08:22:20 EDT 2015


Flemming Harms created ISPN-5457:
------------------------------------

             Summary: Infinispan with Wildfly 8.2 random fails using key2StringMapper
                 Key: ISPN-5457
                 URL: https://issues.jboss.org/browse/ISPN-5457
             Project: Infinispan
          Issue Type: Bug
          Components: Core
    Affects Versions: 6.0.2.Final
         Environment: OSX Yosemite, Wildfly 8.2
            Reporter: Flemming Harms


Using JDBC string based store feature in combination with customize key2string mapper fails random with the error below. I track it down to be an issue in XmlConfigHelper when it call the “setValues” and iterate through the method names. The problem is if you have a class that overload methods, like it is with “JdbcStringBasedStoreConfigurationBuilder key2StringMapper(....)”, there is no guarantee it will choose the “key2StringMapper(String key2StringMapper)”

*code snippets :*
{noformat}
for (Method m : objectClass.getMethods()) {
   if (setter.equals(m.getName()) || fluentSetter.equals(m.getName())) {
           Class<?> paramTypes[] = m.getParameterTypes();
       if (paramTypes.length != 1) {
          log.tracef("Rejecting setter %s on class %s due to incorrect number of parameters", m, objectClass);
          continue; // try another param with the same name.
          }

       Class<?> parameterType = paramTypes[0];
              
       PropertyEditor editor = PropertyEditorManager.findEditor(parameterType);
       if (editor == null) {
           throw new CacheConfigurationException("Couldn't find a property editor for parameter type " + parameterType);
       }
          editor.setAsText((String) attribs.get(propName));
…
}
{noformat}
*Suggested patch :*
{noformat}
 diff --git a/core/src/main/java/org/infinispan/configuration/parsing/XmlConfigHelper.java b/core/src/main/java/org/infinispan/configuration/parsing/XmlConfigHelper.java
index 5305e82..377f315 100644
--- a/core/src/main/java/org/infinispan/configuration/parsing/XmlConfigHelper.java
+++ b/core/src/main/java/org/infinispan/configuration/parsing/XmlConfigHelper.java
@@ -425,6 +425,11 @@ public static void setValues(Object target, Map<?, ?> attribs, boolean isXmlAttr
                }
 
                Class<?> parameterType = paramTypes[0];
+               
+               if (parameterType.equals(Class.class)) {
+                  log.tracef("Rejecting setter %s on class %s due to class parameter is type class", m, objectClass);
+                   continue; // try another param with the same name. 
+               }
                PropertyEditor editor = PropertyEditorManager.findEditor(parameterType);
                if (editor == null) {
                   throw new CacheConfigurationException("Couldn't find a property editor for parameter type " + parameterType);
{noformat}

*Configuration wildfly 8.2 standanlone.xml snippets :*
{noformat}
<replicated-cache name="LuceneIndexesData" start="EAGER" mode="SYNC" remote-timeout="25000">
                    <locking isolation="READ_COMMITTED" striping="false" acquire-timeout="330000" concurrency-level="500"/>
                    <transaction mode="NONE"/>
                    <eviction strategy="NONE" max-entries="-1"/>
                    <expiration max-idle="-1"/>
                    <state-transfer enabled="true" timeout="480000"/>
                    <string-keyed-jdbc-store preload="true" passivation="false" fetch-state="true" singleton="true" datasource="java:jboss/datasources/PostgresDS" dialect="POSTGRES">
                        <write-behind/>
                        <property name="key2StringMapper">
                            org.infinispan.lucene.LuceneKey2StringMapper
                        </property>
                        <string-keyed-table>
                            <id-column name="ID_COLUMN" type="VARCHAR(255)"/>
                            <data-column name="DATA_COLUMN" type="bytea"/>
                            <timestamp-column name="TIMESTAMP_COLUMN" type="BIGINT"/>
                        </string-keyed-table>
                    </string-keyed-jdbc-store>
                    <indexing index="NONE"/>
</replicated-cache>
{noformat}

*Stacktrace :*
{noformat}
18:32:55,218 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 36) JBAS014612: Operation ("add") failed - address: ([
    ("subsystem" => "infinispan"),
    ("cache-container" => "hibernate-search"),
    ("replicated-cache" => "LuceneIndexesMetadata")
]): org.infinispan.commons.CacheConfigurationException: Couldn't find a property editor for parameter type class java.lang.Class
    at org.infinispan.configuration.parsing.XmlConfigHelper.setValues(XmlConfigHelper.java:430)
    at org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder.withProperties(AbstractStoreConfigurationBuilder.java:91)
    at org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder.withProperties(AbstractStoreConfigurationBuilder.java:9)
    at org.jboss.as.clustering.infinispan.subsystem.CacheAdd.processModelNode(CacheAdd.java:551)
    at org.jboss.as.clustering.infinispan.subsystem.ClusteredCacheAdd.processModelNode(ClusteredCacheAdd.java:69)
    at org.jboss.as.clustering.infinispan.subsystem.SharedStateCacheAdd.processModelNode(SharedStateCacheAdd.java:50)
    at org.jboss.as.clustering.infinispan.subsystem.CacheAdd.installRuntimeServices(CacheAdd.java:207)
    at org.jboss.as.clustering.infinispan.subsystem.CacheAdd.performRuntime(CacheAdd.java:181)
    at org.jboss.as.controller.AbstractAddStepHandler$1.execute(AbstractAddStepHandler.java:75)
    at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:660)
    at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:501)
    at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:298)
    at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:293)
    at org.jboss.as.controller.ParallelBootOperationStepHandler$ParallelBootTask.run(ParallelBootOperationStepHandler.java:354)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_40]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_40]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)

{noformat}





--
This message was sent by Atlassian JIRA
(v6.3.15#6346)



More information about the infinispan-issues mailing list