[ 
https://issues.apache.org/struts/browse/WW-3164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46439#action_46439
 ] 

Bruce Phillips commented on WW-3164:
------------------------------------

I added to the Jira bug report another example application that demonstrates 
the problem.  The StrutsExample application is a simple Struts 2 (using 2.1.6) 
application that has both normal actions and Portlet actions.

You can also download this example application (an archive of an Eclipse 
Dynamic Web Project that uses Maven) at 
http://www.brucephillips.name/struts/StrutsExample.zip.

Unzip the example application and the open a command window.  Navigate to where 
you unzipped the application.  

Run "mvn clean" at the command prompt

Run "mvn jetty:run" at the command prompt

When you see the message [INFO] Started Jetty Server open your web browser and 
navigate to 

http://localhost:8080/StrutsExample/index.jsp

Click on link for normal Struts 2 action and you should see "Hello from Struts 
2"

Click on link for Hello from portlet action and you should see "Hello from 
Struts 2"

Click on link for Run Run a normal Struts 2 action that loads a JSP with a 
search form built using s:form tag and you'll get the exception discussed 
earlier.

Type control C in the command prompt window to stop Jetty server

Edit the pom.xml file:
   Change the Struts 2 to version 2.0.11
   Comment out the dependency on struts2-portlet-plugin

Save the pom.xml file

In command window run "mvn clean" and then "mvn jetty:run"

When you see the message [INFO] Started Jetty Server open your web browser and 
navigate to 

http://localhost:8080/StrutsExample/index.jsp

Click on link for normal Struts 2 action and you should see "Hello from Struts 
2"

Click on link for Hello from portlet action and you should see "Hello from 
Struts 2"

Click on link for Run Run a normal Struts 2 action that loads a JSP with a 
search form built using s:form tag and you'll see the simple search form built 
using the s:form tag

Click on the link Click here to start the search form example as a portlet and 
you'll also see the simple search form

It seems that the s:form tag is causing a problem when using the 
struts2-portlet-plugin version 2.1.6 with struts 2 core version 2.1.6.

We hope this is fixed in the upcoming release of version 2.1.7 as we would like 
to use the current release of Struts 2 to build web applications that can be 
used as standalone applications and as portlet within a portlet container.

> Using Struts 2.1.6 Portlet Plugin Causes NullPointerException When Executing 
> A Normal Struts 2 Action
> -----------------------------------------------------------------------------------------------------
>
>                 Key: WW-3164
>                 URL: https://issues.apache.org/struts/browse/WW-3164
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Portlet
>    Affects Versions: 2.1.6
>         Environment: Windows XP, JDK 6
>            Reporter: Bruce Phillips
>         Attachments: Struts2PortletExample.zip
>
>
> Created a Struts 2 web/portlet application with a pom.xml having a dependency 
> on struts2-core-2.0.11.2.jar.  Works both as a normal web application and as 
> a portlet application.
> Changed the dependencies to be struts2-core-2.1.6.jar and 
> struts2-portlet-plugin-2.1.6.jar.  Running the application as a web 
> application in Tomcat 6 or Jetty results in a 
> org.apache.jasper.JasperException: java.lang.NullPointerException whenever a 
> Struts 2 action is called.
> Removed the dependency on struts2-portlet-plugin-2.1.6.jar and the 
> application runs fine as a normal Struts 2 web application. 
> You can download an archived Eclipse dynamic web project that uses maven here:
> http://www.brucephillips.name/struts/struts2portletexample.zip
> 1.  Unzip the project
> 2.  In a command window navigate to where you unzipped the project
> 3.  In the root folder for the project run mvn clean
> 4.  Then run mvn jetty:run
> 5.  Open your browser and go to 
> http://localhost:8080/StrutsPortletExample/index.html
> 6.  click on the link for add new employee
> 7.  You'll get a NullPointerException
> 8.  Close Jetty by using Control C
> 9.  In the pom.xml file for the project comment out the dependency on Struts 
> 2.1.6 Porlet Plugin
> 10.  In command window redo mvn clean and then mvn jetty:run
> 11.  Open your browser and go to 
> http://localhost:8080/StrutsPortletExample/index.html
> 12.  click on the link for add new employee and the Struts 2 action will 
> execute successfully and you'll get the add employee page
> In Struts 2.0.11 we were able to use both Struts 2 actions and a Struts 2 
> portlet in the same web application.  Trying to use the new Struts 2.1.6 
> Portlet Plugin causes an exception when user clicks on a normal struts 2 
> action link.
> Here is the first part of the Exception stack trace as reported by Struts 2:
> Struts Problem Report
> Struts has detected an unhandled exception:
> # Messages:   java.lang.NullPointerException
> File:         org/apache/struts2/components/UIBean.java
> Line number:  792
> Stacktraces
> org.apache.jasper.JasperException: java.lang.NullPointerException
>     
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:418)
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>     org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
>     org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
>     
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>     org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>     org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>     org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
>     org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:334)
>     org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
>     
> org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)

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

Reply via email to