This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts REquest Processor throws Null Pointer exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts REquest Processor throws Null Pointer exception" Watch "Struts REquest Processor throws Null Pointer exception" New topic
Author

Struts REquest Processor throws Null Pointer exception

Anita Ganga
Greenhorn

Joined: Oct 20, 2004
Posts: 28
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Anita Ganga
Greenhorn

Joined: Oct 20, 2004
Posts: 28
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

Joined: Feb 15, 2005
Posts: 4864
Did you restart the server after making this change?
Anita Ganga
Greenhorn

Joined: Oct 20, 2004
Posts: 28
Yes I did
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Ar you using Hibernate? I've seen reports that Hibernate has caused some strange errors to occur in Struts.
Anita Ganga
Greenhorn

Joined: Oct 20, 2004
Posts: 28
No I am not using Hibernate.
It's pure Struts application deployed on WebSphere Application server.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Oct 20, 2004
Posts: 28
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

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Oct 20, 2004
Posts: 28
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..
 
Don't get me started about those stupid light bulbs.
 
subject: Struts REquest Processor throws Null Pointer exception