I have an application deployed under websphere. A webservice exposed does work and also writes a message to a channel which is hooked up to a service activator. A bean picks up the message from the channel and needs to write it to a database. The bean processing the message is throwing an error:
Caused by: com.pt.se.soa.exception.UnrecoverableException: Exception ID: ErrorNamespace: DisplayErrorCode: ErrorMessage:Exception occurred attempting to lookup the TransactionManager and check the status. Exception msg=A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component. This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request. Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE 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:" names.
Here's my config:
<si:channel id="ccc.performanceChannel"><si:queue capacity="1000"/></si:channel>
<bean id="ccc.TaskExecutor" class="org.springframework.scheduling.commonj.Work ManagerTaskExecutor">
<property name="workManagerName" value="wm/default" />
<si:service-activator id="ccc.performanceActivator" ref="ccc.performanceWorkerAT" method="onMessage" input-channel="ccc.performanceChannel">
<sioller fixed-delay="1000" task-executor="ccc.TaskExecutor">
<bean id="ccc.performanceWorkerAT" class="com.pt.performance.PerformanceWorkerATImpl" >
<property name="savePerformanceDataDAO" ref="ccc.savePerformanceDataDAO"/>
<bean id="ccc.savePerformanceDataDAO" class="com.pt.dao.SavePerformanceDataDAO">
<... data source is looked up from JNDI ...>
My code is trying to get the UOWManager:
final InitialContext initialContext = new InitialContext();
final UOWManager uowManager = (UOWManager) initialContext.lookup("java:comp/websphere/UOWManager");
which fails. I guess because the thread executing it is not managed by the J2EE container. How can I fix this issue?