-
1. Re: seam, spring activemq
gavin.king Mar 13, 2007 1:06 PM (in response to henderson_mk)In JBoss 4.0.x there is a bug which means that interceptors don't get fired for MDBs. You can either:
(a) call from the MDB to a session bean to do the work OR
(b) wait for JBoss 4.2
By the way, the architecturally correct way to use JMS from an appserver / in an EJB3 environment is to install it via JCA, not Spring. -
2. Re: seam, spring activemq
henderson_mk Mar 13, 2007 3:04 PM (in response to henderson_mk)i'm actually kinda running the app on tomcat Gavin.
Also the active mq broker is embedded and wired up via jencks to do message driven pojo's.....
dunno if that helps any? -
3. Re: seam, spring activemq
henderson_mk Mar 14, 2007 6:31 AM (in response to henderson_mk)ok... got it sorted.
if anyones interested.....
I just need to call Lifecycle.begnnCall() and end it, using the session inbetween. -
4. Re: seam, spring activemq
youngm Mar 14, 2007 11:40 AM (in response to henderson_mk)One other thing to try. What happens if you make your springHook a seam component by nesting <seam:component/> in the bean entry? Does that negate the need to call Lifecycle.beginCall()?
-
5. Re: seam, spring activemq
youngm Mar 14, 2007 11:43 AM (in response to henderson_mk)Actually you will have to do <seam:component intercept="ALWAYS" />
-
6. Re: seam, spring activemq
henderson_mk Mar 14, 2007 11:54 AM (in response to henderson_mk)hiya,
I previously had the SpringHook class setup like this:@Name("springHook") @Scope(APPLICATION) @Intercept(ALWAYS) @Startup public class SpringHook { private static Log log = LogFactory.getLog(SpringHook.class); @In(create=true) private Session svDatabase; public Session getSession(){return this.svDatabase;} public void setSession(Session s){this.svDatabase = s;} }
but that didn't work.
tried like so:<bean id="springHook" class="org.banana.utils.SpringHook" lazy-init="true"> <property name="session"><ref local="hibernateSession"/></property> <seam:component intercept="ALWAYS" /> </bean> <seam:instance name="svDatabase" id="hibernateSession" proxy="true"/>
but same error.exception is java.lang.IllegalStateException: No application context active caused by: java.lang.IllegalStateException: No application context active at org.jboss.seam.Component.forName(Component.java:1545) at org.jboss.seam.Component.getInstance(Component.java:1595) at org.jboss.seam.Component.getInstance(Component.java:1590) at org.jboss.seam.Component.getInstance(Component.java:1584)
-
7. Re: seam, spring activemq
youngm Mar 14, 2007 12:07 PM (in response to henderson_mk)hmm.....you're first attempt should have worked if you did the following:
1. Remove your spring bean reference.
2. Do <seam:instance id="springHook" name="springHook" proxy="true"/>
3. You probably will want to change the scope of your SpringHook Seam component to METHOD since I believe you may run into concurrency issues using APPLICATION scope with @In unless you make your method calls @Synchronized.
That's strange that <seam:component intercept="ALWAYS"/> Didn't work. I'll have to look at that one.
Let me know how the above turns out.
Mike -
8. Re: seam, spring activemq
henderson_mk Mar 14, 2007 12:18 PM (in response to henderson_mk)no luck .
changed it as you said:<bean id="listenerService" class="org.banana.services.UpdateListener" depends-on="broker1" lazy-init="true"> <property name="brokerService"><ref local="broker1"/></property> <property name="springHook"><ref local="springHook"/></property> </bean> <seam:instance id="springHook" name="springHook" proxy="true" /> @Name("springHook") @Scope(METHOD) @Intercept(ALWAYS) @Startup public class SpringHook { private static Log log = LogFactory.getLog(SpringHook.class); @In(create=true) private Session svDatabase; public void test(){ log.info("hib session=" + this.svDatabase); } public Session getSession(){return this.svDatabase;} public void setSession(Session s){this.svDatabase = s;} }
but its barfing on startup now with error that seams needs to be configured before spring.
not to worry... I have the workaround anyhoo.
thanks for the help! -
9. Re: seam, spring activemq
youngm Mar 14, 2007 12:30 PM (in response to henderson_mk)You're not bugging me. Something not working the way I expect it to work bugging me. :)
but its barfing on startup now with error that seams needs to be configured before spring.
This is probably the heart of the problem. The Spring ContextLoaderListener needs to be loaded after the SeamListener. It may be a matter of simply changing the order in your web.xml. In the next release you will be able to use seam:context-loader to load the spring application context as a seam component. Anyway, give it a try if you want.
Mike -
10. Re: seam, spring activemq
henderson_mk Mar 14, 2007 12:35 PM (in response to henderson_mk)i'll give it a lash tomorrow and change the order of stuff.... that was why i'd added the lazy-init stuff to the updateListener bean to try and make sure it it got created after seam got started.
ta for the help, and good work on the ioc library for seam too.