Problem with Spring Events integration outside of a web application

View: New views
7 Messages — Rating Filter:   Alert me  

Problem with Spring Events integration outside of a web application

by matt hoffman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm pretty sure this is a bug, but I thought I'd post it here before sending it on to JIRA.

When using the Spring Events integration inside an application that loads the Spring context explicitly (i.e. through a ClasspathXmlApplicationContext, as opposed to inside a web container) I'm unable to propagate Spring events. In fact, not only do the events not propagate to other TC clients, but they aren't multicast inside the Spring context either.
When starting up the application, Terracotta is registering the Spring context (i.e. the logging statement "Context is distributed" is present) and other Spring beans are being shared appropriately. However, the Spring context is not being registered with the ApplicationContextEventProtocol, so events are not being propagated. In my brief debugging, it seems that when Terracotta gets to this block of com.tcspring.ApplicationContextEventProtocol (line 178 in version 2.5.4): synchronized (contexts) { context = (AbstractApplicationContext) contexts.get(ctxId); } context is coming back null. As a result, the logging statement on the next line says: 2008-04-07 00:02:16,965 749308 [main] INFO com.tcspring.ApplicationContextEventProtocol - 02080100050A01070C06050307010C05 Publishing event com.myapp.event.SystemEvent[source=0b9482b8-6bc3-4177-9fba-0a7c12a1e81e] to null Thread[main,5,main] Note that it is publishing "to null". Further digging reveals that com.tcspring.ApplicationContextEventProtocol.registerContext is never being called. I haven't dug beyond that. I haven't been able to pull together a test case for this error yet, as I'm on a strict timeline and trying to find ways to work around it. But I have included a tc-config file just in case I've configured it wrong.

Any ideas?  Did I miss something simple?


Thanks!

<?xml version="1.0" encoding="UTF-8"?>
<tc:tc-config xmlns:tc="http://www.terracotta.org/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-4.xsd">
    <!-- Server is colocated with client and DSO is listening on default port (9510). -->
    <servers>
        <server host="%i" name="myapp"/>
        <update-check>
            <enabled>true</enabled>
        </update-check>
    </servers>
    <!-- Tell DSO where to put the generated client logs
   See the Terracotta Configuration Guide and Reference for additional
   information. -->
    <clients>
        <logs>%(user.home)/terracotta/client-logs/myapp/samples/%D</logs>
    </clients>
    <application>
        <!-- See the Terracotta Spring Guide for more details of the the <spring/>
   section of the tc-config file -->
        <spring>
            <!-- Tell DSO about the webapp we're sharing -->
            <jee-application name="*">

                <instrumented-classes>
                    <include>
                        <class-expression>com.myapp.event.*</class-expression>
                    </include>
                </instrumented-classes>

                <!-- Turns on clustering of the HTTP session. Needed for f.e. Spring
              WebFlow clustering. -->
                <session-support>false</session-support>


                <locks>
                    <autolock>
                        <method-expression>* *..*.*(..)</method-expression>
                    </autolock>
                </locks>


                <application-contexts>
                    <application-context>

                        <!-- Specifies the bean definition resource patterns; The matching
                 applies OR logic for individual path element. -->
                        <paths>
                            <path>*context.xml</path>
                        </paths>

                        <!-- Specifies the Spring beans to cluster/share; The bean name
                 should be the same name that the bean has in the Spring bean
                 config file. Matching has to be exact; -->
                        <beans>
                        </beans>

                        <!-- Tell DSO which events to share -->
                        <distributed-events>
                            <distributed-event>com.myapp.event.*</distributed-event>
                        </distributed-events>
                    </application-context>
                </application-contexts>

            </jee-application>
        </spring>
    </application>
</tc:tc-config>

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Problem with Spring Events integration outside of a web application

by Eugene Kuleshov-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

matt hoffman wrote:

> I'm pretty sure this is a bug, but I thought I'd post it here before
> sending it on to JIRA.
>
> When using the Spring Events integration inside an application that
> loads the Spring context explicitly (i.e. through a
> ClasspathXmlApplicationContext, as opposed to inside a web container)
> I'm unable to propagate Spring events. In fact, not only do the events
> not propagate to other TC clients, but they aren't multicast inside
> the Spring context either.
> When starting up the application, Terracotta is registering the Spring
> context (i.e. the logging statement "Context is distributed" is
> present) and other Spring beans are being shared appropriately.
> However, the Spring context is not being registered with the
> ApplicationContextEventProtocol, so events are not being propagated.
> In my brief debugging, it seems that when Terracotta gets to this
> block of com.tcspring.ApplicationContextEventProtocol (line 178 in
> version 2.5.4): synchronized (contexts) { context =
> (AbstractApplicationContext) contexts.get(ctxId); } context is coming
> back null. As a result, the logging statement on the next line says:
> 2008-04-07 00:02:16,965 749308 [main] INFO
> com.tcspring.ApplicationContextEventProtocol -
> 02080100050A01070C06050307010C05 Publishing event
> com.myapp.event.SystemEvent[source=0b9482b8-6bc3-4177-9fba-0a7c12a1e81e]
> to null Thread[main,5,main] Note that it is publishing "to null".
> Further digging reveals that
> com.tcspring.ApplicationContextEventProtocol.registerContext is never
> being called. I haven't dug beyond that. I haven't been able to pull
> together a test case for this error yet, as I'm on a strict timeline
> and trying to find ways to work around it. But I have included a
> tc-config file just in case I've configured it wrong.
> Any ideas?  Did I miss something simple?
>
  For one thing, Spring 2.5 isn't officially supported yet. On a good
side, work on Spring 2.5 had been started and there is a hope to see it
in the near future. In a mean time you may want to check it it works
with the earlier Spring version.

  Also, from your description it is unclear if it does work when
application is loaded in web app and it is also unclear how you load
your Spring context. So, if you'll decide to submit JIRA issue please
provide small test application that would allow to reproduce this issue.

  BTW, it is great to see that you were been able to debug the issue
down to this level.
 
  Thanks

  Eugene


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Problem with Spring Events integration outside of a web application

by Orion Letizi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To Eugene's point, I'm pretty sure that Terracotta clustered Spring  
events doesn't work on Spring versions later than 2.0.5.  It  
*definitely* doesn't work on Spring versions >= 2.5.  Although, as  
Eugene says, we have a version of Spring support that works with  
Spring 2.5 currently in testing.  Not sure of its exact availability,  
but I can have someone get in touch with you about it if you'd like.

--Orion


On Apr 6, 2008, at 10:46 PM, Eugene Kuleshov wrote:

> matt hoffman wrote:
>> I'm pretty sure this is a bug, but I thought I'd post it here before
>> sending it on to JIRA.
>>
>> When using the Spring Events integration inside an application that
>> loads the Spring context explicitly (i.e. through a
>> ClasspathXmlApplicationContext, as opposed to inside a web container)
>> I'm unable to propagate Spring events. In fact, not only do the  
>> events
>> not propagate to other TC clients, but they aren't multicast inside
>> the Spring context either.
>> When starting up the application, Terracotta is registering the  
>> Spring
>> context (i.e. the logging statement "Context is distributed" is
>> present) and other Spring beans are being shared appropriately.
>> However, the Spring context is not being registered with the
>> ApplicationContextEventProtocol, so events are not being propagated.
>> In my brief debugging, it seems that when Terracotta gets to this
>> block of com.tcspring.ApplicationContextEventProtocol (line 178 in
>> version 2.5.4): synchronized (contexts) { context =
>> (AbstractApplicationContext) contexts.get(ctxId); } context is coming
>> back null. As a result, the logging statement on the next line says:
>> 2008-04-07 00:02:16,965 749308 [main] INFO
>> com.tcspring.ApplicationContextEventProtocol -
>> 02080100050A01070C06050307010C05 Publishing event
>> com
>> .myapp.event.SystemEvent[source=0b9482b8-6bc3-4177-9fba-0a7c12a1e81e]
>> to null Thread[main,5,main] Note that it is publishing "to null".
>> Further digging reveals that
>> com.tcspring.ApplicationContextEventProtocol.registerContext is never
>> being called. I haven't dug beyond that. I haven't been able to pull
>> together a test case for this error yet, as I'm on a strict timeline
>> and trying to find ways to work around it. But I have included a
>> tc-config file just in case I've configured it wrong.
>> Any ideas?  Did I miss something simple?
>>
>  For one thing, Spring 2.5 isn't officially supported yet. On a good
> side, work on Spring 2.5 had been started and there is a hope to see  
> it
> in the near future. In a mean time you may want to check it it works
> with the earlier Spring version.
>
>  Also, from your description it is unclear if it does work when
> application is loaded in web app and it is also unclear how you load
> your Spring context. So, if you'll decide to submit JIRA issue please
> provide small test application that would allow to reproduce this  
> issue.
>
>  BTW, it is great to see that you were been able to debug the issue
> down to this level.
>
>  Thanks
>
>  Eugene
>
>
> _______________________________________________
> tc-users mailing list
> tc-users@...
> http://lists.terracotta.org/mailman/listinfo/tc-users

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Problem with Spring Events integration outside of a web application

by matt hoffman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the quick reponse.  Sorry that I was unclear --  I ran into this bug using Spring 2.0.8 (latest stable in the 2.0 branch); I may drop back to 2.0.5 to see if that makes a difference.  With 2.5, I didn't get this far -- Terracotta never registers the Spring context. 

I dropped back from 2.5.3 to 2.0.8 to test Terracotta integration, so I'm definitely excited to see TC support Spring 2.5.  I'll give that a try as soon as its stable enough to develop with. 

I haven't tested the exact same app loaded as a web application, but I have traced through the Spring Events sample app that ships with TC.  That's my basis for comparison.  That's the only difference I can see between the Spring Events sample and my app, as far as loading Spring is concerned.

For the record, I'm loading Spring in a fairly typical way: 

        ApplicationContext appContext = new ClassPathXmlApplicationContext(new String[]{"*context.xml"});

There's nothing else fancy going on as far as Spring is concerned, and as I said, TC is picking up the Spring context and mixing in the DistributableBeanFactory interface, as expected.  Interestingly, this is the same way that you're loading Spring in the com.tctest.spring.AppContextEvents_Test.java unit test, so I can only guess that something in the way that you hook directly into the L1 config ( the visitL1DSOConfig method) is bypassing the issue I'm seeing. 

I started putting together a test app, but it will be a couple days until I put more resources toward that;  I'll post a bug at that point, though.


Matt

On Mon, Apr 7, 2008 at 8:44 AM, Orion Letizi <orion@...> wrote:
To Eugene's point, I'm pretty sure that Terracotta clustered Spring
events doesn't work on Spring versions later than 2.0.5.  It
*definitely* doesn't work on Spring versions >= 2.5.  Although, as
Eugene says, we have a version of Spring support that works with
Spring 2.5 currently in testing.  Not sure of its exact availability,
but I can have someone get in touch with you about it if you'd like.

--Orion


On Apr 6, 2008, at 10:46 PM, Eugene Kuleshov wrote:
> matt hoffman wrote:
>> I'm pretty sure this is a bug, but I thought I'd post it here before
>> sending it on to JIRA.
>>
>> When using the Spring Events integration inside an application that
>> loads the Spring context explicitly (i.e. through a
>> ClasspathXmlApplicationContext, as opposed to inside a web container)
>> I'm unable to propagate Spring events. In fact, not only do the
>> events
>> not propagate to other TC clients, but they aren't multicast inside
>> the Spring context either.
>> When starting up the application, Terracotta is registering the
>> Spring
>> context (i.e. the logging statement "Context is distributed" is
>> present) and other Spring beans are being shared appropriately.
>> However, the Spring context is not being registered with the
>> ApplicationContextEventProtocol, so events are not being propagated.
>> In my brief debugging, it seems that when Terracotta gets to this
>> block of com.tcspring.ApplicationContextEventProtocol (line 178 in
>> version 2.5.4): synchronized (contexts) { context =
>> (AbstractApplicationContext) contexts.get(ctxId); } context is coming
>> back null. As a result, the logging statement on the next line says:
>> 2008-04-07 00:02:16,965 749308 [main] INFO
>> com.tcspring.ApplicationContextEventProtocol -
>> 02080100050A01070C06050307010C05 Publishing event
>> com
>> .myapp.event.SystemEvent[source=0b9482b8-6bc3-4177-9fba-0a7c12a1e81e]
>> to null Thread[main,5,main] Note that it is publishing "to null".
>> Further digging reveals that
>> com.tcspring.ApplicationContextEventProtocol.registerContext is never
>> being called. I haven't dug beyond that. I haven't been able to pull
>> together a test case for this error yet, as I'm on a strict timeline
>> and trying to find ways to work around it. But I have included a
>> tc-config file just in case I've configured it wrong.
>> Any ideas?  Did I miss something simple?
>>
>  For one thing, Spring 2.5 isn't officially supported yet. On a good
> side, work on Spring 2.5 had been started and there is a hope to see
> it
> in the near future. In a mean time you may want to check it it works
> with the earlier Spring version.
>
>  Also, from your description it is unclear if it does work when
> application is loaded in web app and it is also unclear how you load
> your Spring context. So, if you'll decide to submit JIRA issue please
> provide small test application that would allow to reproduce this
> issue.
>
>  BTW, it is great to see that you were been able to debug the issue
> down to this level.
>
>  Thanks
>
>  Eugene
>
>
> _______________________________________________
> tc-users mailing list
> tc-users@...
> http://lists.terracotta.org/mailman/listinfo/tc-users

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Problem with Spring Events integration outside of a web application

by Taylor Gautier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That was my experience too - on Spring 2.5 events did exactly nothing.  On 2.0.8 they printed a strange error message, and on 2.0.5 they work.  We'll be fixing support in Spring > 2.0.5 hopefully soon.

Orion Letizi wrote:
To Eugene's point, I'm pretty sure that Terracotta clustered Spring  
events doesn't work on Spring versions later than 2.0.5.  It  
*definitely* doesn't work on Spring versions >= 2.5.  Although, as  
Eugene says, we have a version of Spring support that works with  
Spring 2.5 currently in testing.  Not sure of its exact availability,  
but I can have someone get in touch with you about it if you'd like.

--Orion


On Apr 6, 2008, at 10:46 PM, Eugene Kuleshov wrote:
  
matt hoffman wrote:
    
I'm pretty sure this is a bug, but I thought I'd post it here before
sending it on to JIRA.

When using the Spring Events integration inside an application that
loads the Spring context explicitly (i.e. through a
ClasspathXmlApplicationContext, as opposed to inside a web container)
I'm unable to propagate Spring events. In fact, not only do the  
events
not propagate to other TC clients, but they aren't multicast inside
the Spring context either.
When starting up the application, Terracotta is registering the  
Spring
context (i.e. the logging statement "Context is distributed" is
present) and other Spring beans are being shared appropriately.
However, the Spring context is not being registered with the
ApplicationContextEventProtocol, so events are not being propagated.
In my brief debugging, it seems that when Terracotta gets to this
block of com.tcspring.ApplicationContextEventProtocol (line 178 in
version 2.5.4): synchronized (contexts) { context =
(AbstractApplicationContext) contexts.get(ctxId); } context is coming
back null. As a result, the logging statement on the next line says:
2008-04-07 00:02:16,965 749308 [main] INFO
com.tcspring.ApplicationContextEventProtocol -
02080100050A01070C06050307010C05 Publishing event
com 
.myapp.event.SystemEvent[source=0b9482b8-6bc3-4177-9fba-0a7c12a1e81e]
to null Thread[main,5,main] Note that it is publishing "to null".
Further digging reveals that
com.tcspring.ApplicationContextEventProtocol.registerContext is never
being called. I haven't dug beyond that. I haven't been able to pull
together a test case for this error yet, as I'm on a strict timeline
and trying to find ways to work around it. But I have included a
tc-config file just in case I've configured it wrong.
Any ideas?  Did I miss something simple?

      
 For one thing, Spring 2.5 isn't officially supported yet. On a good
side, work on Spring 2.5 had been started and there is a hope to see  
it
in the near future. In a mean time you may want to check it it works
with the earlier Spring version.

 Also, from your description it is unclear if it does work when
application is loaded in web app and it is also unclear how you load
your Spring context. So, if you'll decide to submit JIRA issue please
provide small test application that would allow to reproduce this  
issue.

 BTW, it is great to see that you were been able to debug the issue
down to this level.

 Thanks

 Eugene


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users
    

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users
  

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Problem with Spring Events integration outside of a web application

by njain :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You will see issues with 2.0.8 as well. We are working on supporting 2.5.2 as of now. Meanwhile can you post us your example that we can verify with our to be released 2.5.2 version

Thanks,
Nitin
----- Original Message -----
From: "matt hoffman" <matt@...>
To: tc-users@...
Sent: Monday, April 7, 2008 8:45:15 PM (GMT+0530) Asia/Calcutta
Subject: Re: [tc-users] Problem with Spring Events integration outside of a web application

Thanks for the quick reponse.  Sorry that I was unclear --  I ran into this
bug using Spring 2.0.8 (latest stable in the 2.0 branch); I may drop back to
2.0.5 to see if that makes a difference.  With 2.5, I didn't get this far --
Terracotta never registers the Spring context.
I dropped back from 2.5.3 to 2.0.8 to test Terracotta integration, so I'm
definitely excited to see TC support Spring 2.5.  I'll give that a try as
soon as its stable enough to develop with.

I haven't tested the exact same app loaded as a web application, but I have
traced through the Spring Events sample app that ships with TC.  That's my
basis for comparison.  That's the only difference I can see between the
Spring Events sample and my app, as far as loading Spring is concerned.

For the record, I'm loading Spring in a fairly typical way:

        ApplicationContext appContext = new
ClassPathXmlApplicationContext(new String[]{"*context.xml"});

There's nothing else fancy going on as far as Spring is concerned, and as I
said, TC is picking up the Spring context and mixing in the
DistributableBeanFactory interface, as expected.  Interestingly, this is the
same way that you're loading Spring in
the com.tctest.spring.AppContextEvents_Test.java unit test, so I can only
guess that something in the way that you hook directly into the L1 config (
the visitL1DSOConfig method) is bypassing the issue I'm seeing.

I started putting together a test app, but it will be a couple days until I
put more resources toward that;  I'll post a bug at that point, though.


Matt

On Mon, Apr 7, 2008 at 8:44 AM, Orion Letizi <orion@...> wrote:

> To Eugene's point, I'm pretty sure that Terracotta clustered Spring
> events doesn't work on Spring versions later than 2.0.5.  It
> *definitely* doesn't work on Spring versions >= 2.5.  Although, as
> Eugene says, we have a version of Spring support that works with
> Spring 2.5 currently in testing.  Not sure of its exact availability,
> but I can have someone get in touch with you about it if you'd like.
>
> --Orion
>
>
> On Apr 6, 2008, at 10:46 PM, Eugene Kuleshov wrote:
> > matt hoffman wrote:
> >> I'm pretty sure this is a bug, but I thought I'd post it here before
> >> sending it on to JIRA.
> >>
> >> When using the Spring Events integration inside an application that
> >> loads the Spring context explicitly (i.e. through a
> >> ClasspathXmlApplicationContext, as opposed to inside a web container)
> >> I'm unable to propagate Spring events. In fact, not only do the
> >> events
> >> not propagate to other TC clients, but they aren't multicast inside
> >> the Spring context either.
> >> When starting up the application, Terracotta is registering the
> >> Spring
> >> context (i.e. the logging statement "Context is distributed" is
> >> present) and other Spring beans are being shared appropriately.
> >> However, the Spring context is not being registered with the
> >> ApplicationContextEventProtocol, so events are not being propagated.
> >> In my brief debugging, it seems that when Terracotta gets to this
> >> block of com.tcspring.ApplicationContextEventProtocol (line 178 in
> >> version 2.5.4): synchronized (contexts) { context =
> >> (AbstractApplicationContext) contexts.get(ctxId); } context is coming
> >> back null. As a result, the logging statement on the next line says:
> >> 2008-04-07 00:02:16,965 749308 [main] INFO
> >> com.tcspring.ApplicationContextEventProtocol -
> >> 02080100050A01070C06050307010C05 Publishing event
> >> com
> >> .myapp.event.SystemEvent[source=0b9482b8-6bc3-4177-9fba-0a7c12a1e81e]
> >> to null Thread[main,5,main] Note that it is publishing "to null".
> >> Further digging reveals that
> >> com.tcspring.ApplicationContextEventProtocol.registerContext is never
> >> being called. I haven't dug beyond that. I haven't been able to pull
> >> together a test case for this error yet, as I'm on a strict timeline
> >> and trying to find ways to work around it. But I have included a
> >> tc-config file just in case I've configured it wrong.
> >> Any ideas?  Did I miss something simple?
> >>
> >  For one thing, Spring 2.5 isn't officially supported yet. On a good
> > side, work on Spring 2.5 had been started and there is a hope to see
> > it
> > in the near future. In a mean time you may want to check it it works
> > with the earlier Spring version.
> >
> >  Also, from your description it is unclear if it does work when
> > application is loaded in web app and it is also unclear how you load
> > your Spring context. So, if you'll decide to submit JIRA issue please
> > provide small test application that would allow to reproduce this
> > issue.
> >
> >  BTW, it is great to see that you were been able to debug the issue
> > down to this level.
> >
> >  Thanks
> >
> >  Eugene
> >
> >
> > _______________________________________________
> > tc-users mailing list
> > tc-users@...
> > http://lists.terracotta.org/mailman/listinfo/tc-users
>
> _______________________________________________
> tc-users mailing list
> tc-users@...
> http://lists.terracotta.org/mailman/listinfo/tc-users
>

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users

Re: Problem with Spring Events integration outside of a web application

by matt hoffman-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sure enough -- 2.0.5 works correctly.  Thanks for the help!
I'll send you my example when I can, and will keep an eye out for 2.5.2 compatibility.

Matt

On Tue, Apr 8, 2008 at 5:27 AM, Nitin Jain <njain@...> wrote:
You will see issues with 2.0.8 as well. We are working on supporting 2.5.2 as of now. Meanwhile can you post us your example that we can verify with our to be released 2.5.2 version

Thanks,
Nitin
----- Original Message -----
From: "matt hoffman" <matt@...>
To: tc-users@...
Sent: Monday, April 7, 2008 8:45:15 PM (GMT+0530) Asia/Calcutta
Subject: Re: [tc-users] Problem with Spring Events integration outside of a web application

Thanks for the quick reponse.  Sorry that I was unclear --  I ran into this
bug using Spring 2.0.8 (latest stable in the 2.0 branch); I may drop back to
2.0.5 to see if that makes a difference.  With 2.5, I didn't get this far --
Terracotta never registers the Spring context.
I dropped back from 2.5.3 to 2.0.8 to test Terracotta integration, so I'm
definitely excited to see TC support Spring 2.5.  I'll give that a try as
soon as its stable enough to develop with.

I haven't tested the exact same app loaded as a web application, but I have
traced through the Spring Events sample app that ships with TC.  That's my
basis for comparison.  That's the only difference I can see between the
Spring Events sample and my app, as far as loading Spring is concerned.

For the record, I'm loading Spring in a fairly typical way:

       ApplicationContext appContext = new
ClassPathXmlApplicationContext(new String[]{"*context.xml"});

There's nothing else fancy going on as far as Spring is concerned, and as I
said, TC is picking up the Spring context and mixing in the
DistributableBeanFactory interface, as expected.  Interestingly, this is the
same way that you're loading Spring in
the com.tctest.spring.AppContextEvents_Test.java unit test, so I can only
guess that something in the way that you hook directly into the L1 config (
the visitL1DSOConfig method) is bypassing the issue I'm seeing.

I started putting together a test app, but it will be a couple days until I
put more resources toward that;  I'll post a bug at that point, though.


Matt

On Mon, Apr 7, 2008 at 8:44 AM, Orion Letizi <orion@...> wrote:

> To Eugene's point, I'm pretty sure that Terracotta clustered Spring
> events doesn't work on Spring versions later than 2.0.5.  It
> *definitely* doesn't work on Spring versions >= 2.5.  Although, as
> Eugene says, we have a version of Spring support that works with
> Spring 2.5 currently in testing.  Not sure of its exact availability,
> but I can have someone get in touch with you about it if you'd like.
>
> --Orion
>
>
> On Apr 6, 2008, at 10:46 PM, Eugene Kuleshov wrote:
> > matt hoffman wrote:
> >> I'm pretty sure this is a bug, but I thought I'd post it here before
> >> sending it on to JIRA.
> >>
> >> When using the Spring Events integration inside an application that
> >> loads the Spring context explicitly (i.e. through a
> >> ClasspathXmlApplicationContext, as opposed to inside a web container)
> >> I'm unable to propagate Spring events. In fact, not only do the
> >> events
> >> not propagate to other TC clients, but they aren't multicast inside
> >> the Spring context either.
> >> When starting up the application, Terracotta is registering the
> >> Spring
> >> context (i.e. the logging statement "Context is distributed" is
> >> present) and other Spring beans are being shared appropriately.
> >> However, the Spring context is not being registered with the
> >> ApplicationContextEventProtocol, so events are not being propagated.
> >> In my brief debugging, it seems that when Terracotta gets to this
> >> block of com.tcspring.ApplicationContextEventProtocol (line 178 in
> >> version 2.5.4): synchronized (contexts) { context =
> >> (AbstractApplicationContext) contexts.get(ctxId); } context is coming
> >> back null. As a result, the logging statement on the next line says:
> >> 2008-04-07 00:02:16,965 749308 [main] INFO
> >> com.tcspring.ApplicationContextEventProtocol -
> >> 02080100050A01070C06050307010C05 Publishing event
> >> com
> >> .myapp.event.SystemEvent[source=0b9482b8-6bc3-4177-9fba-0a7c12a1e81e]
> >> to null Thread[main,5,main] Note that it is publishing "to null".
> >> Further digging reveals that
> >> com.tcspring.ApplicationContextEventProtocol.registerContext is never
> >> being called. I haven't dug beyond that. I haven't been able to pull
> >> together a test case for this error yet, as I'm on a strict timeline
> >> and trying to find ways to work around it. But I have included a
> >> tc-config file just in case I've configured it wrong.
> >> Any ideas?  Did I miss something simple?
> >>
> >  For one thing, Spring 2.5 isn't officially supported yet. On a good
> > side, work on Spring 2.5 had been started and there is a hope to see
> > it
> > in the near future. In a mean time you may want to check it it works
> > with the earlier Spring version.
> >
> >  Also, from your description it is unclear if it does work when
> > application is loaded in web app and it is also unclear how you load
> > your Spring context. So, if you'll decide to submit JIRA issue please
> > provide small test application that would allow to reproduce this
> > issue.
> >
> >  BTW, it is great to see that you were been able to debug the issue
> > down to this level.
> >
> >  Thanks
> >
> >  Eugene
> >
> >
> > _______________________________________________
> > tc-users mailing list
> > tc-users@...
> > http://lists.terracotta.org/mailman/listinfo/tc-users
>
> _______________________________________________
> tc-users mailing list
> tc-users@...
> http://lists.terracotta.org/mailman/listinfo/tc-users
>

_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users


_______________________________________________
tc-users mailing list
tc-users@...
http://lists.terracotta.org/mailman/listinfo/tc-users