Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Local String Problem

Fabbris Pierluigi

2007-08-07

Replies:

Hello,
I've this Exception in the Log:

7-ago-2007 10.38.05 org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet invoker threw exception
java.util.MissingResourceException: Can't find bundle for base name
LocalStrings, locale it_IT
 at java.util.ResourceBundle.throwMissingResourceException(Unknown
Source)
 at java.util.ResourceBundle.getBundleImpl(Unknown Source)
 at java.util.ResourceBundle.getBundle(Unknown Source)
 at HelloWorldExample.doGet(HelloWorldExample.java:39)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:690)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
 at
org.apache.catalina.servlets.InvokerServlet.serveRequest (InvokerServlet.java:402)

 at
org.apache.catalina.servlets.InvokerServlet.doGet (InvokerServlet.java:134)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:690)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:803)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:290)

 at
org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206)

 at
org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:230)

 at
org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:175)

 at
org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:128)

 at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:104)

 at
org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:109)

 at
org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:261)
 at
org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:844)
 at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)

 at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Unknown Source)

The HelloWorldExample that I use is the HelloWorldExample for the
Example of Tomcat. This file start when I start with example, but not in
my web-apps to give me the Exception above. The code of
HelloWorldExample is:
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* $Id: HelloWorldExample.java 500674 2007-01-27 23:15:00Z markt $
*
*/

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

/**
* The simplest possible servlet.
*
* @author James Duncan Davidson
*/

public class HelloWorldExample extends HttpServlet {


 public void doGet(HttpServletRequest request,
             HttpServletResponse response)
    throws IOException, ServletException
 {
    ResourceBundle rb =
      ResourceBundle.getBundle("LocalStrings",request.getLocale());
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();

    out.println("<html>");
    out.println("<head>");

    String title = rb.getString("helloworld.title");

    out.println("<title>" + title + "</title>");
    out.println("</head>");
    out.println("<body bgcolor=\"white\">");

 // note that all links are created to be relative. this
 // ensures that we can move the web application that this
 // servlet belongs to to a different place in the url
 // tree and not have any harmful side effects.

    // XXX
    // making these absolute till we work out the
    // addition of a PathInfo issue

    out.println("<a href=\"../helloworld.html\">");
    out.println("<img src=\"../images/code.gif\" height=24 " +
            "width=24 align=right border=0 alt=\"view code\"></a>");
    out.println("<a href=\"../index.html\">");
    out.println("<img src=\"../images/return.gif\" height=24 " +
            "width=24 align=right border=0 alt=\"return\"></a>");
    out.println("<h1>" + title + "</h1>");
    out.println("</body>");
    out.println("</html>");
 }
}


The problem I believe is in:
ResourceBundle rb =
      ResourceBundle.getBundle("LocalStrings",request.getLocale());
but I don't know how can I resolve.
The code with this line I think common and I want to resolve the problem
forever.
How?
Sincerally yours,
Fabbris Pierluigi

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.