This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes Getting an Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Getting an Exception" Watch "Getting an Exception" New topic
Author

Getting an Exception

Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Hi,
Iam new to struts.While i am trying to to run my jsp page on tomcat server ,iam getting the following error.Please give me any suggestions

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NullPointerException
org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1219)
org.apache.struts.taglib.TagUtils.message(TagUtils.java:1082)
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:226)
org.apache.jsp.pages.Address_jsp._jspx_meth_bean_message_0(Address_jsp.java:145)
org.apache.jsp.pages.Address_jsp._jspx_meth_html_html_0(Address_jsp.java:113)
org.apache.jsp.pages.Address_jsp._jspService(Address_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28



Thanks
[ April 06, 2006: Message edited by: Bhaskar Gara ]
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Please help me
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I don't know what is causing the exception, but it would help if you posted the section of JSP code that is using the bean:message tag along with your properties file. Do you have other cases where bean:message is working? You can always look at the Struts source code and see if that gives you any ideas.

- Brent
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Thank you for your response. Here is the jsp page code:

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>

<html:html locale="true">
<head>
<title><bean:message key="welcome.title"/></title>
<html:base/>
</head>
<body bgcolor="white">
<html:form action="/Address" method="post">
<html:errors/>
<table>
<tr>
<td align="center" colspan="2">
<font size="4">Please Enter the Following Details</font>
</tr>
<tr>
<td align="right">
Name
</td>
<td align="left">
<html:text property="name" size="30" maxlength="30"/>
</td>
</tr>
<tr>
<td align="right">
Address
</td>
<td align="left">
<html:text property="address" size="30" maxlength="30"/>
</td>
</tr>

<tr>
<td align="right">
E-mail address
</td>
<td align="left">
<html:text property="emailAddress" size="30" maxlength="30"/>
</td>
</tr>

<tr>
<td align="right">
<html:submit>Save</html:submit>
</td>
<td align="left">
<html:cancel>Cancel</html:cancel>
</td>
</tr>
</table>


</html:form>
</body>
</html:html>

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Check to make sure you have the following entry in your struts-config.xml file:

<message-resources parameter="com.mycompany.ApplicationResources"/>

Then make sure that you have a file named ApplicationResources.properties in the /WEB-INF/classes/com/mycompany directory (or whatever directory you specify in struts-config.xml).

Also check to see that this file contains the entry:

welcome.title=Some text you specify
[ April 06, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
I changed my code like what you said .Still iam getting an error.
There is something wrong in
<%@ taglib uri="/tags/struts-html" prefix="html" %>
&
<title><bean:message key="welcome.title"/></title>.

When iam removing above tags ,Iam not getting any exception.
Without html taglibrary iam not getting textboxes & submit button.What i need to change.


Thanks
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
If i add <%@ taglib uri="/tags/struts-html" prefix="html" %> taglibrary to address.jsp page, iam getting the following error.
What i need to change?



HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.pages.Address_jsp._jspService(Address_jsp.java:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:711)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:419)
org.apache.jsp.pages.Address_jsp._jspx_meth_html_form_0(Address_jsp.java:156)
org.apache.jsp.pages.Address_jsp._jspx_meth_html_html_0(Address_jsp.java:116)
org.apache.jsp.pages.Address_jsp._jspService(Address_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This error indicates that the Struts ActionServlet had not initialized at the time you tried to display your JSP.

To correct this, make sure the following lines are in your web.xml file. Pay particular attention to the <load-on-startup> tag. This tells the ActionServlet to initialize as soon as the application starts up.



If you already have a <load-on-startup> tag and are still getting this message, check the SystemOut log for errors when the application starts up.
[ April 07, 2006: Message edited by: Merrill Higginson ]
Bacchi Gerem
Ranch Hand

Joined: Jan 23, 2004
Posts: 120
Hi ,
Thanks for your help. My web.xml file contains that code .
Here is the log file.

2006-04-07 11:17:10 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:711)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:419)
at org.apache.jsp.pages.Address_jsp._jspx_meth_html_form_0(Address_jsp.java:155)
at org.apache.jsp.pages.Address_jsp._jspx_meth_html_html_0(Address_jsp.java:115)
at org.apache.jsp.pages.Address_jsp._jspService(Address_jsp.java:79)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)


Thanks
[ April 07, 2006: Message edited by: Bhaskar Gara ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Please restart your application (or the entire server) and show us the log you get when the application starts up. I'm guessing the reason your ActionServlet hasn't loaded is that it's encountering some sort of error at startup.

Once you've done this, post the portion of the SystemOut log that shows the error.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting an Exception