JNDI session tracking fails during cross-context access

Description

If the user's JNDI session needs initialization during a cross-context call from a portlet the JNDI calls will fail due to classloader issues.

ERROR [org.jasig.portal.ChannelManager#61] portal.ChannelManager.[] Feb/02 15:16:17 - Failed to create channel JNDI Context. No JNDI context will be available for rendering channels.
javax.naming.NoInitialContextException: Cannot instantiate class: org.jasig.portal.jndi.DisposableMemoryContextFactory [Root exception is java.lang.ClassNotFoundException: org.jasig.portal.jndi.DisposableMemoryContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at org.springframework.jndi.JndiTemplate.createInitialContext(JndiTemplate.java:137)
at org.springframework.jndi.JndiTemplate.getContext(JndiTemplate.java:104)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:86)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at org.jasig.portal.ChannelManager.getChannelJndiContext(ChannelManager.java:190)
at org.jasig.portal.ChannelManager.<init>(ChannelManager.java:161)
at org.jasig.portal.UserInstance.<init>(UserInstance.java:71)
at org.jasig.portal.user.UserInstanceManagerImpl.getUserInstance(UserInstanceManagerImpl.java:115)
at org.jasig.portal.url.PortalHttpServletRequest.getLocale(PortalHttpServletRequest.java:223)
at org.jasig.portal.url.AbstractHttpServletRequestWrapper.getLocale(AbstractHttpServletRequestWrapper.java:108)
at javax.servlet.ServletRequestWrapper.getLocale(ServletRequestWrapper.java:307)
at javax.servlet.ServletRequestWrapper.getLocale(ServletRequestWrapper.java:307)
at org.apache.pluto.internal.impl.PortletRequestImpl.getLocale(PortletRequestImpl.java:488)
at javax.portlet.GenericPortlet.getTitle(GenericPortlet.java:198)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:174)
at org.apache.pluto.core.PortletServlet.dispatch(PortletServlet.java:208)
at org.apache.pluto.core.PortletServlet.doGet(PortletServlet.java:139)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
at org.apache.pluto.core.DefaultPortletInvokerService.invoke(DefaultPortletInvokerService.java:167)
at org.apache.pluto.core.DefaultPortletInvokerService.render(DefaultPortletInvokerService.java:101)
at org.apache.pluto.core.PortletContainerImpl.doRender(PortletContainerImpl.java:172)
at org.jasig.portal.channels.portlet.SpringPortletChannelImpl.render(SpringPortletChannelImpl.java:540)
at org.jasig.portal.channels.portlet.CSpringPortletAdaptor.renderCharacters(CSpringPortletAdaptor.java:197)
at org.jasig.portal.ChannelRenderer$Worker.execute(ChannelRenderer.java:596)
at org.jasig.portal.utils.threading.BaseTask.run(BaseTask.java:27)
at sun.reflect.GeneratedMethodAccessor152.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.orm.jpa.JpaInterceptor.invoke(JpaInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at org.jasig.portal.$Proxy50.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: org.jasig.portal.jndi.DisposableMemoryContextFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
... 51 more

Environment

None

Activity

Show:
Eric Dalquist
February 3, 2009, 6:58 PM

JndiManagerImpl should be modified to catch all exceptions and never fail even if the operations don't execute correctly. The service should also be reviewed for functionality to see if it should be deprecated or not.

Eric Dalquist
December 4, 2009, 4:56 AM

Switch the thread's context classloader to the uPortal classloader explicitly during the JNDI lookup to try and avoid the ClassNotFoundException for a uPortal class.

Fixed

Assignee

Eric Dalquist

Reporter

Eric Dalquist

Labels

None

Estimated End Date

None

Fix versions

Affects versions

Priority

Major