portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deryk Sinotte (JIRA)" <jetspeed-...@portals.apache.org>
Subject [jira] Created: (JS2-734) Calling PortletContext.getResource in Portlet.init can throw NullPointerException
Date Thu, 14 Jun 2007 21:24:26 GMT
Calling PortletContext.getResource in Portlet.init can throw NullPointerException
---------------------------------------------------------------------------------

                 Key: JS2-734
                 URL: https://issues.apache.org/jira/browse/JS2-734
             Project: Jetspeed 2
          Issue Type: Bug
          Components: Container
    Affects Versions: 2.1
            Reporter: Deryk Sinotte


It's fairly easy to demonstrate the issue.  In the init() method of a simple Portlet, if I
attempt to get the PortletContext and then call getResource on it like so:

        PortletContext context = portletConfig.getPortletContext();
        try {
            URL resource = context.getResource("/");
        } catch (MalformedURLException e) {
             e.printStackTrace();
        }


I'll get the following:

2007-06-14 15:13:31,125 [http-8080-Processor25] ERROR org.apache.jetspeed.factory.JetspeedPortletFactory
- PortletFactory: Failed to load portlet foo.test.MyPortlet
java.lang.NullPointerException
        at org.apache.jetspeed.container.JetspeedPortletContext.getResource(JetspeedPortletContext.java:193)
        at foo.test.MyPortlet.init(Unknown Source)
        at org.apache.jetspeed.factory.JetspeedPortletInstance.init(JetspeedPortletInstance.java:84)
        at org.apache.jetspeed.factory.JetspeedPortletFactory.getPortletInstance(JetspeedPortletFactory.java:229)
        at org.apache.jetspeed.aggregator.impl.HeaderAggregatorImpl.renderHeaderFragment(HeaderAggregatorImpl.java:1056)
        at org.apache.jetspeed.aggregator.impl.HeaderAggregatorImpl.aggregateAndRender(HeaderAggregatorImpl.java:1037)
        at org.apache.jetspeed.aggregator.impl.HeaderAggregatorImpl.aggregateAndRender(HeaderAggregatorImpl.java:1029)
        at org.apache.jetspeed.aggregator.impl.HeaderAggregatorImpl.aggregateAndRender(HeaderAggregatorImpl.java:1029)
        at org.apache.jetspeed.aggregator.impl.HeaderAggregatorImpl.build(HeaderAggregatorImpl.java:1007)
        at org.apache.jetspeed.aggregator.HeaderAggregatorValve.invoke(HeaderAggregatorValve.java:48)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.decoration.DecorationValve.invoke(DecorationValve.java:97)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.pipeline.valve.impl.ActionValveImpl.invoke(ActionValveImpl.java:182)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.container.ContainerValve.invoke(ContainerValve.java:76)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.profiler.impl.ProfilerValveImpl.invoke(ProfilerValveImpl.java:255)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.security.impl.LoginValidationValveImpl.invoke(LoginValidationValveImpl.java:159)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.security.impl.PasswordCredentialValveImpl.invoke(PasswordCredentialValveImpl.java:149)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.localization.impl.LocalizationValveImpl.invoke(LocalizationValveImpl.java:169)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.security.impl.AbstractSecurityValve$1.run(AbstractSecurityValve.java:118)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:454)
        at org.apache.jetspeed.security.JSSubject.doAsPrivileged(JSSubject.java:195)
        at org.apache.jetspeed.security.impl.AbstractSecurityValve.invoke(AbstractSecurityValve.java:112)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.container.url.impl.PortalURLValveImpl.invoke(PortalURLValveImpl.java:67)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.capabilities.impl.CapabilityValveImpl.invoke(CapabilityValveImpl.java:128)
        at org.apache.jetspeed.pipeline.JetspeedPipeline$Invocation.invokeNext(JetspeedPipeline.java:166)
        at org.apache.jetspeed.pipeline.JetspeedPipeline.invoke(JetspeedPipeline.java:145)
        at org.apache.jetspeed.engine.JetspeedEngine.service(JetspeedEngine.java:214)
        at org.apache.jetspeed.engine.JetspeedServlet.doGet(JetspeedServlet.java:242)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
        at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:688)
        at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:44)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.jetspeed.engine.servlet.XXSUrlAttackFilter.doFilter(XXSUrlAttackFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:613)

It appears the PortletContext gets created but the wrapped servlet context that it uses is
null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message