You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by san <hv...@gmail.com> on 2016/08/24 13:27:47 UTC

Spring application context resource is not injected exception while starting ignite in jdbc driver mode

I am facing an issue while starting ignite in JDBC driver mode. i have my
cache in remote node and i need to access using plain sql queries. Hence i
am using ignite jdbc driver. please find the code snippet.  

Class.forName("org.apache.ignite.IgniteJdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:ignite:cfg://ignite-jdbc.xml");
ResultSet rs = conn.createStatement().executeQuery("select * from users");

my xml also simple. since cache is already loaded in remote node.

  <bean id="grid.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
        
        <property name="clientMode" value="true"/>

        <property name="localHost" value="127.0.0.1"/>

       

        <property name="discoverySpi">
            <bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <list>
                                <value>127.0.0.1:47500..47549</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>

please do the needful.. 




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Spring-application-context-resource-is-not-injected-exception-while-starting-ignite-in-jdbc-driver-me-tp7272.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Fwd: Spring application context resource is not injected exception while starting ignite in jdbc driver mode

Posted by Denis Magda <dm...@apache.org>.
Cross-posting to the dev list.

I’ve faced the same issue, filed a ticket with a reproducer and suggested a workaround:
https://issues.apache.org/jira/browse/IGNITE-4829 <https://issues.apache.org/jira/browse/IGNITE-4829>

*Alex K.*, could you please take care of the issue? If this is something we can’t fix quickly then Apache Ignite Web Console configuration wizard has to set the POJO store configuration differently. 

—
Denis

> Begin forwarded message:
> 
> From: san <hv...@gmail.com>
> Subject: Spring application context resource is not injected exception while starting ignite in jdbc driver mode
> Date: August 24, 2016 at 6:27:47 AM PDT
> To: user@ignite.apache.org
> Reply-To: user@ignite.apache.org
> 
> I am facing an issue while starting ignite in JDBC driver mode. i have my
> cache in remote node and i need to access using plain sql queries. Hence i
> am using ignite jdbc driver. please find the code snippet.  
> 
> Class.forName("org.apache.ignite.IgniteJdbcDriver");
> Connection conn =
> DriverManager.getConnection("jdbc:ignite:cfg://ignite-jdbc.xml");
> ResultSet rs = conn.createStatement().executeQuery("select * from users");
> 
> my xml also simple. since cache is already loaded in remote node.
> 
>  <bean id="grid.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
> 
>        <property name="clientMode" value="true"/>
> 
>        <property name="localHost" value="127.0.0.1"/>
> 
> 
> 
>        <property name="discoverySpi">
>            <bean
> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>                <property name="ipFinder">
>                    <bean
> class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
>                        <property name="addresses">
>                            <list>
>                                <value>127.0.0.1:47500..47549</value>
>                            </list>
>                        </property>
>                    </bean>
>                </property>
>            </bean>
>        </property>
> 
> please do the needful.. 
> 
> 
> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Spring-application-context-resource-is-not-injected-exception-while-starting-ignite-in-jdbc-driver-me-tp7272.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Spring application context resource is not injected exception while starting ignite in jdbc driver mode

Posted by vkulichenko <va...@gmail.com>.
Hi,

How do you start the server node with C#? Please show it's configuration as
well.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Spring-application-context-resource-is-not-injected-exception-while-starting-ignite-in-jdbc-driver-me-tp7272p7619.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Spring application context resource is not injected exception while starting ignite in jdbc driver mode

Posted by amitpa <am...@nrifintech.com>.
@agura If you setup Java Spring Automatic persistence And try to connect a
Java node with C# this occurs repeatedly.

Is there any work around for this?

Just as note The same config works with C++ and Java but not with Java and
C#?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Spring-application-context-resource-is-not-injected-exception-while-starting-ignite-in-jdbc-driver-me-tp7272p7552.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Spring application context resource is not injected exception while starting ignite in jdbc driver mode

Posted by Andrey Gura <ag...@gridgain.com>.
Hi,

unfortunatelly I can't reproduce this problem. Could you please provide
some reproducer?

On Thu, Aug 25, 2016 at 7:54 AM, san <hv...@gmail.com> wrote:

> Hi,
>
> Any update onthis?.. please let know the solution for the same.
>
> Thanks
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Spring-application-context-resource-
> is-not-injected-exception-while-starting-ignite-in-jdbc-
> driver-me-tp7272p7290.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Andrey Gura
GridGain Systems, Inc.
www.gridgain.com

Re: Spring application context resource is not injected exception while starting ignite in jdbc driver mode

Posted by san <hv...@gmail.com>.
Hi,  

Any update onthis?.. please let know the solution for the same.

Thanks



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Spring-application-context-resource-is-not-injected-exception-while-starting-ignite-in-jdbc-driver-me-tp7272p7290.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Spring application context resource is not injected exception while starting ignite in jdbc driver mode

Posted by san <hv...@gmail.com>.
Hi agura,

please find the exception stack trace and complete jdbc driver client xml
file. I used Automatic Persistence, and built cache in server. from my jdbc
client i just need to access the server cache. for this do we need to add
any additional configuration in jdbc driver configuration file?

<?xml version="1.0" encoding="UTF-8"?>

<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">
    <bean id="grid.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
        
        <property name="clientMode" value="true"/>

        <property name="localHost" value="127.0.0.1"/>

        <property name="discoverySpi">
            <bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <list>
                                <value>127.0.0.1:47500..47549</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>

        <property name="peerClassLoadingEnabled" value="true"/>
    </bean>
</beans>

exception

[19:45:54] Topology snapshot [ver=2, servers=1, clients=1, CPUs=4,
heap=3.5GB]
[19:45:54,992][SEVERE][exchange-worker-#42%ignite-jdbc-driver-7c5edc62-1858-41ac-9a92-2156a28ae201%][GridDhtPartitionsExchangeFuture]
Failed to reinitialize local partitions (preloading will be stopped):
GridDhtPartitionExchangeId [topVer=AffinityTopologyVersion [topVer=2,
minorTopVer=1], nodeId=1579d3a7, evt=DISCOVERY_CUSTOM_EVT]
class org.apache.ignite.IgniteException: Spring application context resource
is not injected.
	at
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory.create(CacheJdbcPojoStoreFactory.java:167)
	at
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory.create(CacheJdbcPojoStoreFactory.java:100)
	at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.createCache(GridCacheProcessor.java:1259)
	at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:1712)
	at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:1613)
	at
org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.onCacheChangeRequest(CacheAffinitySharedManager.java:382)
	at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onCacheChangeRequest(GridDhtPartitionsExchangeFuture.java:565)
	at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:448)
	at
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:1440)
	at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
	at java.lang.Thread.run(Thread.java:745)
[19:45:54,999][SEVERE][exchange-worker-#42%ignite-jdbc-driver-7c5edc62-1858-41ac-9a92-2156a28ae201%][GridCachePartitionExchangeManager]
Failed to wait for completion of partition map exchange (preloading will not
start): GridDhtPartitionsExchangeFuture [dummy=false, forcePreload=false,
reassign=false, discoEvt=DiscoveryCustomEvent [customMsg=null,
affTopVer=AffinityTopologyVersion [topVer=2, minorTopVer=1],
super=DiscoveryEvent [evtNode=TcpDiscoveryNode
[id=1579d3a7-546f-4646-b85e-f130e8ac9c56, addrs=[127.0.0.1],
sockAddrs=[/127.0.0.1:0], discPort=0, order=2, intOrder=0,
lastExchangeTime=1472048115925, loc=true, ver=1.7.0#20160801-sha1:383273e3,
isClient=true], topVer=2, nodeId8=1579d3a7, msg=null,
type=DISCOVERY_CUSTOM_EVT, tstamp=1472048154971]], crd=TcpDiscoveryNode
[id=60a665b3-576b-4eb3-8675-210f15695477, addrs=[0:0:0:0:0:0:0:1, 10.0.4.42,
10.0.9.245, 10.6.5.9, 127.0.0.1], sockAddrs=[/10.0.9.245:47500,
KOD-LAP-247.inovate.inovate.com/10.6.5.9:47500, /0:0:0:0:0:0:0:1:47500,
/127.0.0.1:47500, /10.0.4.42:47500], discPort=47500, order=1, intOrder=1,
lastExchangeTime=1472048154283, loc=false, ver=1.7.0#20160801-sha1:383273e3,
isClient=false], exchId=GridDhtPartitionExchangeId
[topVer=AffinityTopologyVersion [topVer=2, minorTopVer=1], nodeId=1579d3a7,
evt=DISCOVERY_CUSTOM_EVT], added=true, initFut=GridFutureAdapter [resFlag=2,
res=false, startTime=1472048154971, endTime=1472048154991,
ignoreInterrupts=false, state=DONE], init=false, topSnapshot=null,
lastVer=null, partReleaseFut=null, affChangeMsg=null, skipPreload=true,
clientOnlyExchange=false, initTs=1472048154971, centralizedAff=false,
evtLatch=0, remaining=[60a665b3-576b-4eb3-8675-210f15695477],
srvNodes=[TcpDiscoveryNode [id=60a665b3-576b-4eb3-8675-210f15695477,
addrs=[0:0:0:0:0:0:0:1, 10.0.4.42, 10.0.9.245, 10.6.5.9, 127.0.0.1],
sockAddrs=[/10.0.9.245:47500,
KOD-LAP-247.inovate.inovate.com/10.6.5.9:47500, /0:0:0:0:0:0:0:1:47500,
/127.0.0.1:47500, /10.0.4.42:47500], discPort=47500, order=1, intOrder=1,
lastExchangeTime=1472048154283, loc=false, ver=1.7.0#20160801-sha1:383273e3,
isClient=false]], super=GridFutureAdapter [resFlag=1, res=class
o.a.i.IgniteException: Spring application context resource is not injected.,
startTime=1472048154971, endTime=1472048154991, ignoreInterrupts=false,
state=DONE]]
class org.apache.ignite.IgniteCheckedException: Spring application context
resource is not injected.
	at org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7142)
	at
org.apache.ignite.internal.util.future.GridFutureAdapter.get0(GridFutureAdapter.java:196)
	at
org.apache.ignite.internal.util.future.GridFutureAdapter.get(GridFutureAdapter.java:137)
	at
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:1446)
	at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
	at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteException: Spring application
context resource is not injected.
	at
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory.create(CacheJdbcPojoStoreFactory.java:167)
	at
org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory.create(CacheJdbcPojoStoreFactory.java:100)
	at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.createCache(GridCacheProcessor.java:1259)
	at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:1712)
	at
org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:1613)
	at
org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.onCacheChangeRequest(CacheAffinitySharedManager.java:382)
	at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onCacheChangeRequest(GridDhtPartitionsExchangeFuture.java:565)
	at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:448)
	at
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:1440)
	... 2 more

Thanks




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Spring-application-context-resource-is-not-injected-exception-while-starting-ignite-in-jdbc-driver-me-tp7272p7274.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Spring application context resource is not injected exception while starting ignite in jdbc driver mode

Posted by Andrey Gura <ag...@gridgain.com>.
Hi,

could you please provide exception and stack trace? Also please make sure
that your Spring configuration file has <beans> root element.

On Wed, Aug 24, 2016 at 4:27 PM, san <hv...@gmail.com> wrote:

> I am facing an issue while starting ignite in JDBC driver mode. i have my
> cache in remote node and i need to access using plain sql queries. Hence i
> am using ignite jdbc driver. please find the code snippet.
>
> Class.forName("org.apache.ignite.IgniteJdbcDriver");
> Connection conn =
> DriverManager.getConnection("jdbc:ignite:cfg://ignite-jdbc.xml");
> ResultSet rs = conn.createStatement().executeQuery("select * from users");
>
> my xml also simple. since cache is already loaded in remote node.
>
>   <bean id="grid.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>
>         <property name="clientMode" value="true"/>
>
>         <property name="localHost" value="127.0.0.1"/>
>
>
>
>         <property name="discoverySpi">
>             <bean
> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>                 <property name="ipFinder">
>                     <bean
> class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.
> TcpDiscoveryVmIpFinder">
>                         <property name="addresses">
>                             <list>
>                                 <value>127.0.0.1:47500..47549</value>
>                             </list>
>                         </property>
>                     </bean>
>                 </property>
>             </bean>
>         </property>
>
> please do the needful..
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Spring-application-context-resource-
> is-not-injected-exception-while-starting-ignite-in-jdbc-
> driver-me-tp7272.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Andrey Gura
GridGain Systems, Inc.
www.gridgain.com

Fwd: Spring application context resource is not injected exception while starting ignite in jdbc driver mode

Posted by Denis Magda <dm...@apache.org>.
Cross-posting to the dev list.

I’ve faced the same issue, filed a ticket with a reproducer and suggested a workaround:
https://issues.apache.org/jira/browse/IGNITE-4829 <https://issues.apache.org/jira/browse/IGNITE-4829>

*Alex K.*, could you please take care of the issue? If this is something we can’t fix quickly then Apache Ignite Web Console configuration wizard has to set the POJO store configuration differently. 

—
Denis

> Begin forwarded message:
> 
> From: san <hv...@gmail.com>
> Subject: Spring application context resource is not injected exception while starting ignite in jdbc driver mode
> Date: August 24, 2016 at 6:27:47 AM PDT
> To: user@ignite.apache.org
> Reply-To: user@ignite.apache.org
> 
> I am facing an issue while starting ignite in JDBC driver mode. i have my
> cache in remote node and i need to access using plain sql queries. Hence i
> am using ignite jdbc driver. please find the code snippet.  
> 
> Class.forName("org.apache.ignite.IgniteJdbcDriver");
> Connection conn =
> DriverManager.getConnection("jdbc:ignite:cfg://ignite-jdbc.xml");
> ResultSet rs = conn.createStatement().executeQuery("select * from users");
> 
> my xml also simple. since cache is already loaded in remote node.
> 
>  <bean id="grid.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
> 
>        <property name="clientMode" value="true"/>
> 
>        <property name="localHost" value="127.0.0.1"/>
> 
> 
> 
>        <property name="discoverySpi">
>            <bean
> class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>                <property name="ipFinder">
>                    <bean
> class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
>                        <property name="addresses">
>                            <list>
>                                <value>127.0.0.1:47500..47549</value>
>                            </list>
>                        </property>
>                    </bean>
>                </property>
>            </bean>
>        </property>
> 
> please do the needful.. 
> 
> 
> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Spring-application-context-resource-is-not-injected-exception-while-starting-ignite-in-jdbc-driver-me-tp7272.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.