EJB or CDI in Nu Echo Rivr (VoiceXML Java library)

72 views Asked by At

I’ve tried CDI injection and @EJB injection of Stateless EJBs in a Rivr dialog. They don’t work. I’ve also tried JNDI lookup of the EJBs through the Global JNDI name but I get following error (note I am using java:global but I get this message):

A JNDI operation on a java:comp/env name cannot be completed because the current thread is not associated with a Java Enterprise Edition application component. This condition can occur when the JNDI client using the java:comp/env name does not occur on the thread of a server application request. Make sure that a Java EE application does not run JNDI operations on java:comp/env names within static code blocks or in threads created by that application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on java:comp/env names.

Is there anyway I can inject or locate CDI @Named or EJBs in a Rivr dialog?

thanks Ignacio

1

There are 1 answers

0
icordoba On BEST ANSWER

I examined the Spring example in Rivr cookbook and found that the DialogFactories are executed in the ServletThread. This allowed me to perform a standard JNDI lookup using the Global JNDI name successfully and pass the EJBs to the Dialog being created.

Rivr team confirmed this by email and I am now successfully accessing EJBs that way.

I could not perform standard @Inject or @EJB injections but the JNDI "traditional" solution worked for me.