*
The moose likes Servlets and the fly likes Getting MissingResourceException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Getting MissingResourceException" Watch "Getting MissingResourceException" New topic
Author

Getting MissingResourceException

Mallikarjuna Chejerla
Greenhorn

Joined: Jul 24, 2006
Posts: 16
Hi,

I have written simple servlet,Where in init() method of this servlet i have written the following code in the try block..

ResourceBundle resB = ResourceBundle.getBundle("com.pack1.fileprops");

I placed servlet,fileprops.properties in the com/pack1 package under my src folder of the application.

After making build the servlet class file,fileprops.properties files are moving to WEB-INF/classes/com/pack1.

I am making war file and deploying this under tomcat.I am accessing this servlet from the JSP page written in the application.At this point in init()method of servlet where getBundle() method call exist.. I am getting following Error

java.util.MissingResourceException: Can't find bundle for base name com.pack1.fileprops, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1508)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1262)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:717)
at com.info.upload.FileUpload.init(Unknown Source)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1044)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:712)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:186)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:563)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:563)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:209)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protoco
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
at java.util.Properties.loadConvert(Properties.java:552)
at java.util.Properties.load0(Properties.java:375)
at java.util.Properties.load(Properties.java:325)
at java.util.PropertyResourceBundle.<init>(PropertyResourceBundle.java:111)
at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2415)
at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1400)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1365)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1294)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1294)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1236)
... 27 more

Plese Tell me the solution for this.. I am unable to understand why tomcat is not able to find out and load the resource that exist in the application WEB-INF/classes/com/pack1

Thanks in Advance!
[ September 26, 2008: Message edited by: Mallikarjuna Chejerla ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
According to this:


The file is being read but the Properties class loadConvert module has hit text in the "\uxxxx" format which it can not interpret.

Looking at the java.util.Properties class for Java 6 - legal formats would have a 0-9 number or a-f or A-F hex digit following \u

Therefor your problem is in the content of your file, not where it is.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting MissingResourceException
 
Similar Threads
In Tomcat 5, example of JSP1.2 working but example of JSP 2.0 is not working
Tomcat + NullPointerException
web app
i looked at log file and not know to correct
ServletException and Wrapper cannot find servlet class