You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Campbell <mi...@s1.com> on 2000/11/28 18:52:03 UTC

User error (mine)! Can't find application resource file?

I've written a very small app using struts, and am stuck on the following problem.  (See error log.)

I think my setup is as close to the example (which works), and yet I can't seem to get past this.

My ApplicationResources.properties is in <root>/WEB-INF/classes/ApplicationResources.properties.

My web.xml file lists:
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/action.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>9</param-value>
    </init-param>
  </servlet>

The JSP file contains:

<%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
<HTML>
<HEAD>
 <TITLE><struts:message key="enter.name.title"/></TITLE>
</HEAD>


The first line in the ApplicationResources.properties is:

enter.name.title=Enter Username



And when I hit the app with the web browser, I get the following error.  Any idea here?

Internal Servlet Error:

javax.servlet.ServletException: Missing resources attribute org.apache.struts.action.MESSAGE
 at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:453)
 at _0002fEnterName_0002ejspEnterName_jsp_5._jspService(_0002fEnterName_0002ejspEnterName_jsp_5.java:291)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
 at org.apache.tomcat.core.Handler.service(Handler.java:286)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:799)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:745)
 at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
 at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
 at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
 at java.lang.Thread.run(Thread.java:484)

Root cause:
javax.servlet.jsp.JspException: Missing resources attribute org.apache.struts.action.MESSAGE
 at org.apache.struts.taglib.MessageTag.doStartTag(MessageTag.java:360)
 at _0002fEnterName_0002ejspEnterName_jsp_5._jspService(_0002fEnterName_0002ejspEnterName_jsp_5.java:65)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
 at org.apache.tomcat.core.Handler.service(Handler.java:286)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:799)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:745)
 at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
 at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
 at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
 at java.lang.Thread.run(Thread.java:484)



Re: User error (mine)! Can't find application resource file?

Posted by Mike Campbell <mi...@s1.com>.
I put my file in a directory and named the directory (as a package) in the web.xml file as you suggested, and that worked OK.

I'm curious as to why NO package naming in the web.xml file and the resources file in the root dir doesn't work.

Many thanks!


----- Original Message -----
From: "Vilavanh Messien" <vi...@agora.ulaval.ca>
To: <st...@jakarta.apache.org>
Sent: Tuesday, November 28, 2000 1:31 PM
Subject: RE: User error (mine)! Can't find application resource file?


You must indicate the complete path to ApplicationRessources.properties
In the struts example, it is :
<param-value>org.apache.struts.example.ApplicationResources</param-value>

It means if your ApplicationResources is located in the package
project/example, you should
write something like this:
<param-value>project.example.ApplicationResources</param-value>


-----Message d'origine-----
De : Mike Campbell [mailto:mike.campbell@s1.com]
Envoyé : 28 novembre, 2000 12:52
À : struts-user@jakarta.apache.org
Objet : User error (mine)! Can't find application resource file?


I've written a very small app using struts, and am stuck on the following
problem.  (See error log.)

I think my setup is as close to the example (which works), and yet I can't
seem to get past this.

My ApplicationResources.properties is in
<root>/WEB-INF/classes/ApplicationResources.properties.

My web.xml file lists:
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/action.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>9</param-value>
    </init-param>
  </servlet>

The JSP file contains:

<%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
<HTML>
<HEAD>
 <TITLE><struts:message key="enter.name.title"/></TITLE>
</HEAD>


The first line in the ApplicationResources.properties is:

enter.name.title=Enter Username



And when I hit the app with the web browser, I get the following error.  Any
idea here?

Internal Servlet Error:

javax.servlet.ServletException: Missing resources attribute
org.apache.struts.action.MESSAGE
 at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:453)
 at
_0002fEnterName_0002ejspEnterName_jsp_5._jspService(_0002fEnterName_0002ejsp
EnterName_jsp_5.java:291)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
 at org.apache.tomcat.core.Handler.service(Handler.java:286)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
9)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:745)
 at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
 at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
 at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
 at java.lang.Thread.run(Thread.java:484)

Root cause:
javax.servlet.jsp.JspException: Missing resources attribute
org.apache.struts.action.MESSAGE
 at org.apache.struts.taglib.MessageTag.doStartTag(MessageTag.java:360)
 at
_0002fEnterName_0002ejspEnterName_jsp_5._jspService(_0002fEnterName_0002ejsp
EnterName_jsp_5.java:65)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
 at org.apache.tomcat.core.Handler.service(Handler.java:286)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
9)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:745)
 at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
 at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
 at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
 at java.lang.Thread.run(Thread.java:484)




RE: User error (mine)! Can't find application resource file?

Posted by Vilavanh Messien <vi...@agora.ulaval.ca>.
You must indicate the complete path to ApplicationRessources.properties
In the struts example, it is :
<param-value>org.apache.struts.example.ApplicationResources</param-value>

It means if your ApplicationResources is located in the package
project/example, you should
write something like this:
<param-value>project.example.ApplicationResources</param-value>


-----Message d'origine-----
De : Mike Campbell [mailto:mike.campbell@s1.com]
Envoyé : 28 novembre, 2000 12:52
À : struts-user@jakarta.apache.org
Objet : User error (mine)! Can't find application resource file?


I've written a very small app using struts, and am stuck on the following
problem.  (See error log.)

I think my setup is as close to the example (which works), and yet I can't
seem to get past this.

My ApplicationResources.properties is in
<root>/WEB-INF/classes/ApplicationResources.properties.

My web.xml file lists:
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/action.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>9</param-value>
    </init-param>
  </servlet>

The JSP file contains:

<%@ taglib uri="/WEB-INF/struts.tld" prefix="struts" %>
<HTML>
<HEAD>
 <TITLE><struts:message key="enter.name.title"/></TITLE>
</HEAD>


The first line in the ApplicationResources.properties is:

enter.name.title=Enter Username



And when I hit the app with the web browser, I get the following error.  Any
idea here?

Internal Servlet Error:

javax.servlet.ServletException: Missing resources attribute
org.apache.struts.action.MESSAGE
 at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:453)
 at
_0002fEnterName_0002ejspEnterName_jsp_5._jspService(_0002fEnterName_0002ejsp
EnterName_jsp_5.java:291)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
 at org.apache.tomcat.core.Handler.service(Handler.java:286)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
9)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:745)
 at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
 at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
 at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
 at java.lang.Thread.run(Thread.java:484)

Root cause:
javax.servlet.jsp.JspException: Missing resources attribute
org.apache.struts.action.MESSAGE
 at org.apache.struts.taglib.MessageTag.doStartTag(MessageTag.java:360)
 at
_0002fEnterName_0002ejspEnterName_jsp_5._jspService(_0002fEnterName_0002ejsp
EnterName_jsp_5.java:65)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
 at org.apache.tomcat.core.Handler.service(Handler.java:286)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
9)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:745)
 at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
 at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
 at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
 at java.lang.Thread.run(Thread.java:484)