Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts REquest Processor throws Null Pointer exception

 
Anita Ganga
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I am trying to access my Struts application like this
Http://myhost/userSetup/usersByDivisionReport.do
I am getting this error,where userSetup is our context root..

35ba8c4 WebGroup E SRVE0026E: [Servlet Error]-[action]: java.lang.NullPointerException
at org.apache.struts.util.RequestUtils.forwardURL(RequestUtils.java:1386)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServl

the struts-config.xml is like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

<!-- Data Sources -->
<data-sources>
</data-sources>

<!-- Form Beans -->
<form-beans>
<form-bean name="usersByDivisionReportForm" type="com.strykercorp.e3s.userSetup.forms.UsersByDivisionReportForm">
</form-bean>
<form-bean name="usersByRoleReportForm" type="com.strykercorp.e3s.userSetup.forms.UsersByRoleReportForm">
</form-bean>
<form-bean name="errorReportForm" type="com.strykercorp.e3s.userSetup.forms.ErrorReportForm">
</form-bean>
<form-bean name="usersInMultDivsReportForm" type="com.strykercorp.e3s.userSetup.forms.UsersInMultDivsReportForm">
</form-bean>
<form-bean name="sysConfigReportForm" type="com.strykercorp.e3s.userSetup.forms.SysConfigReportForm">
</form-bean>
</form-beans>

<!-- Global Exceptions -->
<global-exceptions>
</global-exceptions>

<!-- Global Forwards -->
<global-forwards>
<forward name="reportUsersByDivision" path="/usersByDivisionReport.do?method=populate"/>
<forward name="reportUsersByRole" path="/usersByRoleReport.do?method=populate"/>
<forward name="reportError" path="/errorReport.do?method=populate"/>
<forward name="reportUsersInMultDivs" path="/usersInMultDivsReport.do?method=reportResults"/>
<forward name="reportSysConfig" path="/sysConfigReport.do"/>

</global-forwards>

<!-- Action Mappings -->
<action-mappings>
<action
name="usersByDivisionReportForm"
path="/usersByDivisionReport"
scope="session"
parameter="method"
validate="true"
input="/userSetup/reportUsersByDivision.jsp"
type="com.strykercorp.e3s.userSetup.actions.UsersByDivisionReportAction">
<forward name="populate" path="/userSetup/reportUsersByDivision.jsp?method=populate"/>
<forward name="divisionSelected" path="/userSetup/reportUsersByDivision.jsp?method=divisionSelected"/>
<forward name="reportResults" path="/userSetup/reportUsersByDivision.jsp?method=reportResults"/>
<forward name="reportPagingResults" path="/userSetup/reportUsersByDivision.jsp?method=reportPagingResults"/>
<forward name="reportResultsPrint" path="/userSetup/reportUsersByDivisionPrint.jsp?method=reportResultsPrint"/>

</action>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

<action-mappings>

</struts-config>


Appreciate any insights...
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the "/userSetup" portion of all paths in your local forwards. For example, your first forward should be:

<forward name="populate" path="/reportUsersByDivision.jsp?method=populate"/>

Struts already inserts your context path as part of the path, so you don't need to.
 
Anita Ganga
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried removing the context root fromthe path in the forward element for the action tags but still I get the same exception.

Any clue why??
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you restart the server after making this change?
 
Anita Ganga
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I did
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ar you using Hibernate? I've seen reports that Hibernate has caused some strange errors to occur in Struts.
 
Anita Ganga
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No I am not using Hibernate.
It's pure Struts application deployed on WebSphere Application server.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more thing to check:

Make sure that all the jar files that relate to struts in your WEB-INF/lib file came from the same download. If you used WSAD or RAD to develop your application, be aware that these tools use Struts 1.1. Make sure you don't have any files from Struts 1.2 in there.

Another question: Do you get this same problem in both the WSAD/RAD test envirnoment and the deployed WebSphere environment?

Also, check to see if there is a struts.jar file or any commons-xxx.jar files in any of WebSphere's common lib directories. If there are, get rid of them. Make sure that your WEB-INF/lib directory is the only place these jar files are found.

If all of this checks out, and it still doesn't work, I'd suggest re-downloading Struts and re-installing the jar files in your WAR file.
 
Anita Ganga
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works fine on our Production server..
So I coipied all the jar files from the Production web-inf lib ANDCOPIED TO
my dev web-inf/lib
Restarted servers no luck...
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just noticed something in your struts-config.xml file that may be causing the problem. Your <plug-in> tag is inside your <action-mapping> block, and it shouldn't be. Cut the <plug-in> tag from its current location and paste it just before the </struts-config> tag.
 
Anita Ganga
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Merill that was just a typo.

I had lots of actions in my original struts-config.xml so just cut copy error.

But my original configuration file has the plugin tag out of action mapping tag

sorry for the confusion..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic