You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by "Ayres, Nate R" <Na...@reyrey.com> on 2007/08/23 19:13:13 UTC

NullPointerException accessing members of the PortletContext

Hi all,

 

I recently installed Jetspeed 2.1.2 on Linux with a MySQL DB and
everything is working fine with one exception. I am encountering null
pointers whenever I attempt to access the members of the PortletContext
in my own portlets.  Here's a simple example that will fail:

 

 

public class GraphListPortlet extends GenericPortlet {

            protected void doView(RenderRequest request, RenderResponse
response)

                        throws PortletException, IOException

            {

                        response.setContentType("text/html");

 

        PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher("/jsp/view.jsp");

 

        prd.include(request, response);

 

 

            }

}

 

 

The PortletRequestDispatcher will be received as null here and the
include method will throw the exception.  Likewise if I attempt to
access getPortletContext().getPortletContextName() it will also throw a
NullPointerException.  I have stepped through the portlet using the
Eclipse remote debug tool for Tomcat and have noticed that the
servletContext inside the JetspeedPortletConfig object is null, which
seems to at least be the source of the getPorletContextName() problem
(line 257 of JetspeedPortletContext.java attempts to access a member of
that servletContext). Any ideas on why the servletContext isn't
initializing correctly? I haven't been able to find any problems with my
portlet.xml or web.xml when comparing them to working examples.

 

Thanks,

Nate Ayres

 


RE: NullPointerException accessing members of the PortletContext

Posted by Mohan K <km...@gmail.com>.
Nate,
No problem. That is why if you notice correctly, I asked to package the war
in the (graphlist.war) and drop that in the WEB-INF/deploy :)
Cheers
Mohan

-----Original Message-----
From: Ayres, Nate R [mailto:Nate_Ayres@reyrey.com] 
Sent: Friday, August 24, 2007 11:02 AM
To: Jetspeed Users List
Subject: RE: NullPointerException accessing members of the PortletContext

Well, it didn't deploy, which was the reason I had started trying the
/local deploy directory in the first place, but since you had me paying
attention to the logs this time I found out why. :)

Apparently my Ant build script of all things was copying the WEB-INF/jsp
folder in twice and when Jetspeed went to deploy the WAR it would
encounter the view.jsp twice in the same directory and throw a
ZipException halting the installation.  I don't know why this didn't
affect the extraction during the deployment from the /local directory,
but when I deployed it from there the JetspeedContainerServlet didn't
initialize the portlet application as it does for this deployment
directory.

Big thanks for all the help Mohan, I'd been extremely frustrated over
this one for the past couple days. I really hate getting caught up on
the little things.

Nate Ayres

-----Original Message-----
From: Mohan K [mailto:kmoh.raj@gmail.com] 
Sent: Friday, August 24, 2007 10:11 AM
To: 'Jetspeed Users List'
Subject: RE: NullPointerException accessing members of the
PortletContext

Nate,
I believe that might be your problem, Jetspeed has a "local" portlet
application type (which I might not very familiar with, I believe the
Jetspeed- prefix is magical). Unless you are building a local portlet
app.
If you are not then:
Do this:
 - delete your portlet web-app that you currently have. (Make sure
Jetspeed
has no reference to it, check the portlet selector, remove the portlet
from
the PSML.
 - stop your tomcat, go to <Jetspeed webapp>/jetspeed/WEB-INF/apps and
make
sure Jetspeed-Graphlist directory/folder if present is deleted.
 - keep your original web.xml (remove the container servlet entry).
 - just name your portlet web app as GraphList.war. (do NOT prefix with
jetspeed-)
 - Drop the graphlist.war to <webapp>/jetspeed/WEB-INF/deploy  (NOT
local)
 - Start your container
Let us know what happens
Cheers
Mohan

-----Original Message-----
From: Ayres, Nate R [mailto:Nate_Ayres@reyrey.com] 
Sent: Friday, August 24, 2007 10:00 AM
To: Jetspeed Users List
Subject: RE: NullPointerException accessing members of the
PortletContext

Thanks Mohan, but it didn't work.  I completely removed the existing
portlet and redeployed it in webapps/jetspeed/WEB-INF/deploy as
jetspeed-GraphList.war with a contextName of jetspeed-GraphList in
web.xml, but the servletContext is still null at runtime.  I didn't see
anything in catalina.out to indicate that the portlet webapp was
registered as you said it should be, but the portlet was available for
adding to the PSML and was extracted to the
webapps/jetspeed/WEB-INF/apps directory.

Nate Ayres

-----Original Message-----
From: Mohan K [mailto:kmoh.raj@gmail.com] 
Sent: Friday, August 24, 2007 9:36 AM
To: 'Jetspeed Users List'
Subject: RE: NullPointerException accessing members of the
PortletContext

Hello Nates,
You should be deploying it to webapps/jetspeed/WEB-INF/deploy not local,
I
believe local implies a different portal application (like the layouts)
and
your context would have jetspeed-  as a prefix (I am not sure about
this).
- I would  unregister/undeploy and delete your current portlet web-app
(Using PALM in the admin console). 
- if you intend to keep your web.xml with the Jetspeed container servlet
(as
in your e-mail), then you can just drop the portlet web app in <webapps>
and Jetspeed should be able to register the portlet webapp (u should
check
and make sure that it is spitted out in the log file, usually in
Catalina.out)
Good luck
Mohan
 

-----Original Message-----
From: Ayres, Nate R [mailto:Nate_Ayres@reyrey.com] 
Sent: Friday, August 24, 2007 8:26 AM
To: Jetspeed Users List
Subject: RE: NullPointerException accessing members of the
PortletContext

Hi Woonsan,

I have been deploying the application to
/webapps/jetspeed/WEB-INF/deploy/local as the WAR filename does not
start with "jetspeed-" (although I tried changing that and it deploying
it in the other directory too).


My web.xml was originally just the generic:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>
</web-app>


But after your e-mail below I changed it to the following (based off of
the web.xml for the jetspeed-layouts portlet):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>

	<servlet>
		<servlet-name>JetspeedContainer</servlet-name>
		<display-name>Jetspeed Container</display-name>
		<description>
			MVC Servlet for Jetspeed Portlet Applications
		</description>
		<servlet-class>
	
org.apache.jetspeed.container.JetspeedContainerServlet
		</servlet-class>
		<init-param>
			<param-name>contextName</param-name>
			<param-value>GraphList</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>JetspeedContainer</servlet-name>
		<url-pattern>/container/*</url-pattern>
	</servlet-mapping>

</web-app>

It did not seem to have any effect, after redeploying the application I
am still getting the NullPointerException on the same line.  Is this
web.xml correctly formatted for my portlet in GraphList.war?

Thanks for your assistance,
Nate Ayres

-----Original Message-----
From: Woonsan Ko [mailto:woon_san@yahoo.com] 
Sent: Friday, August 24, 2007 12:10 AM
To: Jetspeed Users List
Subject: Re: NullPointerException accessing members of the
PortletContext

Hi Nate,

Did you deploy your portlet application by copying the war file to
/webapps/jetspeed/WEB-INF/deploy ?
Or, does the web.xml contain right *contextName* for JetspeedContainer
servlet?

-Woonsan

--- "Ayres, Nate R" <Na...@reyrey.com> wrote:

> Hi all,
> 
>  
> 
> I recently installed Jetspeed 2.1.2 on Linux with a MySQL DB and
> everything is working fine with one exception. I am encountering null
> pointers whenever I attempt to access the members of the
PortletContext
> in my own portlets.  Here's a simple example that will fail:
> 
>  
> 
>  
> 
> public class GraphListPortlet extends GenericPortlet {
> 
>             protected void doView(RenderRequest request,
RenderResponse
> response)
> 
>                         throws PortletException, IOException
> 
>             {
> 
>                         response.setContentType("text/html");
> 
>  
> 
>         PortletRequestDispatcher prd =
> getPortletContext().getRequestDispatcher("/jsp/view.jsp");
> 
>  
> 
>         prd.include(request, response);
> 
>  
> 
>  
> 
>             }
> 
> }
> 
>  
> 
>  
> 
> The PortletRequestDispatcher will be received as null here and the
> include method will throw the exception.  Likewise if I attempt to
> access getPortletContext().getPortletContextName() it will also throw
a
> NullPointerException.  I have stepped through the portlet using the
> Eclipse remote debug tool for Tomcat and have noticed that the
> servletContext inside the JetspeedPortletConfig object is null, which
> seems to at least be the source of the getPorletContextName() problem
> (line 257 of JetspeedPortletContext.java attempts to access a member
of
> that servletContext). Any ideas on why the servletContext isn't
> initializing correctly? I haven't been able to find any problems with
my
> portlet.xml or web.xml when comparing them to working examples.
> 
>  
> 
> Thanks,
> 
> Nate Ayres
> 
>  
> 
> 



       
________________________________________________________________________
____________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's
updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

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

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



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

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


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

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


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


RE: NullPointerException accessing members of the PortletContext

Posted by "Ayres, Nate R" <Na...@reyrey.com>.
Well, it didn't deploy, which was the reason I had started trying the
/local deploy directory in the first place, but since you had me paying
attention to the logs this time I found out why. :)

Apparently my Ant build script of all things was copying the WEB-INF/jsp
folder in twice and when Jetspeed went to deploy the WAR it would
encounter the view.jsp twice in the same directory and throw a
ZipException halting the installation.  I don't know why this didn't
affect the extraction during the deployment from the /local directory,
but when I deployed it from there the JetspeedContainerServlet didn't
initialize the portlet application as it does for this deployment
directory.

Big thanks for all the help Mohan, I'd been extremely frustrated over
this one for the past couple days. I really hate getting caught up on
the little things.

Nate Ayres

-----Original Message-----
From: Mohan K [mailto:kmoh.raj@gmail.com] 
Sent: Friday, August 24, 2007 10:11 AM
To: 'Jetspeed Users List'
Subject: RE: NullPointerException accessing members of the
PortletContext

Nate,
I believe that might be your problem, Jetspeed has a "local" portlet
application type (which I might not very familiar with, I believe the
Jetspeed- prefix is magical). Unless you are building a local portlet
app.
If you are not then:
Do this:
 - delete your portlet web-app that you currently have. (Make sure
Jetspeed
has no reference to it, check the portlet selector, remove the portlet
from
the PSML.
 - stop your tomcat, go to <Jetspeed webapp>/jetspeed/WEB-INF/apps and
make
sure Jetspeed-Graphlist directory/folder if present is deleted.
 - keep your original web.xml (remove the container servlet entry).
 - just name your portlet web app as GraphList.war. (do NOT prefix with
jetspeed-)
 - Drop the graphlist.war to <webapp>/jetspeed/WEB-INF/deploy  (NOT
local)
 - Start your container
Let us know what happens
Cheers
Mohan

-----Original Message-----
From: Ayres, Nate R [mailto:Nate_Ayres@reyrey.com] 
Sent: Friday, August 24, 2007 10:00 AM
To: Jetspeed Users List
Subject: RE: NullPointerException accessing members of the
PortletContext

Thanks Mohan, but it didn't work.  I completely removed the existing
portlet and redeployed it in webapps/jetspeed/WEB-INF/deploy as
jetspeed-GraphList.war with a contextName of jetspeed-GraphList in
web.xml, but the servletContext is still null at runtime.  I didn't see
anything in catalina.out to indicate that the portlet webapp was
registered as you said it should be, but the portlet was available for
adding to the PSML and was extracted to the
webapps/jetspeed/WEB-INF/apps directory.

Nate Ayres

-----Original Message-----
From: Mohan K [mailto:kmoh.raj@gmail.com] 
Sent: Friday, August 24, 2007 9:36 AM
To: 'Jetspeed Users List'
Subject: RE: NullPointerException accessing members of the
PortletContext

Hello Nates,
You should be deploying it to webapps/jetspeed/WEB-INF/deploy not local,
I
believe local implies a different portal application (like the layouts)
and
your context would have jetspeed-  as a prefix (I am not sure about
this).
- I would  unregister/undeploy and delete your current portlet web-app
(Using PALM in the admin console). 
- if you intend to keep your web.xml with the Jetspeed container servlet
(as
in your e-mail), then you can just drop the portlet web app in <webapps>
and Jetspeed should be able to register the portlet webapp (u should
check
and make sure that it is spitted out in the log file, usually in
Catalina.out)
Good luck
Mohan
 

-----Original Message-----
From: Ayres, Nate R [mailto:Nate_Ayres@reyrey.com] 
Sent: Friday, August 24, 2007 8:26 AM
To: Jetspeed Users List
Subject: RE: NullPointerException accessing members of the
PortletContext

Hi Woonsan,

I have been deploying the application to
/webapps/jetspeed/WEB-INF/deploy/local as the WAR filename does not
start with "jetspeed-" (although I tried changing that and it deploying
it in the other directory too).


My web.xml was originally just the generic:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>
</web-app>


But after your e-mail below I changed it to the following (based off of
the web.xml for the jetspeed-layouts portlet):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>

	<servlet>
		<servlet-name>JetspeedContainer</servlet-name>
		<display-name>Jetspeed Container</display-name>
		<description>
			MVC Servlet for Jetspeed Portlet Applications
		</description>
		<servlet-class>
	
org.apache.jetspeed.container.JetspeedContainerServlet
		</servlet-class>
		<init-param>
			<param-name>contextName</param-name>
			<param-value>GraphList</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>JetspeedContainer</servlet-name>
		<url-pattern>/container/*</url-pattern>
	</servlet-mapping>

</web-app>

It did not seem to have any effect, after redeploying the application I
am still getting the NullPointerException on the same line.  Is this
web.xml correctly formatted for my portlet in GraphList.war?

Thanks for your assistance,
Nate Ayres

-----Original Message-----
From: Woonsan Ko [mailto:woon_san@yahoo.com] 
Sent: Friday, August 24, 2007 12:10 AM
To: Jetspeed Users List
Subject: Re: NullPointerException accessing members of the
PortletContext

Hi Nate,

Did you deploy your portlet application by copying the war file to
/webapps/jetspeed/WEB-INF/deploy ?
Or, does the web.xml contain right *contextName* for JetspeedContainer
servlet?

-Woonsan

--- "Ayres, Nate R" <Na...@reyrey.com> wrote:

> Hi all,
> 
>  
> 
> I recently installed Jetspeed 2.1.2 on Linux with a MySQL DB and
> everything is working fine with one exception. I am encountering null
> pointers whenever I attempt to access the members of the
PortletContext
> in my own portlets.  Here's a simple example that will fail:
> 
>  
> 
>  
> 
> public class GraphListPortlet extends GenericPortlet {
> 
>             protected void doView(RenderRequest request,
RenderResponse
> response)
> 
>                         throws PortletException, IOException
> 
>             {
> 
>                         response.setContentType("text/html");
> 
>  
> 
>         PortletRequestDispatcher prd =
> getPortletContext().getRequestDispatcher("/jsp/view.jsp");
> 
>  
> 
>         prd.include(request, response);
> 
>  
> 
>  
> 
>             }
> 
> }
> 
>  
> 
>  
> 
> The PortletRequestDispatcher will be received as null here and the
> include method will throw the exception.  Likewise if I attempt to
> access getPortletContext().getPortletContextName() it will also throw
a
> NullPointerException.  I have stepped through the portlet using the
> Eclipse remote debug tool for Tomcat and have noticed that the
> servletContext inside the JetspeedPortletConfig object is null, which
> seems to at least be the source of the getPorletContextName() problem
> (line 257 of JetspeedPortletContext.java attempts to access a member
of
> that servletContext). Any ideas on why the servletContext isn't
> initializing correctly? I haven't been able to find any problems with
my
> portlet.xml or web.xml when comparing them to working examples.
> 
>  
> 
> Thanks,
> 
> Nate Ayres
> 
>  
> 
> 



       
________________________________________________________________________
____________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's
updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

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

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



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

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


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

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


RE: NullPointerException accessing members of the PortletContext

Posted by Mohan K <km...@gmail.com>.
Nate,
I believe that might be your problem, Jetspeed has a "local" portlet
application type (which I might not very familiar with, I believe the
Jetspeed- prefix is magical). Unless you are building a local portlet app.
If you are not then:
Do this:
 - delete your portlet web-app that you currently have. (Make sure Jetspeed
has no reference to it, check the portlet selector, remove the portlet from
the PSML.
 - stop your tomcat, go to <Jetspeed webapp>/jetspeed/WEB-INF/apps and make
sure Jetspeed-Graphlist directory/folder if present is deleted.
 - keep your original web.xml (remove the container servlet entry).
 - just name your portlet web app as GraphList.war. (do NOT prefix with
jetspeed-)
 - Drop the graphlist.war to <webapp>/jetspeed/WEB-INF/deploy  (NOT local)
 - Start your container
Let us know what happens
Cheers
Mohan

-----Original Message-----
From: Ayres, Nate R [mailto:Nate_Ayres@reyrey.com] 
Sent: Friday, August 24, 2007 10:00 AM
To: Jetspeed Users List
Subject: RE: NullPointerException accessing members of the PortletContext

Thanks Mohan, but it didn't work.  I completely removed the existing
portlet and redeployed it in webapps/jetspeed/WEB-INF/deploy as
jetspeed-GraphList.war with a contextName of jetspeed-GraphList in
web.xml, but the servletContext is still null at runtime.  I didn't see
anything in catalina.out to indicate that the portlet webapp was
registered as you said it should be, but the portlet was available for
adding to the PSML and was extracted to the
webapps/jetspeed/WEB-INF/apps directory.

Nate Ayres

-----Original Message-----
From: Mohan K [mailto:kmoh.raj@gmail.com] 
Sent: Friday, August 24, 2007 9:36 AM
To: 'Jetspeed Users List'
Subject: RE: NullPointerException accessing members of the
PortletContext

Hello Nates,
You should be deploying it to webapps/jetspeed/WEB-INF/deploy not local,
I
believe local implies a different portal application (like the layouts)
and
your context would have jetspeed-  as a prefix (I am not sure about
this).
- I would  unregister/undeploy and delete your current portlet web-app
(Using PALM in the admin console). 
- if you intend to keep your web.xml with the Jetspeed container servlet
(as
in your e-mail), then you can just drop the portlet web app in <webapps>
and Jetspeed should be able to register the portlet webapp (u should
check
and make sure that it is spitted out in the log file, usually in
Catalina.out)
Good luck
Mohan
 

-----Original Message-----
From: Ayres, Nate R [mailto:Nate_Ayres@reyrey.com] 
Sent: Friday, August 24, 2007 8:26 AM
To: Jetspeed Users List
Subject: RE: NullPointerException accessing members of the
PortletContext

Hi Woonsan,

I have been deploying the application to
/webapps/jetspeed/WEB-INF/deploy/local as the WAR filename does not
start with "jetspeed-" (although I tried changing that and it deploying
it in the other directory too).


My web.xml was originally just the generic:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>
</web-app>


But after your e-mail below I changed it to the following (based off of
the web.xml for the jetspeed-layouts portlet):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>

	<servlet>
		<servlet-name>JetspeedContainer</servlet-name>
		<display-name>Jetspeed Container</display-name>
		<description>
			MVC Servlet for Jetspeed Portlet Applications
		</description>
		<servlet-class>
	
org.apache.jetspeed.container.JetspeedContainerServlet
		</servlet-class>
		<init-param>
			<param-name>contextName</param-name>
			<param-value>GraphList</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>JetspeedContainer</servlet-name>
		<url-pattern>/container/*</url-pattern>
	</servlet-mapping>

</web-app>

It did not seem to have any effect, after redeploying the application I
am still getting the NullPointerException on the same line.  Is this
web.xml correctly formatted for my portlet in GraphList.war?

Thanks for your assistance,
Nate Ayres

-----Original Message-----
From: Woonsan Ko [mailto:woon_san@yahoo.com] 
Sent: Friday, August 24, 2007 12:10 AM
To: Jetspeed Users List
Subject: Re: NullPointerException accessing members of the
PortletContext

Hi Nate,

Did you deploy your portlet application by copying the war file to
/webapps/jetspeed/WEB-INF/deploy ?
Or, does the web.xml contain right *contextName* for JetspeedContainer
servlet?

-Woonsan

--- "Ayres, Nate R" <Na...@reyrey.com> wrote:

> Hi all,
> 
>  
> 
> I recently installed Jetspeed 2.1.2 on Linux with a MySQL DB and
> everything is working fine with one exception. I am encountering null
> pointers whenever I attempt to access the members of the
PortletContext
> in my own portlets.  Here's a simple example that will fail:
> 
>  
> 
>  
> 
> public class GraphListPortlet extends GenericPortlet {
> 
>             protected void doView(RenderRequest request,
RenderResponse
> response)
> 
>                         throws PortletException, IOException
> 
>             {
> 
>                         response.setContentType("text/html");
> 
>  
> 
>         PortletRequestDispatcher prd =
> getPortletContext().getRequestDispatcher("/jsp/view.jsp");
> 
>  
> 
>         prd.include(request, response);
> 
>  
> 
>  
> 
>             }
> 
> }
> 
>  
> 
>  
> 
> The PortletRequestDispatcher will be received as null here and the
> include method will throw the exception.  Likewise if I attempt to
> access getPortletContext().getPortletContextName() it will also throw
a
> NullPointerException.  I have stepped through the portlet using the
> Eclipse remote debug tool for Tomcat and have noticed that the
> servletContext inside the JetspeedPortletConfig object is null, which
> seems to at least be the source of the getPorletContextName() problem
> (line 257 of JetspeedPortletContext.java attempts to access a member
of
> that servletContext). Any ideas on why the servletContext isn't
> initializing correctly? I haven't been able to find any problems with
my
> portlet.xml or web.xml when comparing them to working examples.
> 
>  
> 
> Thanks,
> 
> Nate Ayres
> 
>  
> 
> 



       
________________________________________________________________________
____________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's
updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

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

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



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

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


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


RE: NullPointerException accessing members of the PortletContext

Posted by "Ayres, Nate R" <Na...@reyrey.com>.
Thanks Mohan, but it didn't work.  I completely removed the existing
portlet and redeployed it in webapps/jetspeed/WEB-INF/deploy as
jetspeed-GraphList.war with a contextName of jetspeed-GraphList in
web.xml, but the servletContext is still null at runtime.  I didn't see
anything in catalina.out to indicate that the portlet webapp was
registered as you said it should be, but the portlet was available for
adding to the PSML and was extracted to the
webapps/jetspeed/WEB-INF/apps directory.

Nate Ayres

-----Original Message-----
From: Mohan K [mailto:kmoh.raj@gmail.com] 
Sent: Friday, August 24, 2007 9:36 AM
To: 'Jetspeed Users List'
Subject: RE: NullPointerException accessing members of the
PortletContext

Hello Nates,
You should be deploying it to webapps/jetspeed/WEB-INF/deploy not local,
I
believe local implies a different portal application (like the layouts)
and
your context would have jetspeed-  as a prefix (I am not sure about
this).
- I would  unregister/undeploy and delete your current portlet web-app
(Using PALM in the admin console). 
- if you intend to keep your web.xml with the Jetspeed container servlet
(as
in your e-mail), then you can just drop the portlet web app in <webapps>
and Jetspeed should be able to register the portlet webapp (u should
check
and make sure that it is spitted out in the log file, usually in
Catalina.out)
Good luck
Mohan
 

-----Original Message-----
From: Ayres, Nate R [mailto:Nate_Ayres@reyrey.com] 
Sent: Friday, August 24, 2007 8:26 AM
To: Jetspeed Users List
Subject: RE: NullPointerException accessing members of the
PortletContext

Hi Woonsan,

I have been deploying the application to
/webapps/jetspeed/WEB-INF/deploy/local as the WAR filename does not
start with "jetspeed-" (although I tried changing that and it deploying
it in the other directory too).


My web.xml was originally just the generic:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>
</web-app>


But after your e-mail below I changed it to the following (based off of
the web.xml for the jetspeed-layouts portlet):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>

	<servlet>
		<servlet-name>JetspeedContainer</servlet-name>
		<display-name>Jetspeed Container</display-name>
		<description>
			MVC Servlet for Jetspeed Portlet Applications
		</description>
		<servlet-class>
	
org.apache.jetspeed.container.JetspeedContainerServlet
		</servlet-class>
		<init-param>
			<param-name>contextName</param-name>
			<param-value>GraphList</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>JetspeedContainer</servlet-name>
		<url-pattern>/container/*</url-pattern>
	</servlet-mapping>

</web-app>

It did not seem to have any effect, after redeploying the application I
am still getting the NullPointerException on the same line.  Is this
web.xml correctly formatted for my portlet in GraphList.war?

Thanks for your assistance,
Nate Ayres

-----Original Message-----
From: Woonsan Ko [mailto:woon_san@yahoo.com] 
Sent: Friday, August 24, 2007 12:10 AM
To: Jetspeed Users List
Subject: Re: NullPointerException accessing members of the
PortletContext

Hi Nate,

Did you deploy your portlet application by copying the war file to
/webapps/jetspeed/WEB-INF/deploy ?
Or, does the web.xml contain right *contextName* for JetspeedContainer
servlet?

-Woonsan

--- "Ayres, Nate R" <Na...@reyrey.com> wrote:

> Hi all,
> 
>  
> 
> I recently installed Jetspeed 2.1.2 on Linux with a MySQL DB and
> everything is working fine with one exception. I am encountering null
> pointers whenever I attempt to access the members of the
PortletContext
> in my own portlets.  Here's a simple example that will fail:
> 
>  
> 
>  
> 
> public class GraphListPortlet extends GenericPortlet {
> 
>             protected void doView(RenderRequest request,
RenderResponse
> response)
> 
>                         throws PortletException, IOException
> 
>             {
> 
>                         response.setContentType("text/html");
> 
>  
> 
>         PortletRequestDispatcher prd =
> getPortletContext().getRequestDispatcher("/jsp/view.jsp");
> 
>  
> 
>         prd.include(request, response);
> 
>  
> 
>  
> 
>             }
> 
> }
> 
>  
> 
>  
> 
> The PortletRequestDispatcher will be received as null here and the
> include method will throw the exception.  Likewise if I attempt to
> access getPortletContext().getPortletContextName() it will also throw
a
> NullPointerException.  I have stepped through the portlet using the
> Eclipse remote debug tool for Tomcat and have noticed that the
> servletContext inside the JetspeedPortletConfig object is null, which
> seems to at least be the source of the getPorletContextName() problem
> (line 257 of JetspeedPortletContext.java attempts to access a member
of
> that servletContext). Any ideas on why the servletContext isn't
> initializing correctly? I haven't been able to find any problems with
my
> portlet.xml or web.xml when comparing them to working examples.
> 
>  
> 
> Thanks,
> 
> Nate Ayres
> 
>  
> 
> 



       
________________________________________________________________________
____________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's
updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

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

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



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

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


RE: NullPointerException accessing members of the PortletContext

Posted by Mohan K <km...@gmail.com>.
Hello Nates,
You should be deploying it to webapps/jetspeed/WEB-INF/deploy not local, I
believe local implies a different portal application (like the layouts) and
your context would have jetspeed-  as a prefix (I am not sure about this).
- I would  unregister/undeploy and delete your current portlet web-app
(Using PALM in the admin console). 
- if you intend to keep your web.xml with the Jetspeed container servlet (as
in your e-mail), then you can just drop the portlet web app in <webapps>
and Jetspeed should be able to register the portlet webapp (u should check
and make sure that it is spitted out in the log file, usually in
Catalina.out)
Good luck
Mohan
 

-----Original Message-----
From: Ayres, Nate R [mailto:Nate_Ayres@reyrey.com] 
Sent: Friday, August 24, 2007 8:26 AM
To: Jetspeed Users List
Subject: RE: NullPointerException accessing members of the PortletContext

Hi Woonsan,

I have been deploying the application to
/webapps/jetspeed/WEB-INF/deploy/local as the WAR filename does not
start with "jetspeed-" (although I tried changing that and it deploying
it in the other directory too).


My web.xml was originally just the generic:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>
</web-app>


But after your e-mail below I changed it to the following (based off of
the web.xml for the jetspeed-layouts portlet):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>

	<servlet>
		<servlet-name>JetspeedContainer</servlet-name>
		<display-name>Jetspeed Container</display-name>
		<description>
			MVC Servlet for Jetspeed Portlet Applications
		</description>
		<servlet-class>
	
org.apache.jetspeed.container.JetspeedContainerServlet
		</servlet-class>
		<init-param>
			<param-name>contextName</param-name>
			<param-value>GraphList</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>JetspeedContainer</servlet-name>
		<url-pattern>/container/*</url-pattern>
	</servlet-mapping>

</web-app>

It did not seem to have any effect, after redeploying the application I
am still getting the NullPointerException on the same line.  Is this
web.xml correctly formatted for my portlet in GraphList.war?

Thanks for your assistance,
Nate Ayres

-----Original Message-----
From: Woonsan Ko [mailto:woon_san@yahoo.com] 
Sent: Friday, August 24, 2007 12:10 AM
To: Jetspeed Users List
Subject: Re: NullPointerException accessing members of the
PortletContext

Hi Nate,

Did you deploy your portlet application by copying the war file to
/webapps/jetspeed/WEB-INF/deploy ?
Or, does the web.xml contain right *contextName* for JetspeedContainer
servlet?

-Woonsan

--- "Ayres, Nate R" <Na...@reyrey.com> wrote:

> Hi all,
> 
>  
> 
> I recently installed Jetspeed 2.1.2 on Linux with a MySQL DB and
> everything is working fine with one exception. I am encountering null
> pointers whenever I attempt to access the members of the
PortletContext
> in my own portlets.  Here's a simple example that will fail:
> 
>  
> 
>  
> 
> public class GraphListPortlet extends GenericPortlet {
> 
>             protected void doView(RenderRequest request,
RenderResponse
> response)
> 
>                         throws PortletException, IOException
> 
>             {
> 
>                         response.setContentType("text/html");
> 
>  
> 
>         PortletRequestDispatcher prd =
> getPortletContext().getRequestDispatcher("/jsp/view.jsp");
> 
>  
> 
>         prd.include(request, response);
> 
>  
> 
>  
> 
>             }
> 
> }
> 
>  
> 
>  
> 
> The PortletRequestDispatcher will be received as null here and the
> include method will throw the exception.  Likewise if I attempt to
> access getPortletContext().getPortletContextName() it will also throw
a
> NullPointerException.  I have stepped through the portlet using the
> Eclipse remote debug tool for Tomcat and have noticed that the
> servletContext inside the JetspeedPortletConfig object is null, which
> seems to at least be the source of the getPorletContextName() problem
> (line 257 of JetspeedPortletContext.java attempts to access a member
of
> that servletContext). Any ideas on why the servletContext isn't
> initializing correctly? I haven't been able to find any problems with
my
> portlet.xml or web.xml when comparing them to working examples.
> 
>  
> 
> Thanks,
> 
> Nate Ayres
> 
>  
> 
> 



       
________________________________________________________________________
____________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's
updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

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

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



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


RE: NullPointerException accessing members of the PortletContext

Posted by "Ayres, Nate R" <Na...@reyrey.com>.
Hi Woonsan,

I have been deploying the application to
/webapps/jetspeed/WEB-INF/deploy/local as the WAR filename does not
start with "jetspeed-" (although I tried changing that and it deploying
it in the other directory too).


My web.xml was originally just the generic:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>
</web-app>


But after your e-mail below I changed it to the following (based off of
the web.xml for the jetspeed-layouts portlet):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>Graph List</display-name>
	<description>
		This application lists the graphs of attributes stored
in an
		RRDB database from the server's MBeans.
	</description>

	<servlet>
		<servlet-name>JetspeedContainer</servlet-name>
		<display-name>Jetspeed Container</display-name>
		<description>
			MVC Servlet for Jetspeed Portlet Applications
		</description>
		<servlet-class>
	
org.apache.jetspeed.container.JetspeedContainerServlet
		</servlet-class>
		<init-param>
			<param-name>contextName</param-name>
			<param-value>GraphList</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>JetspeedContainer</servlet-name>
		<url-pattern>/container/*</url-pattern>
	</servlet-mapping>

</web-app>

It did not seem to have any effect, after redeploying the application I
am still getting the NullPointerException on the same line.  Is this
web.xml correctly formatted for my portlet in GraphList.war?

Thanks for your assistance,
Nate Ayres

-----Original Message-----
From: Woonsan Ko [mailto:woon_san@yahoo.com] 
Sent: Friday, August 24, 2007 12:10 AM
To: Jetspeed Users List
Subject: Re: NullPointerException accessing members of the
PortletContext

Hi Nate,

Did you deploy your portlet application by copying the war file to
/webapps/jetspeed/WEB-INF/deploy ?
Or, does the web.xml contain right *contextName* for JetspeedContainer
servlet?

-Woonsan

--- "Ayres, Nate R" <Na...@reyrey.com> wrote:

> Hi all,
> 
>  
> 
> I recently installed Jetspeed 2.1.2 on Linux with a MySQL DB and
> everything is working fine with one exception. I am encountering null
> pointers whenever I attempt to access the members of the
PortletContext
> in my own portlets.  Here's a simple example that will fail:
> 
>  
> 
>  
> 
> public class GraphListPortlet extends GenericPortlet {
> 
>             protected void doView(RenderRequest request,
RenderResponse
> response)
> 
>                         throws PortletException, IOException
> 
>             {
> 
>                         response.setContentType("text/html");
> 
>  
> 
>         PortletRequestDispatcher prd =
> getPortletContext().getRequestDispatcher("/jsp/view.jsp");
> 
>  
> 
>         prd.include(request, response);
> 
>  
> 
>  
> 
>             }
> 
> }
> 
>  
> 
>  
> 
> The PortletRequestDispatcher will be received as null here and the
> include method will throw the exception.  Likewise if I attempt to
> access getPortletContext().getPortletContextName() it will also throw
a
> NullPointerException.  I have stepped through the portlet using the
> Eclipse remote debug tool for Tomcat and have noticed that the
> servletContext inside the JetspeedPortletConfig object is null, which
> seems to at least be the source of the getPorletContextName() problem
> (line 257 of JetspeedPortletContext.java attempts to access a member
of
> that servletContext). Any ideas on why the servletContext isn't
> initializing correctly? I haven't been able to find any problems with
my
> portlet.xml or web.xml when comparing them to working examples.
> 
>  
> 
> Thanks,
> 
> Nate Ayres
> 
>  
> 
> 



       
________________________________________________________________________
____________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's
updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

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

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


Re: NullPointerException accessing members of the PortletContext

Posted by Woonsan Ko <wo...@yahoo.com>.
Hi Nate,

Did you deploy your portlet application by copying the war file to
/webapps/jetspeed/WEB-INF/deploy ?
Or, does the web.xml contain right *contextName* for JetspeedContainer servlet?

-Woonsan

--- "Ayres, Nate R" <Na...@reyrey.com> wrote:

> Hi all,
> 
>  
> 
> I recently installed Jetspeed 2.1.2 on Linux with a MySQL DB and
> everything is working fine with one exception. I am encountering null
> pointers whenever I attempt to access the members of the PortletContext
> in my own portlets.  Here's a simple example that will fail:
> 
>  
> 
>  
> 
> public class GraphListPortlet extends GenericPortlet {
> 
>             protected void doView(RenderRequest request, RenderResponse
> response)
> 
>                         throws PortletException, IOException
> 
>             {
> 
>                         response.setContentType("text/html");
> 
>  
> 
>         PortletRequestDispatcher prd =
> getPortletContext().getRequestDispatcher("/jsp/view.jsp");
> 
>  
> 
>         prd.include(request, response);
> 
>  
> 
>  
> 
>             }
> 
> }
> 
>  
> 
>  
> 
> The PortletRequestDispatcher will be received as null here and the
> include method will throw the exception.  Likewise if I attempt to
> access getPortletContext().getPortletContextName() it will also throw a
> NullPointerException.  I have stepped through the portlet using the
> Eclipse remote debug tool for Tomcat and have noticed that the
> servletContext inside the JetspeedPortletConfig object is null, which
> seems to at least be the source of the getPorletContextName() problem
> (line 257 of JetspeedPortletContext.java attempts to access a member of
> that servletContext). Any ideas on why the servletContext isn't
> initializing correctly? I haven't been able to find any problems with my
> portlet.xml or web.xml when comparing them to working examples.
> 
>  
> 
> Thanks,
> 
> Nate Ayres
> 
>  
> 
> 



       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

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