• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting MissingResourceException

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic