Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
07. Jun 2008, 01:50 CET | Link

I don't have an application context in my mdb. I am very confident this is a configuration/self inflicted issue - the message bean in the remoting/chat example has an application context and I pretty much ripped of the code from there.

Some background info

  • The mdb is annotated with @Name
  • The SubscriptionRegistry is configured in components.xml

I recv messages no problem, however when I inject a logger it is null. When I check the application context ( Context.isApplicationContextActive ) I get a false.

If there is anyone who could point me in the right direction I would really appreciate it.

thanks in advance,

g

6 Replies:
03. Sep 2008, 20:25 CET | Link

bump.

for an MDB that is also a seam component

@MessageDriven(activationConfig={
        @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
        @ActivationConfigProperty(propertyName="destination",     propertyValue="/queue/listUpload")
    })
@Name("loaderInitListener")
public class LoaderInitListener implements MessageListener {...}

... running under JBoss 4.2.{2,3} ...

10:43:43,312 INFO  [STDOUT] 10:43:43,312 INFO  [Component] Component: loaderInitListener, scope: STATELESS, type: MESSAGE_DRIVEN_BEAN, class: com.innovativeinfo.task.list.loader.LoaderInitListener, JNDI: backend-1.0/LoaderInitListener/local

... component injection fails and there is No Application Context active.

However, running the same MDB from a SeamTest with the embeddable EJB container works. My next step is to try with Jboss AS 5. Has anyone been able to get this to work under JBoss 4.2.x?

04. Sep 2008, 01:28 CET | Link

I have managed to get component injection into a MDB with JBoss AS 4.2.3 by creating a new project with seam-gen and doing a simple example. Now trying to figure out what configuration difference exists in the other (maven2 based) project.

04. Sep 2008, 02:17 CET | Link

Gary,

We have got this working in our application running in JBoss 4.2.0GA/Seam 2.0.1GA. Our MDB is a very important part of the application so we have done much work in this area.

One of our architecture issues we needed to solve was in the fact that, on server startup, if the queue the MDB was listening on had messages that could be dispatched, the MDB started processing the messages BEFORE the application context was active and we would get the error you are talking about.

We have other non-Seam MDBs and we have solved this issue using the @Depends annotation, but could never get it working with our Seam MDBs.

We have a solution for this that works. Let me know if you think this is the issue and I will post the solution.

Cory.

27. Sep 2008, 01:20 CET | Link
Cory Dahlstrom wrote on Sep 04, 2008 02:17:
We have a solution for this that works. Let me know if you think this is the issue and I will post the solution. Cory.

Cory, I'm running into this exact problem. I'd love to find out how you solved it.

05. Sep 2008, 00:57 CET | Link

Seam 2.0.2SP1, JBoss 4.2.3

Following up: I'm confident there is no JMS timing issue in my case since I am manually triggering the messages after the application is deployed.

I have been comparing a Seam MDB that works, and another that doesn't. Both MDBs are deployed inside JARs that are also EJB modules of an EAR.

Comparing the server deployment output:

Registering the MDB with the EJB container (finding the @MessageDriven annotation?)

<example1>
14:44:58,171 INFO  [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.mdb.MDB
14:44:58,171 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=mdbTest.ear,jar=mdbTest.jar,name=MdbTest,service=EJB3 with dependencies:
14:44:58,171 INFO  [EJBContainer] STARTED EJB: com.innovativeinfo.mdbTest.MdbTest ejbName: MdbTest

<example2>
14:57:48,406 INFO  [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.mdb.MDB
14:57:48,406 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=backend-1.0.ear,jar=list-loader-1.0.jar,name=LoaderInitListener,service=EJB3 with dependencies:
14:57:48,406 INFO  [EJBContainer] STARTED EJB: com.innovativeinfo.task.list.loader.LoaderInitListener ejbName: LoaderInitListener

Registering the MDB with Seam (finding the @Name annotation?)

<example1>
14:45:02,718 INFO  [Component] Component: mdbTest, scope: STATELESS, type: MESSAGE_DRIVEN_BEAN, class: com.innovativeinfo.mdbTest.MdbTest, JNDI: mdbTest/MdbTest/local

<example2>
14:58:01,953 INFO  [Component] Component: loaderInitListener, scope: STATELESS, type: MESSAGE_DRIVEN_BEAN, class: com.innovativeinfo.task.list.loader.LoaderInitListener, JNDI: backend-1.0/LoaderInitListener/local

Stacktrace when the JMS message is received inside the MDB's onMessage():

<example1>
Daemon Thread [WorkManager(2)-18] (Suspended (breakpoint at line 27 in MdbTest))	
	MdbTest.onMessage(Message) line: 27	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 585	
>	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 112	
>	InvocationContextImpl.proceed() line: 166	
>	EJBInvocationContext.proceed() line: 44	
>	EE5SeamInvocationContext(SeamInvocationContext).proceed() line: 56	
>	RollbackInterceptor.aroundInvoke(InvocationContext) line: 31	
>	EE5SeamInvocationContext(SeamInvocationContext).proceed() line: 68	
>	BijectionInterceptor.aroundInvoke(InvocationContext) line: 46	
>	EE5SeamInvocationContext(SeamInvocationContext).proceed() line: 68	
>	MethodContextInterceptor.aroundInvoke(InvocationContext) line: 42	
>	EE5SeamInvocationContext(SeamInvocationContext).proceed() line: 68	
>	SeamInterceptor(RootInterceptor).invoke(InvocationContext, EventType) line: 118	
>	SeamInterceptor(SessionBeanInterceptor).aroundInvoke(InvocationContext) line: 50	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 585	
	InvocationContextImpl.proceed() line: 118	
	EJB3InterceptorsInterceptor.invoke(Invocation) line: 63	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	TransactionScopedEntityManagerInterceptor.invoke(Invocation) line: 54	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	AllowedOperationsInterceptor.invoke(Invocation) line: 47	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	Ejb3TxPolicy(TxPolicy).invokeInCallerTx(Invocation, Transaction) line: 126	
	TxInterceptor$Required.invoke(Invocation) line: 195	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	StatelessInstanceInterceptor.invoke(Invocation) line: 62	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	MDB(MessagingContainer).localInvoke(MethodInfo, Object[]) line: 249	
	MessageInflowLocalProxy.delivery(Object, MessagingContainer, Method, Object[]) line: 268	
	MessageInflowLocalProxy.invoke(Object, Method, Object[]) line: 138	
	$Proxy345.onMessage(Message) line: not available	
	JmsServerSession.onMessage(Message) line: 178	
	SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessage) line: 906	
	SpyMessageConsumer.addMessage(SpyMessage) line: 170	
	SpySession.run() line: 323	
	JmsServerSession.run() line: 237	
	WorkWrapper.execute() line: 204	
	WorkWrapper(BasicTaskWrapper).run() line: 275	
	PooledExecutor$Worker.run() line: 756	
	Thread.run() line: 595	

<example2>
Daemon Thread [WorkManager(2)-12] (Suspended (entry into method onMessage in LoaderInitListener))	
	LoaderInitListener.onMessage(Message) line: 38	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 585	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 112	
	InvocationContextImpl.proceed() line: 166	
	EJB3InterceptorsInterceptor.invoke(Invocation) line: 63	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	TransactionScopedEntityManagerInterceptor.invoke(Invocation) line: 54	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	AllowedOperationsInterceptor.invoke(Invocation) line: 47	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	Ejb3TxPolicy(TxPolicy).invokeInCallerTx(Invocation, Transaction) line: 126	
	TxInterceptor$Required.invoke(Invocation) line: 195	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	StatelessInstanceInterceptor.invoke(Invocation) line: 62	
	EJBContainerInvocation<A,T>(MethodInvocation).invokeNext() line: 101	
	MDB(MessagingContainer).localInvoke(MethodInfo, Object[]) line: 249	
	MessageInflowLocalProxy.delivery(Object, MessagingContainer, Method, Object[]) line: 268	
	MessageInflowLocalProxy.invoke(Object, Method, Object[]) line: 138	
	$Proxy111.onMessage(Message) line: not available	
	JmsServerSession.onMessage(Message) line: 178	
	SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessage) line: 906	
	SpyMessageConsumer.addMessage(SpyMessage) line: 170	
	SpySession.run() line: 323	
	JmsServerSession.run() line: 237	
	WorkWrapper.execute() line: 204	
	WorkWrapper(BasicTaskWrapper).run() line: 275	
	PooledExecutor$Worker.run() line: 756	
	Thread.run() line: 595	

It seems pretty clear that a set of seam related interceptors are missing when the 2nd MDB is instantiated/called by the EJB container. Any suggestions on other places I can check to confirm that the 2nd MDB is deployed correctly?

Cheers

05. Sep 2008, 23:06 CET | Link

solved. was missing an ejb-jar.xml in the EJB module.