Bug 948215 - Seam2.3 javax.naming.NameNotFoundException trying to call EJB Seam components from quartz asynchronous methods
Summary: Seam2.3 javax.naming.NameNotFoundException trying to call EJB Seam components...
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: JBoss Enterprise WFK Platform 2
Classification: Retired
Component: Seam
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 2.4.0
Assignee: Marek Novotny
QA Contact: Marek Schmidt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-04 10:33 UTC by Marek Schmidt
Modified: 2013-07-22 13:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
Calling EJB Seam components from non-EJB threads (for example asynchronous Quartz threads) does not work due to a different implementation of the JNDI pattern specification in Java EE 6. As a consequence, the javax.naming.NameNotFoundException exception is generated while looking for EJB components from a non-EJB thread. The workaround for this issue is actually the correct method of accessing EJB components: accessing EJB components from non-EJB threads by global JNDI and not by application JNDI.
Clone Of:
Environment:
Last Closed: 2013-07-22 13:20:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker WFK2-93 0 Major Closed Seam2.3 javax.naming.NameNotFoundException trying to call EJB Seam components from quartz asynchronous methods 2014-07-04 13:10:04 UTC

Description Marek Schmidt 2013-04-04 10:33:29 UTC
Description of problem:

Calling EJB Seam components from quartz threads used to work in Seam2.2 on EAP5, but it doesn't anymore in Seam2.3 on EAP6. javax.naming.NameNotFoundException occurs trying to lookup the bean.

Version-Release number of selected component (if applicable):
WFK 2.2.0.CR1


Steps to Reproduce:
1.

Modify the quartz example PaymentProcessor to move the logic of the methods into a new @Stateless component FooBean implements Foo

2. build and deploy the application
3. notice the error

12:26:00,020 ERROR [org.jboss.seam.async.AsynchronousExceptionHandler] (Sched1_Worker-1) Exception thrown whilst executing asynchronous call: org.jboss.seam.InstantiationException: Could not instantiate Seam compo
nent: foo
        at org.jboss.seam.Component.newInstance(Component.java:2208) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.Component.getInstance(Component.java:2034) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.Component.getInstance(Component.java:1996) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2414) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.Component.getValueToInject(Component.java:2366) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.Component.injectAttributes(Component.java:1743) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.Component.inject(Component.java:1561) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:52) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:191) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:109) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.example.quartz.PaymentProcessor_$$_javassist_seam_6.schedulePayment(PaymentProcessor_$$_javassist_seam_6.java) [quartz-ejb.jar:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09-icedtea]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09-icedtea]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea]
        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea]
        at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:62) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:243) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-1.6.5.jar:1.6.5]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) [quartz-1.6.5.jar:1.6.5]
Caused by: javax.naming.NameNotFoundException: java:app/quartz-ejb/FooBean
        at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:127)
        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:215)
        at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_09-icedtea]
        at org.jboss.seam.Component.instantiateSessionBean(Component.java:1407) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.Component.instantiate(Component.java:1370) [jboss-seam.jar:2.3.1.Final-redhat-1]
        at org.jboss.seam.Component.newInstance(Component.java:2186) [jboss-seam.jar:2.3.1.Final-redhat-1]
        ... 28 more


Additional info:

The workaround is to use global: JNDI names, e.g. put this into components.xml:

<component class="org.jboss.seam.example.quartz.FooBean" jndi-name="java:global/seam-quartz/quartz-ejb/FooBean"/>

Comment 1 Marek Schmidt 2013-04-08 10:19:01 UTC
This also affects Seam2.2 applications migrated to EAP6.

Comment 2 Sneha 2013-04-09 10:37:45 UTC
Updated Doc Text.

Comment 3 Petr Penicka 2013-04-19 13:32:20 UTC
Doc text edited and inserted into the 2.2.0 release notes book.

Docs stage URL: https://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Web_Framework_Kit/2.2/html-single/2.2.0_Release_Notes/index.html

Build: JBoss_Web_Framework_Kit-2.2.0_Release_Notes-2.2-en-US-0-26

Comment 4 Karel Piwko 2013-04-19 15:07:47 UTC
Verified content in RN.


Note You need to log in before you can comment on or make changes to this bug.