• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

setting up Tomcat

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I pointed the browser to http://localhost:8080, the Jakarta Project homepage appeared. But when I tried to run HelloWorld servlet, I got error message 'java.util.MissingResourceException: Can't find bundle for base name Local Strings, locale en_US ...'
I use Window XP. I tried the setup with both Tomcat versions 4.1.18 and 5.0.0 and still got the error.
Please help!
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How does your 'HelloWorld' look like?
How do you call it?
Where do you have it in your webapp?
Rene
[ February 21, 2003: Message edited by: Rene Larsen ]
 
herkulis nugent
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rene,
I just copied the HelloWorldExample.class within the Tomcat installation to the c:\Tomcat\webapps\ROOT\WEB-INF\classes\, and pointed the browser to http://localhost:8080\servlet\HelloWorldExample.
-------------------
/* $Id: HelloWorldExample.java,v 1.2 2001/11/29 18:27:25 remm Exp $
*
*/

import java.io.*;
import java.text.*;
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=\"/examples/servlets/helloworld.html\">");
out.println("<img src=\"/examples/images/code.gif\" height=24 " +
"width=24 align=right border=0 alt=\"view code\"></a>");
out.println("<a href=\"/examples/servlets/index.html\">");
out.println("<img src=\"/examples/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>");
}
}
 
Rene Larsen
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where do you have 'LocalStrings_en_US.properties'?
It should be placed in the root of the classpath - in the root of 'classes'
Rene
 
herkulis nugent
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rene,
Thank you for your reply. I didnt put 'LocalStrings_en_US.properties' separately from the rest of the resources. The whole error message is as follows:
----------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.util.MissingResourceException: Can't find bundle for base name LocalStrings, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:804)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:773)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:538)
at HelloWorldExample.doGet(HelloWorldExample.java:24)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:466)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:536)
----------------
I suspect that I am missing something in my path/classpath. My startup.bat is as follows:
set JAVA_HOME=c:\j2sdk1.4.1_01

set BASEDIR=c:\jakarta-tomcat-4.1.18

set CLASSPATH=%CLASSPATH%;.;C:\j2sdk1.4.1_01\lib\classes.zip;c:\jakarta-tomcat-4.1.18\common\lib\servlet.jar;C:\j2sdk1.4.1_01\lib\tools.jar;C:\Program Files\Java\j2re1.4.0\lib\r.jar

set Path=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\j2sdk1.4.1_01;c:\j2sdk1.4.1_01\bin;C:\Program Files\Java\j2re1.4.0\bin;C:\jakarta-tomcat-4.1.18\bin;C:\Program Files\Java\j2re1.4.0\bin
----------
What do you think?
[ February 21, 2003: Message edited by: herkulis nugent ]
 
Rene Larsen
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

java.util.MissingResourceException: Can't find bundle for base name LocalStrings, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:804)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:773)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:538)
at HelloWorldExample.doGet(HelloWorldExample.java:24)


This is the error you are getting...
Have you checked for typo (upper- and lowercase on the right chars)?
You should not set any path/classpath in 'startup.bat' you should set them in your global 'Environment Variables'.
'C:\j2sdk1.4.1_01\lib\classes.zip' in your classpath is not used in JDK/SDK 1.2.x->1.4.x - it is from the old JDK 1.1.x dayes.
'C:\Program Files\Java\j2re1.4.0\lib\r.jar' should have been 'C:\Program Files\Java\j2re1.4.0\lib\rt.jar' but you don't have to set it with JDK/SDK 1.2.x->1.4.x
'BASEDIR' is automatic set by Tomcat in 'catalina.bat'
Rene
[ February 22, 2003: Message edited by: Rene Larsen ]
 
herkulis nugent
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rene,
Thank you for your reply. I corrected what you suggested, checking the spellings (I didnt know what you meant by 'checking spelling on right characters' though), placing Path and Classpath into Environment Variables (System Properties/Advanced/Enviromental Variables) after taking out the extra items as follows:
CLASSPATH=%CLASSPATH%;.;c:\jakarta-tomcat-4.1.18\common\lib\servlet.jar;C:\j2sdk1.4.1_01\lib\tools.jar;

Path=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\j2sdk1.4.1_01;c:\j2sdk1.4.1_01\bin;C:\jakarta-tomcat-4.1.18\bin;
But I still got the same error after running HelloWorldExample.class (and then CookieExample.class).
What do you think?
[ February 22, 2003: Message edited by: herkulis nugent ]
 
Rene Larsen
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is your language in 'Control Panel->Regional and Language Options->Regional Options'?
If not 'English (United States)' then you have to eater change the property files name so it has you Locale setting or you have to change the language in 'Regional Options' - but then the language on your machine will change as will.
You can read about 'Locale' here
Rene
[ February 23, 2003: Message edited by: Rene Larsen ]
 
Rene Larsen
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your webapp should look like this:
<TOMCAT_INSTALL>/webapps/<YOUR_APP>/WEB-INF/classes/HelloWorldExample.class
<TOMCAT_INSTALL>/webapps/<YOUR_APP>/WEB-INF/classes/LocalStrings_en_US.properties
<TOMCAT_INSTALL>/webapps/<YOUR_APP>/WEB-INF/web.xml
does it do that?
Rene
[ February 23, 2003: Message edited by: Rene Larsen ]
 
herkulis nugent
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rene,
Thank you for your help. I checked Control Setting/Regional and Language Options and saw that it was English (United States) as I thought.
I followed what you suggested. Under webapps, I created MyApp/WEB-INF/classes/ and placed a copy of HelloWorldExample.class and LocalStrings_en_US.properties (from C:\\tomcat\webapps\examples\WEB-INF\classes) there. I also copied web.xml from c:\\tomcat\webapps\ROOT\WEB-INF to c:\\tomcat\webapps\MyApp\WEB-INF\ Then I pointed the browser to http://localhost:8080/MyApp/servlet/HelloWorldExample but got the same error.
Any more suggestions?
 
herkulis nugent
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rene,
I gave up so I tried Window 2000, and it worked (!) even though I just accessed the same resources (same path/classpath) from different partition. It stated that Tomcat5.0.0 should work with Window XP, so I guess I was missing something. Thank you for your help
 
Everybody's invited. Even this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic