You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Helena Hjertén <he...@smarttrust.com> on 2001/09/03 10:40:33 UTC

RE: java.util.MissingResourceException error ... please help!

MIssingResourceException comes form the code that handles ResourceBundles, a
feature for making your code work with several different languages. 

The exception below shows that your code is looking for a file (text file)
with the format key-value,  key-value... (there the key matches part of your
code, see your ResourceBundle.java, line 559). The file is in your case
called LocalStrings_en.properties and this file MUST be loaded in the
classloader. In my Tomcat 3.2.1 installation this file is available in the
tomcat/webapps/WEB-INF/classes directory, so it should be available.   

Read more in the Java 1.3 javadoc, see:
http://java.sun.com/j2se/1.3/docs/api/index.html under
java.util.ResourceBundle, it is very well explained there. Another great
source is
http://java.sun.com/docs/books/tutorial/i18n/resbundle/concept.html where
this is explained very good. 


This is how my LocalStrings_en.properties looks: 
***************************************START FILE***********************

# $Id: LocalStrings_en.properties,v 1.1.2.1 2000/07/05 17:45:04 nacho Exp $

# Default localized resources for example servlets
# This locale is en_US

helloworld.title=Hello World!

requestinfo.title=Request Information Example
requestinfo.label.method=Method:
requestinfo.label.requesturi=Request URI:
requestinfo.label.protocol=Protocol:
requestinfo.label.pathinfo=Path Info:
requestinfo.label.remoteaddr=Remote Address:

requestheader.title=Request Header Example

requestparams.title=Request Parameters Example
requestparams.params-in-req=Parameters in this request:
requestparams.no-params=No Parameters, Please enter some
requestparams.firstname=First Name:
requestparams.lastname=Last Name:

cookies.title=Cookies Example
cookies.cookies=Your browser is sending the following cookies:
cookies.no-cookies=Your browser isn't sending any cookies
cookies.make-cookie=Create a cookie to send to your browser
cookies.name=Name:
cookies.value=Value:
cookies.set=You just sent the following cookie to your browser:

sessions.title=Sessions Example
sessions.id=Session ID:
sessions.created=Created:
sessions.lastaccessed=Last Accessed:
sessions.data=The following data is in your session:
sessions.adddata=Add data to your session
sessions.dataname=Name of Session Attribute:
sessions.datavalue=Value of Session Attribute:

*****************************************END FILE***********************















-----Original Message-----
From: Demetrios Sapounas [mailto:ds@med2web.com]
Sent: Thursday, August 30, 2001 19:01
To: tomcat-user@jakarta.apache.org
Subject: java.util.MissingResourceException error ... please help!


Tomcat newbie question.

I have installed and configured tomcat 3.2.3 on a linux server.
I used the rpm distribution from the jakarta web site.
I am running tomcat as a stand-alone, accessing it through
localhost:8080
All the servlet examples under ~tomcat/webapps/examples work fine.

I created another directory under webapps, ~tomcat/webapps/helpdesk and
below there I created the same directory tree as fown under "examples".
The following simple servlet core

// HelloWorld Servlet
 
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
 
public class HelloWorld extends HttpServlet {
 
  public void doGet(HttpServletRequest request, HttpServletResponse
response)
                   throws IOException, ServletException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<body bgcolor=#FFFFFF>");
    out.println("<head>");
    out.println("<title>Hello World!</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Hello World!</h1>");
    out.println("<b>This is DS ...</b>");
    out.println("</body>");
    out.println("</html>");
  }
} 
 

worked fine, but the HelloWorldExample (the one found under examples)
gives me the error below.
Could anyone please point me to the right direction, so solve this
problem?  It may be sometihng very simple I am missing in the
configuration.

Thank you! - Demetrios

java.util.MissingResourceException: Can't find bundle for base name
LocalStrings, locale en
        at
java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:7
12)
        at
java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:683)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:559)
        at HelloWorldExample.doGet(HelloWorldExample.java:24)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java)
        at org.apache.tomcat.core.Handler.service(Handler.java)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)
        at java.lang.Thread.run(Thread.java:484)