Forum Stats

  • 3,784,373 Users
  • 2,254,929 Discussions
  • 7,880,793 Comments

Discussions

Coherence 3.5 Sample CacheStore- Failed to instantiate class WebLogic 10gR3

User756798-Oracle
User756798-Oracle Member Posts: 8
edited Jul 14, 2009 12:01PM in Coherence Support
Greetings,

I am trying to configure a simple cache store based on documentation from (http://coherence.oracle.com/display/COH35UG/Sample+CacheStores) and deploy to WebLogic 10gR3.

Software -
1. Oracle Coherence Version 3.5/459, Grid Edition: Development mode
2. WebLogic 10gR3 with Jrockit - R27.6
3. Oracle Workshop for WebLogic, Version: 10.3

Steps to reproduce -
1. Create a EAR project in Eclipse.
2. Create a Dynamic Web Project within the EAR project.
3. Create a new WLS domain (Domain Home - D:\bea\wls10gr3\user_projects\domains\cache_domain) and add to Eclipse workspace.
4. Create a coherence-cache-config.xml file and place it under <DOMAIN_HOME>/lib
5. Update the setDomainEnv.cmd file with the following JAVA_OPTIONS - -Dtangosol.coherence.management=all -Dtangosol.coherence.cacheconfig=D:/bea/wls10gr3/user_projects/domains/cache_domain/lib/coherence-cache-config.xml -Dtangosol.coherence.log.level=9
6. Within the EAR project, copy <COHERENCE_HOME>/lib/coherence.jar to EarContent/APP-INF/lib
7. Copy <COHERENCE_HOME>\examples\jsp\explore\SimpleCacheExplorer.jsp to the WAR project WebContents directory.
8. Edit line that references VirtualCache to my "SampleCache" - NamedCache cache = CacheFactory.getCache("SampleCache");
9. Within the WAR project, create a java class under com.sample.common package.

Java Src Code
=========

package com.sample.common;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;

import com.tangosol.net.cache.CacheStore;
import com.tangosol.util.Base;

public class StateCacheManager extends Base implements CacheStore {


public void erase(Object arg0) {
// TODO Auto-generated method stub
System.out.println("StateCacheManager - CacheStore erase called.");
}

public void eraseAll(Collection arg0) {
// TODO Auto-generated method stub
System.out.println("StateCacheManager - CacheStore erase all called.");
}

public void store(Object arg0, Object arg1) {
// TODO Auto-generated method stub
System.out.println("StateCacheManager - CacheStore store called.");

}

public void storeAll(Map arg0) {
// TODO Auto-generated method stub
System.out.println("StateCacheManager - CacheStore store all called.");
}

public Object load(Object arg0) {
// TODO Auto-generated method stub
System.out.println("StateCacheManager - CacheStore load called.");
return null;
}

public Map loadAll(Collection arg0) {
// TODO Auto-generated method stub
System.out.println("StateCacheManager - CacheStore load all called.");
return null;
}
}

10. Deploy the application and start WLS, access the JSP, which results in the following error -

WebLogic log
=========

JAVA Memory arguments: -Xms256m -Xmx512m
.
WLS Start Mode=Development
.
CLASSPATH=;D:\bea\wls10gr3\patch_wlw1030\profiles\default\sys_manifest_classpath\weblogic_patch.jar;D:\bea\wls10gr3\patch_wls1030\profiles\default\sys_manifest_classpath\weblogic_patch.jar;D:\bea\wls10gr3\patch_cie660\profiles\default\sys_manifest_classpath\weblogic_patch.jar;D:\bea\wls10gr3\JROCKI~1\lib\tools.jar;D:\bea\wls10gr3\WLSERV~1.3\server\lib\weblogic_sp.jar;D:\bea\wls10gr3\WLSERV~1.3\server\lib\weblogic.jar;D:\bea\wls10gr3\modules\features\weblogic.server.modules_10.3.0.0.jar;D:\bea\wls10gr3\WLSERV~1.3\server\lib\webservices.jar;D:\bea\wls10gr3\modules\ORGAPA~1.5/lib/ant-all.jar;D:\bea\wls10gr3\modules\NETSFA~1.0_1/lib/ant-contrib.jar;;D:\bea\wls10gr3\WLSERV~1.3\common\eval\pointbase\lib\pbclient57.jar;D:\bea\wls10gr3\WLSERV~1.3\server\lib\xqrl.jar;;
.
PATH=D:\bea\wls10gr3\patch_wlw1030\profiles\default\native;D:\bea\wls10gr3\patch_wls1030\profiles\default\native;D:\bea\wls10gr3\patch_cie660\profiles\default\native;D:\bea\wls10gr3\WLSERV~1.3\server\native\win\32;D:\bea\wls10gr3\WLSERV~1.3\server\bin;D:\bea\wls10gr3\modules\ORGAPA~1.5\bin;D:\bea\wls10gr3\JROCKI~1\jre\bin;D:\bea\wls10gr3\JROCKI~1\bin;D:\bea\wls10gr3\jrockit_160_05\jre\bin;C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\Program Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\Common Files\DivX Shared\;D:\Program Files\MySQL\MySQL Server 5.1\bin;D:\bea\wls10gr3\WLSERV~1.3\server\native\win\32\oci920_8
.
***************************************************
* To start WebLogic Server, use a username and *
* password assigned to an admin-level user. For *
* server administration, use the WebLogic Server *
* console at http:\\hostname:port\console *
***************************************************
starting weblogic with Java version:
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
BEA JRockit(R) (build R27.6.0-50_o-100423-1.6.0_05-20080626-2105-windows-ia32, compiled mode)
Starting WLS with line:
D:\bea\wls10gr3\JROCKI~1\bin\java -jrockit -Xms256m -Xmx512m -Xverify:none -da -Dplatform.home=D:\bea\wls10gr3\WLSERV~1.3 -Dwls.home=D:\bea\wls10gr3\WLSERV~1.3\server -Dweblogic.home=D:\bea\wls10gr3\WLSERV~1.3\server -Dweblogic.management.discover=true -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=D:\bea\wls10gr3\patch_wlw1030\profiles\default\sysext_manifest_classpath;D:\bea\wls10gr3\patch_wls1030\profiles\default\sysext_manifest_classpath;D:\bea\wls10gr3\patch_cie660\profiles\default\sysext_manifest_classpath -Dtangosol.coherence.management=all -Dtangosol.coherence.cacheconfig=D:/bea/wls10gr3/user_projects/domains/cache_domain/lib/coherence-cache-config.xml -Dtangosol.coherence.log.level=9 -Dweblogic.Name=AdminServer -Djava.security.policy=D:\bea\wls10gr3\WLSERV~1.3\server\lib\weblogic.policy weblogic.Server
<Jul 14, 2009 9:25:33 AM CDT> <Notice> <WebLogicServer> <BEA-000395> <Following extensions directory contents added to the end of the classpath:
D:\bea\wls10gr3\patch_wls1030\profiles\default\sysext_manifest_classpath\weblogic_ext_patch.jar>
<Jul 14, 2009 9:25:34 AM CDT> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with BEA JRockit(R) Version R27.6.0-50_o-100423-1.6.0_05-20080626-2105-windows-ia32 from BEA Systems, Inc.>
<Jul 14, 2009 9:25:34 AM CDT> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3 Fri Jul 25 16:30:05 EDT 2008 1137967 >
<Jul 14, 2009 9:25:36 AM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
<Jul 14, 2009 9:25:36 AM CDT> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool>
<Jul 14, 2009 9:25:36 AM CDT> <Notice> <Log Management> <BEA-170019> <The server log file D:\bea\wls10gr3\user_projects\domains\cache_domain\servers\AdminServer\logs\AdminServer.log is opened. All server side log events will be written to this file.>
<Jul 14, 2009 9:25:40 AM CDT> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
<Jul 14, 2009 9:25:44 AM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY>
<Jul 14, 2009 9:25:44 AM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
<Jul 14, 2009 9:25:45 AM CDT> <Notice> <Log Management> <BEA-170027> <The Server has established connection with the Domain level Diagnostic Service successfully.>
<Jul 14, 2009 9:25:46 AM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN>
<Jul 14, 2009 9:25:46 AM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING>
<Jul 14, 2009 9:25:46 AM CDT> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.>
<Jul 14, 2009 9:25:46 AM CDT> <Notice> <WebLogicServer> <BEA-000331> <Started WebLogic Admin Server "AdminServer" for domain "cache_domain" running in Development Mode>
<Jul 14, 2009 9:25:46 AM CDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Jul 14, 2009 9:25:46 AM CDT> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
2009-07-14 09:25:51.375/18.500 Oracle Coherence 3.5/459 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded operational configuration from resource "zip:D:/bea/wls10gr3/user_projects/workspaces/coherence/SampleEar/EarContent/APP-INF/lib/coherence.jar!/tangosol-coherence.xml"
2009-07-14 09:25:51.391/18.516 Oracle Coherence 3.5/459 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded operational overrides from resource "zip:D:/bea/wls10gr3/user_projects/workspaces/coherence/SampleEar/EarContent/APP-INF/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
2009-07-14 09:25:51.391/18.516 Oracle Coherence 3.5/459 <D5> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified
2009-07-14 09:25:51.391/18.516 Oracle Coherence 3.5/459 <D5> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified
2009-07-14 09:25:51.406/18.531 Oracle Coherence 3.5/459 <D6> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded edition data from "zip:D:/bea/wls10gr3/user_projects/workspaces/coherence/SampleEar/EarContent/APP-INF/lib/coherence.jar!/coherence-grid.xml"

Oracle Coherence Version 3.5/459
Grid Edition: Development mode
Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.

2009-07-14 09:25:51.797/18.922 Oracle Coherence GE 3.5/459 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded cache configuration from resource "zip:D:/bea/wls10gr3/user_projects/workspaces/coherence/SampleEar/EarContent/APP-INF/lib/coherence.jar!/reports/report-group.xml"
2009-07-14 09:25:51.844/18.969 Oracle Coherence GE 3.5/459 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded cache configuration from file "D:\bea\wls10gr3\user_projects\domains\cache_domain\lib\coherence-cache-config.xml"
2009-07-14 09:25:52.906/20.031 Oracle Coherence GE 3.5/459 <D5> (thread=Cluster, member=n/a): Service Cluster joined the cluster with senior service member n/a
2009-07-14 09:25:56.188/23.313 Oracle Coherence GE 3.5/459 <Info> (thread=Cluster, member=n/a): Created a new cluster "cluster:0xD7DB" with Member(Id=1, Timestamp=2009-07-14 09:25:52.594, Address=166.183.96.211:8088, MachineId=29139, Location=site:us.oracle.com,machine:dkrishna-lap,process:3140, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=1) UID=0xA6B760D30000012279A7BFD271D31F98
2009-07-14 09:25:56.406/23.531 Oracle Coherence GE 3.5/459 <D5> (thread=Invocation:Management, member=1): Service Management joined the cluster with senior service member 1
2009-07-14 09:25:56.828/23.953 Oracle Coherence GE 3.5/459 <D5> (thread=DistributedCache, member=1): Service DistributedCache joined the cluster with senior service member 1
2009-07-14 09:25:56.969/24.094 Oracle Coherence GE 3.5/459 <Error> (thread=DistributedCache, member=1): BackingMapManager com.tangosol.net.DefaultConfigurableCacheFactory$Manager: failed to instantiate a cache: SampleCache
2009-07-14 09:25:56.969/24.094 Oracle Coherence GE 3.5/459 <Error> (thread=DistributedCache, member=1):
(Wrapped: Failed to instantiate class "com.sample.common.StateCacheManager" using [email protected] finder: [email protected] annotation: [email protected]
<class-scheme>
<class-name>com.sample.common.StateCacheManager</class-name>
<init-params>
<init-param>
<param-type>java.lang.String</param-type>
<param-value>SampleCache</param-value>
</init-param>
</init-params>
</class-scheme>) java.lang.InstantiationException
at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2268)
at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(DefaultConfigurableCacheFactory.java:2833)
at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:2696)
at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1332)
at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1097)
at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:3235)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.instantiateResourceMap(DistributedCache.CDB:22)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$Storage.setCacheName(DistributedCache.CDB:27)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConfigListener.entryInserted(DistributedCache.CDB:15)
at com.tangosol.util.MapEvent.dispatch(MapEvent.java:191)
at com.tangosol.util.MapEvent.dispatch(MapEvent.java:164)
at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
at com.tangosol.util.ObservableHashMap.dispatchEvent(ObservableHashMap.java:229)
at com.tangosol.util.ObservableHashMap$Entry.onAdd(ObservableHashMap.java:270)
at com.tangosol.util.SafeHashMap.put(SafeHashMap.java:244)
at com.tangosol.coherence.component.util.collections.WrapperMap.put(WrapperMap.CDB:1)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$ServiceConfigMap.put(Grid.CDB:31)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$StorageIdRequest.onReceived(DistributedCache.CDB:45)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:9)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:136)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache.onNotify(DistributedCache.CDB:3)
at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:37)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.InstantiationException
at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:677)
at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2258)
... 22 more

coherence-cache-config.xml
=================

<?xml version="1.0"?>
<!DOCTYPE cache-config SYSTEM "cache-config.dtd">
<cache-config>
<caching-scheme-mapping>
<!--
Caches with any name will be created as default replicated.
-->
<cache-mapping>
<cache-name>SampleCache</cache-name>
<scheme-name>sample-rwbs</scheme-name>
</cache-mapping>
</caching-scheme-mapping>

<caching-schemes>

<distributed-scheme>
<scheme-name>sample-rwbs</scheme-name>
<backing-map-scheme>
<read-write-backing-map-scheme>

<internal-cache-scheme>
<local-scheme />
</internal-cache-scheme>

<cachestore-scheme>
<class-scheme>
<class-name>
com.sample.common.StateCacheManager
</class-name>
<init-params>
<init-param>
<param-type>
java.lang.String
</param-type>
<param-value>
SampleCache
</param-value>
</init-param>
</init-params>
</class-scheme>
</cachestore-scheme>
</read-write-backing-map-scheme>
</backing-map-scheme>
</distributed-scheme>


<!--
Default Replicated caching scheme.
-->
<replicated-scheme>
<scheme-name>default-replicated</scheme-name>
<service-name>ReplicatedCache</service-name>
<backing-map-scheme>
<class-scheme>
<scheme-ref>default-backing-map</scheme-ref>
</class-scheme>
</backing-map-scheme>
</replicated-scheme>
<!--
Default Distributed caching scheme.
-->
<distributed-scheme>
<scheme-name>default-distributed</scheme-name>
<service-name>DistributedCache</service-name>
<backing-map-scheme>
<local-scheme>
<scheme-ref>default-eviction</scheme-ref>
<eviction-policy>LRU</eviction-policy>
<high-units>1000</high-units>
<expiry-delay>60</expiry-delay>
</local-scheme>
</backing-map-scheme>
</distributed-scheme>
<!--
Default backing map scheme definition used by all
The caches that do not require any eviction policies
-->
<class-scheme>
<scheme-name>default-backing-map</scheme-name>
<class-name>com.tangosol.util.SafeHashMap</class-name>
</class-scheme>
<!--
Default eviction policy scheme.
-->
<local-scheme>
<scheme-name>default-eviction</scheme-name>
<eviction-policy>HYBRID</eviction-policy>
<high-units>0</high-units>
<expiry-delay>3600</expiry-delay>
</local-scheme>
</caching-schemes>
</cache-config>

I have tried the sample configuration with Coherence 3.4 and ran into the same issue. So this must be a newbe error on my part.

Thx in advance!

Best Answer

  • drakitine
    drakitine Member Posts: 158
    Accepted Answer
    Hi user756798,

    In your cache configuration descriptor you did specify cachestore init parameter, but StateCacheManager does not implement corresponding constructor. If you change it to
    package com.sample.common;
    
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Map;
    
    import com.tangosol.net.cache.CacheStore;
    import com.tangosol.util.Base;
    
    public class StateCacheManager extends Base implements CacheStore
        {
    
        public StateCacheManager(String sParam)
            {
            // ... do something with the init parameter ...
            }
    
        public void erase(Object arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore erase called.");
            }
    
        public void eraseAll(Collection arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore erase all called.");
            }
    
        public void store(Object arg0, Object arg1)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore store called.");
    
            }
    
        public void storeAll(Map arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore store all called.");
            }
    
        public Object load(Object arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore load called.");
            return null;
            }
    
        public Map loadAll(Collection arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore load all called.");
            return null;
            }
        }
    it will work.

    Regards,
    Dimitri

Answers

  • drakitine
    drakitine Member Posts: 158
    Accepted Answer
    Hi user756798,

    In your cache configuration descriptor you did specify cachestore init parameter, but StateCacheManager does not implement corresponding constructor. If you change it to
    package com.sample.common;
    
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Map;
    
    import com.tangosol.net.cache.CacheStore;
    import com.tangosol.util.Base;
    
    public class StateCacheManager extends Base implements CacheStore
        {
    
        public StateCacheManager(String sParam)
            {
            // ... do something with the init parameter ...
            }
    
        public void erase(Object arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore erase called.");
            }
    
        public void eraseAll(Collection arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore erase all called.");
            }
    
        public void store(Object arg0, Object arg1)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore store called.");
    
            }
    
        public void storeAll(Map arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore store all called.");
            }
    
        public Object load(Object arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore load called.");
            return null;
            }
    
        public Map loadAll(Collection arg0)
            {
    // TODO Auto-generated method stub
            System.out.println("StateCacheManager - CacheStore load all called.");
            return null;
            }
        }
    it will work.

    Regards,
    Dimitri
  • THX Dimitri, you got Hawk eyes!

    Its working now :)
This discussion has been closed.