4 Replies Latest reply: Jun 26, 2012 1:06 PM by dvohra21 RSS

    JPA with Coherence

    878913
      Hi All i am working on JPA with coherence concept , i want to put the data into the database through the coherence , when ever i shutdown the database the has to sit in the coherence. how do i approach to this help me....
        • 1. Re: JPA with Coherence
          dvohra21
          http://docs.oracle.com/cd/E24290_01/coh.371/e22622/usejpa.htm
          http://docs.oracle.com/cd/E14526_01/coh.350/e14537/configforjpa.htm
          • 2. Re: JPA with Coherence
            878913
            hi thnks for reply , i done jpa coherence same thing which was given in docs but i got following error..

            how to solve this error..help me

            D:\Oracle\Middleware\jdk160_21\bin\javaw.exe -client -classpath C:\JDeveloper\mywork\Laxman\.adf;C:\JDeveloper\mywork\Laxman\Lab1\classes;D:\Database\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;D:\Database\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14_g.jar;C:\JDeveloper\mywork;D:\Oracle\Middleware\coherence_3.6\lib\coherence.jar;D:\Oracle\Middleware\coherence_3.6\lib\coherence-jpa.jar;D:\Oracle\Middleware\coherence_3.6\lib\coherence-toplink.jar;D:\Oracle\Middleware\coherence_3.6\lib\je.jar;D:\Oracle\Middleware\modules\com.oracle.toplink_1.0.0.0_11-1-1-4-0.jar;D:\Oracle\Middleware\modules\org.eclipse.persistence_1.0.0.0_2-1.jar;D:\Oracle\Middleware\modules\com.bea.core.antlr.runtime_2.7.7.jar;D:\Oracle\Middleware\oracle_common\modules\oracle.toplink_11.1.1\javax.persistence_2.0_preview.jar;D:\Oracle\Middleware\oracle_common\modules\oracle.xdk_11.1.0\xmlparserv2.jar;D:\Oracle\Middleware\oracle_common\modules\oracle.xdk_11.1.0\xml.jar;D:\Oracle\Middleware\modules\javax.jsf_1.1.0.0_1-2.jar;D:\Oracle\Middleware\modules\javax.ejb_3.0.1.jar;D:\Oracle\Middleware\modules\javax.enterprise.deploy_1.2.jar;D:\Oracle\Middleware\modules\javax.interceptor_1.0.jar;D:\Oracle\Middleware\modules\javax.jms_1.1.1.jar;D:\Oracle\Middleware\modules\javax.jsp_1.2.0.0_2-1.jar;D:\Oracle\Middleware\modules\javax.jws_2.0.jar;D:\Oracle\Middleware\modules\javax.activation_1.1.0.0_1-1.jar;D:\Oracle\Middleware\modules\javax.mail_1.1.0.0_1-4-1.jar;D:\Oracle\Middleware\modules\javax.xml.soap_1.3.1.0.jar;D:\Oracle\Middleware\modules\javax.xml.rpc_1.2.1.jar;D:\Oracle\Middleware\modules\javax.xml.ws_2.1.1.jar;D:\Oracle\Middleware\modules\javax.management.j2ee_1.0.jar;D:\Oracle\Middleware\modules\javax.resource_1.5.1.jar;D:\Oracle\Middleware\modules\javax.servlet_1.0.0.0_2-5.jar;D:\Oracle\Middleware\modules\javax.transaction_1.0.0.0_1-1.jar;D:\Oracle\Middleware\modules\javax.xml.stream_1.1.1.0.jar;D:\Oracle\Middleware\modules\javax.security.jacc_1.0.0.0_1-1.jar;D:\Oracle\Middleware\modules\javax.xml.registry_1.0.0.0_1-0.jar;D:\Oracle\Middleware\modules\javax.persistence_1.0.0.0_1-0-2.jar;D:\Oracle\Middleware\coherence_3.6;D:\Oracle\Middleware\coherence_3.6\lib\commonj.jar -Djavax.net.ssl.trustStore=D:\Oracle\Middleware\wlserver_10.3\server\lib\DemoTrust.jks -Dtangosol.coherence.cacheconfig=C:/JDeveloper/mywork/Laxman/Lab1/coherence-cache-config.xml com.coherence.Coherencecache
            2012-06-09 14:46:02.000/0.230 Oracle Coherence 3.6.0.4 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/D:/Oracle/Middleware/coherence_3.6/lib/coherence.jar!/tangosol-coherence.xml"
            2012-06-09 14:46:02.003/0.233 Oracle Coherence 3.6.0.4 <Info> (thread=main, member=n/a): Loaded operational overrides from "jar:file:/D:/Oracle/Middleware/coherence_3.6/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
            2012-06-09 14:46:02.004/0.234 Oracle Coherence 3.6.0.4 <D5> (thread=main, member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified
            2012-06-09 14:46:02.007/0.237 Oracle Coherence 3.6.0.4 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified

            Oracle Coherence Version 3.6.0.4 Build 19111
            Grid Edition: Development mode
            Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

            2012-06-09 14:46:02.157/0.387 Oracle Coherence GE 3.6.0.4 <Info> (thread=main, member=n/a): Loaded cache configuration from "file:/C:/JDeveloper/mywork/Laxman/Lab1/coherence-cache-config.xml"
            2012-06-09 14:46:02.662/0.892 Oracle Coherence GE 3.6.0.4 <D4> (thread=main, member=n/a): TCMP bound to /172.16.30.79:8088 using SystemSocketProvider
            2012-06-09 14:46:06.128/4.358 Oracle Coherence GE 3.6.0.4 <Info> (thread=Cluster, member=n/a): Created a new cluster "cluster:0xC4DB" with Member(Id=1, Timestamp=2012-06-09 14:46:02.701, Address=172.16.30.79:8088, MachineId=41551, Location=process:4228, Role=CoherenceCoherencecache, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=2) UID=0xAC101E4F00000137D087630DA24F1F98
            2012-06-09 14:46:06.132/4.362 Oracle Coherence GE 3.6.0.4 <Info> (thread=main, member=n/a): Started cluster Name=cluster:0xC4DB

            Group{Address=224.3.6.0, Port=36000, TTL=4}

            MasterMemberSet
            (
            ThisMember=Member(Id=1, Timestamp=2012-06-09 14:46:02.701, Address=172.16.30.79:8088, MachineId=41551, Location=process:4228, Role=CoherenceCoherencecache)
            OldestMember=Member(Id=1, Timestamp=2012-06-09 14:46:02.701, Address=172.16.30.79:8088, MachineId=41551, Location=process:4228, Role=CoherenceCoherencecache)
            ActualMemberSet=MemberSet(Size=1, BitSetCount=2
            Member(Id=1, Timestamp=2012-06-09 14:46:02.701, Address=172.16.30.79:8088, MachineId=41551, Location=process:4228, Role=CoherenceCoherencecache)
            )
            RecycleMillis=1200000
            RecycleSet=MemberSet(Size=0, BitSetCount=0
            )
            )

            TcpRing{Connections=[]}
            IpMonitor{AddressListSize=0}

            2012-06-09 14:46:06.157/4.387 Oracle Coherence GE 3.6.0.4 <D5> (thread=Invocation:Management, member=1): Service Management joined the cluster with senior service member 1
            2012-06-09 14:46:06.318/4.548 Oracle Coherence GE 3.6.0.4 <D5> (thread=DistributedCache:JpaDistributedCache, member=1): Service JpaDistributedCache joined the cluster with senior service member 1
            2012-06-09 14:46:06.477/4.707 Oracle Coherence GE 3.6.0.4 <Error> (thread=DistributedCache:JpaDistributedCache, member=1): BackingMapManager com.tangosol.net.DefaultConfigurableCacheFactory$Manager: failed to instantiate a cache: Employees
            2012-06-09 14:46:06.477/4.707 Oracle Coherence GE 3.6.0.4 <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.coherence.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(Thread.java:619)
            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:662)
                 at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2501)
                 ... 23 more
            Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named JPA
                 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:84)
                 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
                 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
            Exception in thread "main" (Wrapped: Failed request execution for JpaDistributedCache service on Member(Id=1, Timestamp=2012-06-09 14:46:02.701, Address=172.16.30.79:8088, MachineId=41551, Location=process:4228, Role=CoherenceCoherencecache)) java.lang.UnsupportedOperationException
                 at com.tangosol.util.Base.ensureRuntimeException(Base.java:293)
                 at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.tagException(Grid.CDB:36)
                 at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onPutRequest(PartitionedCache.CDB:57)
                 at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$PutRequest.run(PartitionedCache.CDB:1)
                 at com.tangosol.coherence.component.net.message.requestMessage.DistributedCacheKeyRequest.onReceived(DistributedCacheKeyRequest.CDB:12)
                 at com.tangosol.coherence.component.net.message.requestMessage.distributedCacheKeyRequest.ExtendedKeyRequest.onReceived(ExtendedKeyRequest.CDB:4)
                 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(Thread.java:619)
            Caused by: java.lang.UnsupportedOperationException
                 at java.util.Collections$UnmodifiableMap.put(Collections.java:1285)
                 at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.postPut(PartitionedCache.CDB:66)
                 at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.put(PartitionedCache.CDB:17)
                 at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onPutRequest(PartitionedCache.CDB:33)
                 ... 9 more
            Process exited with exit code 1.

            Thanks-lakshman
            • 3. Re: JPA with Coherence
              878913
              Hi Once tell me the error details ....why its showing TargetException//////


              Thanks-lakshman
              • 4. Re: JPA with Coherence
                dvohra21
                javax.persistence.PersistenceException: No Persistence provider for EntityManager named JPA

                Has a persistence provider been specified in persistence.xml.
                For Hibernate
                <provider>org.hibernate.ejb.HibernatePersistence</provider>

                And for EclipseLink
                <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

                Edited by: dvohra16 on Jun 26, 2012 11:06 AM