7 Replies Latest reply on Mar 25, 2012 10:57 AM by Jonathan.Knight

    Missing/inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore

    918154
      help me to resolve this error. what is it mean? how can i resolve it. it says java.lang.ClassNotFoundException: com.oracle.handson.Employees but it has been created already.


      (Wrapped: Missing or inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore(String,String,String)"
      <class-scheme>
      <class-name>com.tangosol.coherence.jpa.JpaCacheStore</class-name>
      <init-params>
      <!--
      This param is the entity name
      This param is the fully qualified entity class
      This param should match the value of the
      persistence unit name in persistence.xml
      -->
      <init-param>
      <param-type>java.lang.String</param-type>
      <param-value>Employees</param-value>
      </init-param>
      <init-param>
      <param-type>java.lang.String</param-type>
      <param-value>com.oracle.handson.Employees</param-value>
      </init-param>
      <init-param>
      <param-type>java.lang.String</param-type>
      <param-value>JPA</param-value>
      </init-param>
      </init-params>
      </class-scheme>) java.lang.reflect.InvocationTargetException
           at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
           at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2542)
           at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2426)
           at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(DefaultConfigurableCacheFactory.java:3256)
           at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:3106)
           at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1674)
           at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1429)
           at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:3904)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.instantiateResourceMap(PartitionedCache.CDB:22)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.setCacheName(PartitionedCache.CDB:25)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ServiceConfig$ConfigListener.entryInserted(PartitionedCache.CDB:17)
           at com.tangosol.util.MapEvent.dispatch(MapEvent.java:266)
           at com.tangosol.util.MapEvent.dispatch(MapEvent.java:226)
           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.ServiceConfig$Map.put(ServiceConfig.CDB:43)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$StorageIdRequest.onReceived(PartitionedCache.CDB:45)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:11)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:33)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService.onNotify(PartitionedService.CDB:3)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onNotify(PartitionedCache.CDB:3)
           at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
           at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.reflect.InvocationTargetException
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
           at java.lang.reflect.Constructor.newInstance(Unknown Source)
           at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:662)
           at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2501)
           ... 23 more
      Caused by: (Wrapped: Class com.oracle.handson.Employees could not be loaded) java.lang.ClassNotFoundException: com.oracle.handson.Employees
           at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
           at com.tangosol.coherence.jpa.JpaCacheLoader.initialize(JpaCacheLoader.java:147)
           at com.tangosol.coherence.jpa.JpaCacheLoader.<init>(JpaCacheLoader.java:49)
           at com.tangosol.coherence.jpa.JpaCacheStore.<init>(JpaCacheStore.java:44)
           ... 29 more
      Caused by: java.lang.ClassNotFoundException: com.oracle.handson.Employees
           at java.net.URLClassLoader$1.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at java.net.URLClassLoader.findClass(Unknown Source)
           at java.lang.ClassLoader.loadClass(Unknown Source)
           at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
           at java.lang.ClassLoader.loadClass(Unknown Source)
           at com.tangosol.coherence.jpa.JpaCacheLoader.initialize(JpaCacheLoader.java:143)
           ... 31 more
      Exception in thread "main" java.lang.NullPointerException
           at com.handson.oracle.RunEmployeeExample.main(RunEmployeeExample.java:22)
      thanks in advance
        • 1. Re: Missing/inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore
          Jonathan.Knight
          So com.oracle.handson.Employees is definitely on the classpath of the process? There are not really many other causes of ClassNotFoundException.

          JK
          • 2. Re: Missing/inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore
            918154
            yes it seems , i have gone through other post and some one mention to set local store to set false and it seems work for him. how you can set this?
            • 3. Re: Missing/inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore
              Jonathan.Knight
              Presumably you mean he set -Dtangosol.coherence.distributed.localstorage=false in his System properties. I'm not sure that will help, unless the JVM throwing the exception is supposed to be a storage disabled member of the cluster.

              JK
              • 4. Re: Missing/inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore
                918154
                You were right, this wasnt a solution. i found some of warning which can cause class not found but not sure how to resolve it.
                Description     Resource     Path     Location     Type
                Classpath entry org.eclipse.datatools.connectivity.jdt.DRIVERLIBRARY/Oracle Database 10g Driver Default will not be exported or published. Runtime ClassNotFoundExceptions may result.      JPADemostration          P/JPADemostration     Classpath Dependency Validator Message

                Description     Resource     Path     Location     Type
                Classpath entry org.eclipse.jdt.USER_LIBRARY/Coherence36 is marked for publish/export but is not exported on the project classpath. Classpath visibility within Eclipse and at runtime will differ.     JPADemostration          P/JPADemostration     Classpath Dependency Validator Message

                Description     Resource     Path     Location     Type
                The file cannot be validated as the XML definition "C:\Documents and Settings\amkothi\workspace\JPADemostration\src\cache-config.dtd (The system cannot find the file specified)" that is specified as describing the syntax of the file cannot be located.     jpa-cache-config.xml     /JPADemostration/src     line 2     XML Problem
                • 5. Re: Missing/inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore
                  918154
                  Fond solution modify with this jpa-config.xml and reload coherence-jpa.jar and it works fine.
                  <?xml version="1.0" ?>
                  <cache-config>

                  <caching-scheme-mapping>

                  <cache-mapping>
                  <!-- Set the name of the cache to be the entity name -->
                  <cache-name>Employees</cache-name>
                  <!-- Configure this cache to use the scheme defined below -->

                  <scheme-name>jpa-distributed</scheme-name>
                  </cache-mapping>

                  </caching-scheme-mapping>

                  <caching-schemes>

                  <distributed-scheme>

                  <scheme-name>jpa-distributed</scheme-name>
                  <service-name>JpaDistributedCache</service-name>

                  <backing-map-scheme>
                  <read-write-backing-map-scheme>

                  <internal-cache-scheme>
                  <local-scheme/>
                  </internal-cache-scheme>
                            
                            <!-- Define the cache scheme -->     
                  <cachestore-scheme>
                  <class-scheme>
                  <class-name>
                  com.tangosol.coherence.jpa.JpaCacheStore
                  </class-name>
                  <init-params>

                                      <!-- This param is the entity name -->
                  <init-param>
                  <param-type>java.lang.String</param-type>
                  <param-value>{cache-name}</param-value>
                  </init-param>
                                      
                                      <!-- This param is the fully qualified entity class -->
                  <init-param>
                  <param-type>java.lang.String</param-type>
                  <param-value>com.handson.oracle.{cache-name}</param-value>
                  </init-param>

                                      <!-- This param should match the value of the -->
                                      <!-- persistence unit name in persistence.xml -->
                  <init-param>
                  <param-type>java.lang.String</param-type>
                  <param-value>JPADemo</param-value>
                  </init-param>

                  </init-params>
                  </class-scheme>
                  </cachestore-scheme>

                  </read-write-backing-map-scheme>
                  </backing-map-scheme>

                  </distributed-scheme>

                  </caching-schemes>

                  </cache-config>
                  • 6. Re: Missing/inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore
                    926159
                    Guys I am still getting ths error :
                    2012-03-25 09:40:20.748/9.146 Oracle Coherence GE 3.7.1.1 <Error> (thread=DistributedCache:JpaDistributedCache, member=1): BackingMapManager com.tangosol.net.DefaultConfigurableCacheFactory$Manager: failed to instantiate a cache: Employees
                    2012-03-25 09:40:20.748/9.146 Oracle Coherence GE 3.7.1.1 <Error> (thread=DistributedCache:JpaDistributedCache, member=1):
                    (Wrapped: Missing or inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore(String,String,String)"
                    <class-scheme>
                    <class-name>com.tangosol.coherence.jpa.JpaCacheStore</class-name>
                    <init-params>
                    <!--
                    This param is the entity name
                    This param is the fully qualified entity class
                    This param should match the value of the
                    persistence unit name in persistence.xml
                    -->
                    <init-param>
                    <param-type>java.lang.String</param-type>
                    <param-value>Employees</param-value>
                    </init-param>
                    <init-param>
                    <param-type>java.lang.String</param-type>
                    <param-value>com.sample.jpa.entity.Employees</param-value>
                    </init-param>
                    <init-param>
                    <param-type>java.lang.String</param-type>
                    <param-value>JPAWithCoherence</param-value>
                    </init-param>
                    </init-params>
                    </class-scheme>) java.lang.reflect.InvocationTargetException
                         at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
                         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2652)
                         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2536)
                         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateAny(DefaultConfigurableCacheFactory.java:3476)
                         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateCacheStore(DefaultConfigurableCacheFactory.java:3324)
                         at com.tangosol.net.DefaultConfigurableCacheFactory.instantiateReadWriteBackingMap(DefaultConfigurableCacheFactory.java:1753)
                         at com.tangosol.net.DefaultConfigurableCacheFactory.configureBackingMap(DefaultConfigurableCacheFactory.java:1500)
                         at com.tangosol.net.DefaultConfigurableCacheFactory$Manager.instantiateBackingMap(DefaultConfigurableCacheFactory.java:4111)
                         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.instantiateBackingMap(PartitionedCache.CDB:23)
                         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.setCacheName(PartitionedCache.CDB:25)
                         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ServiceConfig$ConfigListener.entryInserted(PartitionedCache.CDB:17)
                         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:266)
                         at com.tangosol.util.MapEvent.dispatch(MapEvent.java:226)
                         at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:567)
                         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.ServiceConfig$Map.put(ServiceConfig.CDB:43)
                         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$StorageIdRequest.onReceived(PartitionedCache.CDB:45)
                         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:34)
                         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:33)
                         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService.onNotify(PartitionedService.CDB:3)
                         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onNotify(PartitionedCache.CDB:3)
                         at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
                         at java.lang.Thread.run(Thread.java:662)
                    Caused by: java.lang.reflect.InvocationTargetException
                         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                         at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:694)
                         at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2611)
                         ... 23 more
                    Caused by: java.lang.NoClassDefFoundError: javax/persistence/Persistence
                         at com.tangosol.coherence.jpa.JpaCacheLoader.initialize(JpaCacheLoader.java:160)
                         at com.tangosol.coherence.jpa.JpaCacheLoader.<init>(JpaCacheLoader.java:49)
                         at com.tangosol.coherence.jpa.JpaCacheStore.<init>(JpaCacheStore.java:44)
                         ... 29 more
                    Caused by: java.lang.ClassNotFoundException: javax.persistence.Persistence
                         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
                         at java.security.AccessController.doPrivileged(Native Method)
                         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
                         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
                         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
                         ... 32 more
                    2012-03-25 09:40:20.779/9.177 Oracle Coherence GE 3.7.1.1 <D5> (thread=Cluster, member=1): TcpRing disconnected from Member(Id=2, Timestamp=2012-03-25 09:40:20.419, Address=192.168.1.2:8090, MachineId=42582, Location=site:,machine:Nisha-PC,process:6160, Role=SampleJpaUtilRunEmployeeExample) due to a peer departure; removing the member.
                    • 7. Re: Missing/inaccessible constructor "com.tangosol.coherence.jpa.JpaCacheStore
                      Jonathan.Knight
                      Hi,

                      If you look at the bottom cause in the stack trace you will see Caused by: java.lang.ClassNotFoundException: javax.persistence.Persistence which means you have a jar file missing off of the classpath.

                      JK