You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by mlekshma <mu...@gmail.com> on 2018/05/24 19:54:23 UTC

Ignite Spring Integration seems broken with 2.4 (upgrading from 2.3)

We are upgrading from 2.3 to 2.4 & realized that a change made in
IgniteSpringBean which is referenced in this added line in its javadoc
resulted in us moving lots of references in PostConstruct to
handleContextRefresh.

"A note should be taken that Ignite instance is started after all other
Spring beans have been initialized and right before Spring context is
refreshed. That implies that it's not valid to reference IgniteSpringBean
from any kind of Spring bean init methods like PostConstruct. If it's
required to reference IgniteSpringBean for other bean initialization
purposes, it should be done from a ContextRefreshedEvent listener method
declared in that bean."

However this breaks ignite spring transaction configuration configured as
per the suggestion there which i am not sure how to resolve. Basically we
have the below in the spring application xml where both IgniteSpringBean &
SpringTransactionManager are configured which was working in 2.3 but fails
to start up referencing the above change with 2.4 (i will add the exception
in a bit as my machine went down suddenly),

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


<bean id="transactionManager"
class="org.apache.ignite.transactions.spring.SpringTransactionManager">
    <property name="igniteInstanceName" value="ObjectManagerGrid"/>
    <property name="transactionConcurrency" value="PESSIMISTIC"/>
</bean>


<tx:annotation-driven/>


Any clue on how to work around this problem?

Thanks!



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Ignite Spring Integration seems broken with 2.4 (upgrading from 2.3)

Posted by Humphrey <hm...@gmail.com>.
You can also try to lazy initialize the bean. 
Or set default-lazy-init="true" in the xml beans definition.

http://www.javarticles.com/2015/05/spring-lazy-init-examples.html

Had the same issue before and I added @Lazy to my bean.

Humphrey



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Ignite Spring Integration seems broken with 2.4 (upgrading from 2.3)

Posted by "ilya.kasnacheev" <il...@gmail.com>.
Hello!

I think it should not be too hard for you to copy IgniteSpringBean over,
make needful changes to you and just use your modified copy in Spring
contexts.

Regards,



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Ignite Spring Integration seems broken with 2.4 (upgrading from 2.3)

Posted by Muthu <mu...@gmail.com>.
UPDATE :

Moving to an @Bean method did not work aswell, getting below exception on
startup. Looks like there is no way to configure SpringTransactionManager
with IgniteSpringBean starting with 2.4...not sure how i can proceed with
the upgrade..any idea anyone?


lass]: Invocation of init method failed; nested exception is class
org.apache.ignite.IgniteIllegalStateException: Ignite instance with
provided name doesn't exist. Did you call Ignition.start(..) to start an
Ignite instance? [name=ObjectManagerGrid]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.
getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.
getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(
AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.
finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(
AbstractApplicationContext.java:542)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.
refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(
SpringApplication.java:737)
at org.springframework.boot.SpringApplication.refreshContext(
SpringApplication.java:370)
at org.springframework.boot.SpringApplication.run(
SpringApplication.java:314)
at com.brocade.dcm.Application.main(Application.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(
MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.apache.ignite.IgniteIllegalStateException: Ignite instance
with provided name doesn't exist. Did you call Ignition.start(..) to start
an Ignite instance? [name=ObjectManagerGrid]
at org.apache.ignite.internal.IgnitionEx.grid(IgnitionEx.java:1376)
at org.apache.ignite.Ignition.ignite(Ignition.java:530)
at org.apache.ignite.transactions.spring.SpringTransactionManager.
afterPropertiesSet(SpringTransactionManager.java:357)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 22 common frames omitted


Regards,
Muthu

-- The real danger with modern technology isn't that machines will begin to
think like people, but that people will begin to think like machines.
-- Faith is to believe what you do not see; the reward of this faith is to
see what you believe.

On Thu, May 24, 2018 at 2:46 PM, mlekshma <mu...@gmail.com> wrote:

> UPDATE :
>
> Below is the exception,
>
> ignite-object-manager - [ERROR] 2018-05-24 18:36:45.133 [main]
> org.springframework.boot.SpringApplication - Application startup failed
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'transactionManager' defined in class path resource
> [applicationContext.xml]: Invocation of init method failed; nested
> exception
> is class org.apache.ignite.IgniteIllegalStateException: Ignite instance
> with
> provided name doesn't exist. Did you call Ignition.start(..) to start an
> Ignite instance? [name=ObjectManagerGrid]
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
> tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
> tory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
> tory.createBean(AbstractAutowireCapableBeanFactory.java:483)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.
> getObject(AbstractBeanFactory.java:306)
>         at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.
> getSingleton(DefaultSingletonBeanRegistry.java:230)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(
> AbstractBeanFactory.java:302)
>         at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
> AbstractBeanFactory.java:197)
>         at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.
> preInstantiateSingletons(DefaultListableBeanFactory.java:761)
>         at
> org.springframework.context.support.AbstractApplicationContext.
> finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
>         at
> org.springframework.context.support.AbstractApplicationContext.refresh(
> AbstractApplicationContext.java:542)
>         at
> org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.
> refresh(EmbeddedWebApplicationContext.java:122)
>         at
> org.springframework.boot.SpringApplication.refresh(
> SpringApplication.java:737)
>         at
> org.springframework.boot.SpringApplication.refreshContext(
> SpringApplication.java:370)
>         at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
>         at com.brocade.dcm.Application.main(Application.java:63)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
> org.springframework.boot.loader.MainMethodRunner.run(
> MainMethodRunner.java:48)
>         at org.springframework.boot.loader.Launcher.launch(
> Launcher.java:87)
>         at org.springframework.boot.loader.Launcher.launch(
> Launcher.java:50)
>         at
> org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
> Caused by: org.apache.ignite.IgniteIllegalStateException: Ignite instance
> with provided name doesn't exist. Did you call Ignition.start(..) to start
> an Ignite instance? [name=ObjectManagerGrid]
>         at org.apache.ignite.internal.IgnitionEx.grid(IgnitionEx.
> java:1376)
>         at org.apache.ignite.Ignition.ignite(Ignition.java:530)
>         at
> org.apache.ignite.transactions.spring.SpringTransactionManager.
> afterPropertiesSet(SpringTransactionManager.java:357)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
> tory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
>         at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
> tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
>         ... 22 common frames omitted
>
> Thanks
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Ignite Spring Integration seems broken with 2.4 (upgrading from 2.3)

Posted by mlekshma <mu...@gmail.com>.
UPDATE : 

Below is the exception,

ignite-object-manager - [ERROR] 2018-05-24 18:36:45.133 [main]
org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'transactionManager' defined in class path resource
[applicationContext.xml]: Invocation of init method failed; nested exception
is class org.apache.ignite.IgniteIllegalStateException: Ignite instance with
provided name doesn't exist. Did you call Ignition.start(..) to start an
Ignite instance? [name=ObjectManagerGrid]
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
        at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
        at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
        at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
        at
org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
        at com.brocade.dcm.Application.main(Application.java:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at
org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.apache.ignite.IgniteIllegalStateException: Ignite instance
with provided name doesn't exist. Did you call Ignition.start(..) to start
an Ignite instance? [name=ObjectManagerGrid]
        at org.apache.ignite.internal.IgnitionEx.grid(IgnitionEx.java:1376)
        at org.apache.ignite.Ignition.ignite(Ignition.java:530)
        at
org.apache.ignite.transactions.spring.SpringTransactionManager.afterPropertiesSet(SpringTransactionManager.java:357)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
        ... 22 common frames omitted

Thanks



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Ignite Spring Integration seems broken with 2.4 (upgrading from 2.3)

Posted by Muthu <mu...@gmail.com>.
 One thing i can do is to move the SpringTransactionManager bean instance
creation into a @Bean method, i am going to test doing this once i get my
machine back...but i wish i didn't have to change anything..


On Thu, May 24, 2018 at 12:54 PM, mlekshma <mu...@gmail.com>
wrote:

> We are upgrading from 2.3 to 2.4 & realized that a change made in
> IgniteSpringBean which is referenced in this added line in its javadoc
> resulted in us moving lots of references in PostConstruct to
> handleContextRefresh.
>
> "A note should be taken that Ignite instance is started after all other
> Spring beans have been initialized and right before Spring context is
> refreshed. That implies that it's not valid to reference IgniteSpringBean
> from any kind of Spring bean init methods like PostConstruct. If it's
> required to reference IgniteSpringBean for other bean initialization
> purposes, it should be done from a ContextRefreshedEvent listener method
> declared in that bean."
>
> However this breaks ignite spring transaction configuration configured as
> per the suggestion there which i am not sure how to resolve. Basically we
> have the below in the spring application xml where both IgniteSpringBean &
> SpringTransactionManager are configured which was working in 2.3 but fails
> to start up referencing the above change with 2.4 (i will add the exception
> in a bit as my machine went down suddenly),
>
> <bean id="igniteSpringBean" class="org.apache.ignite.IgniteSpringBean">
>     <property name="configuration">
>         <bean id="grid.cfg"
> class="org.apache.ignite.configuration.IgniteConfiguration">
>             <property name="igniteInstanceName" value="ObjectManagerGrid"/>
>             <property name="clientMode" value="true"/>
>             ...
>             ...
>         </bean>
>     </property>
> </bean>
>
>
> <bean id="transactionManager"
> class="org.apache.ignite.transactions.spring.SpringTransactionManager">
>     <property name="igniteInstanceName" value="ObjectManagerGrid"/>
>     <property name="transactionConcurrency" value="PESSIMISTIC"/>
> </bean>
>
>
> <tx:annotation-driven/>
>
>
> Any clue on how to work around this problem?
>
> Thanks!
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Ignite Spring Integration seems broken with 2.4 (upgrading from 2.3)

Posted by Denis Magda <dm...@gridgain.com>.
The issue will be addressed once this ticket is resolved:
https://issues.apache.org/jira/browse/IGNITE-8740



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/