Loading resource bundle

 

Hi,
          Try putting it in classfiles directory.Do not keep copies of it in any
          other directories...It is working in my case so it should in u r cases
          too...
          Better luck..
          Sameer Gijare
          Joseph Benavidez wrote:
          > I'm having the same problem. I have resource bundles (techincally,
          > property files) in my classpath (not the servlet classpath)
          > that loaded fine with the ResourceBundle.getBundle() method
          > under 5.0 beta 2, but the call seems to be broken now.
          >
          > j.joseph benavidez
          > [email protected]
          >
          > > Philippe Renon wrote:
          > >
          > > Hi,
          > >
          > > I use the following line of code to load a resource bundle from within
          > > a jsp page.
          > >
          > > <%
          > > ResourceBundle bundle = ResourceBundle.getBundle("WebBundle",
          > > request.getLocale());
          > > %>
          > >
          > > I keep getting java.util.MissingResourceException: Can't find bundle
          > > for base name WebBundle, locale fr
          > > If have three files (WebBundle.properties, WebBundle_fr.properties
          > > and WebBundle_fr_FR.properties) , but
          > > I'm not sure where I'm supposed to place these files, so they can be
          > > loaded from the servlet.
          > >
          > > Philippe.
          > >
          > > PS: I use WL 5.1 & J2SE 1.3
          

Similar Messages

  • Please : WWC-43273 - ContainerException: Unable to load resource bundle

    Please Help :(
    Development Environment:
    Application : Hello World Portlet
    OAS : 10.1.2.0.2 Installed on LocalHost
    Development Tool : JDeveloper 10.1.3.2.0
    Portal Server : 10.1.4 Installed on LocalHost
    I have followed following Tutorial for the same : http://www.oracle.com/technology/obe/obe1014portal/standards_portlets/stdsplts.htm
    My EAR WSDL (http://localhost/HelloWorld/portlets?WSDL) in OAS is working perfectly fine yeilding following output :
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:bind="urn:oasis:names:tc:wsrp:v1:bind" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:oasis:names:tc:wsrp:v1:wsdl">
    <import namespace="urn:oasis:names:tc:wsrp:v1:bind" location="http://www.oasis-open.org/committees/wsrp/specifications/version1/wsrp_v1_bindings.wsdl"/>
    <wsdl:service name="WSRPService">
    <wsdl:port binding="bind:WSRP_v1_Markup_Binding_SOAP" name="WSRPBaseService">
    <soap:address location="http://infra:80/HelloWorld/portlets/WSRPBaseService"/>
    </wsdl:port>
    <wsdl:port binding="bind:WSRP_v1_ServiceDescription_Binding_SOAP" name="WSRPServiceDescriptionService">
    <soap:address location="http://infra:80/HelloWorld/portlets/WSRPServiceDescriptionService"/>
    </wsdl:port>
    <wsdl:port binding="bind:WSRP_v1_Registration_Binding_SOAP" name="WSRPRegistrationService">
    <soap:address location="http://infra:80/HelloWorld/portlets/WSRPRegistrationService"/>
    </wsdl:port>
    <wsdl:port binding="bind:WSRP_v1_PortletManagement_Binding_SOAP" name="WSRPPortletManagementService">
    <soap:address location="http://infra:80/HelloWorld/portlets/WSRPPortletManagementService"/>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
    However when i try to access the same via Register Provider wizard in Portal Server 10.1.4 i get this exception.
    An error occurred during the call to the WSRP Provider: Java stack trace from root exception:
    java.rmi.ServerException: Internal Server Error (java.lang.RuntimeException: oracle.webdb.wsrp.server.ContainerException: Unable to load resource bundle "portlet.resource.CHelloWorldBundle")
    at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:384)
    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:245)
    at oracle.webdb.wsrp.WSRP_v1_ServiceDescription_PortType_Stub.getServiceDescription(WSRP_v1_ServiceDescription_PortType_Stub.java:63)
    at oracle.webdb.wsrp.client.design.v1.OraWSRP_v1_ServiceDescription_PortType.getServiceDescription(Unknown Source)

    Found the solution:
    I needed to choose the Servlet 2.3/JSP 1.2 (J2EE 1.3) when creating my JSR268 Portlet.
    Also the second change I needed to make was to use J2SE ver. 1.4.2_12. To do this change the default j2se ver. of JDeveloper(i.e ver. 1.5) from project properties > libraries node > edit/change j2se definitions screen and select java.exe from j2se1.4.2_12/bin

  • Java: Loading Resource Bundle File with UTF-8

    I have found out all my previous problems now, thank you all for your assitance with this...
    During the time we have worked so solve our problem with UTF-8 charset we have found new problem with this?
    I don't know if this is the right forum to put this up, if not please let us know where to go with this?
    I have prepared both Eclipse (JSP Files) and GlassFish to run all my files in charset UTF-8. Then i got my
    resource bundle files(property files) to use UTF-8 encoding. Everything looks fine in my text editor. Then
    when i upload these pages every character retrieved from my resource bundles look garbled. This is because
    Java loads property files using ISO 8859-1 character encoding.
    This is a problem from Sun i have read on the internet!
    Note: that in JDK 1.6, you can use PropertyResourceBundle constructor to take a Reader which uses UTF-8 encoding.
    please have a look at these links for more info:
    [http://www.kai-mai.com/node/128]
    [http://java.sun.com/javase/6/docs/api/java/util/PropertyResourceBundle.html]
    Note: PropertyResourceBundle can be constructed either from an InputStream or a Reader, which represents a property file.
    Constructing a PropertyResourceBundle instance from an InputStream requires that the input stream be encoded in ISO-8859-1.
    In that case, characters that cannot be represented in ISO-8859-1 encoding must be represented by Unicode Escapes,
    whereas the other constructor which takes a Reader does not have that limitation.
    What i have read and understand is that the real solution to the problem is: Get the fmt lib to use a Reader instead of an
    InputStream. Alternativly if it works get a ResourceBundle instead of creating one that is wrong all the time? I have to create
    my own ResourceBundle instead of using my own fmt lib wich i cannot trust in a way any more. Is this right or am i comletly wrong?
    My WebTexts files, en, sv and ry are my resource property bundles. To be able to read them i will use resource property bundle reader.
    Fmt lib gives me this but it seems that it inciates this in an InputStream (wich is looked to iso-8859-1) instead of a reader who can
    read UTF-8 without no problem. So can i get my fmt lib to change this or not, anybody have an idea about this???

    Torleif wrote:
    Ok, i know there are a few ways of doing this already. The problem is that i have no idea how to use these different problem solving issues. First we have the;
    1. native2ascii command line utility.
    2. use the XML properties format.
    3. other ways of converting from iso-8859-1 to utf-8.
    The last one i have tried already but i never get this to work. So after knowing of 2 standardized solutions you choose to implement your own non-standard soltion? That's usually not a good idea until you've verified that the standardized solution don't help.
    This is also not the best solution to the problem i have to say. This way i will have both properties files and source files to work with and that is to much i think. Either i will use the native2ascii command or use XML properties format like you say here. I need some more insight in how these two work only because i have no idea my self.Uhm .. read [the documentation|http://java.sun.com/javase/6/docs/api/java/util/Properties.html]? loadFromXML/storeToXML work pretty much exactly the same as load/store, except they handle XML. Try it, look at what it produces, learn.
    Could you please help and explain how to use either this native2ascii command line work or how this XML format properties would work for me. Please i need guidance here with this!!![native2ascii is documented as well|http://java.sun.com/javase/6/docs/technotes/tools/windows/native2ascii.html].
    If you have a specific question after reading those, feel free to ask here.
    You really have to work on your Google-fu, it seems to be too weak.

  • Unable to load resource bundles in Flex 4.5 mobile

    Hi All,
    Starting to localize my strings in my first mobile application and for some reason... resourceManager is not finding my strings.
    My project structure is as follows:
    src/assets/locale/en_US
    resources.properties
    My compiler args are:
    -locale=en_US -source-path=assets/locale/{locale} -allow-source-path-overlap=true
    My first test is to externalize my first views title, but resourceManager fails to load my resource:
    views.loginView.title=Login
    Not sure what I am doing wrong, I am compiling my web client in Flex 4.5/Flash Builder Burito no problem but my mobile client is not finding my strings. Have tried cleaning ect...nothing... I also tried excluding the -source-path compiler args and added the new source path to Flash Builder but same result.
    Any help much appreciated.
    Greg

    Well, my resource bundles where not being compiled into my application due
    to a missing meta tag instruction informing the compiler to include it.
    <fx:Metadata>
        [ResourceBundle("resources")
    </fx:Metadata>
    As per the 13 errors... they seem to have gone away now and have not seen them since adding the metadata tag.
    Great doc on the subject http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fcf.html. Unfortunately, when I skimmed through it I missed the 'Using resource bundles' section that describes the metadata tag usage.
    Thanks for listening :-)
    Good Adobe

  • Error in Loading Resource Bundle in JSP

    Hi
    I have one Resource Bundle which working well in my JSP page
    i declared as below
    <f:loadBundle basename="com.ApplicationLabels" var="lblbundle"/>
    Ok then i want to add another new resource bundle and i put it below the first loadBundle tag
    <f:loadBundle basename="com.newLabels" var="newbundle"/>
    But when i access my JSP page it keeps giving me
    Exception Details: javax.faces.el.PropertyNotFoundException
    Error testing property 'test' in bean of type null
    Possible Source of Error:
    Class Name: com.sun.faces.el.PropertyResolverImpl
    File Name: PropertyResolverImpl.java
    Method Name: getType
    Line Number: 342
    What are the things i need to configure after i creatting properties file for my Application Messages in JSP page
    any idea about this exception?
    Thanks.

    Hi Voodi,
    in the record i have many columns that refered to date, i have: Valid-from, Valid-To H, created on, Valid From, Valid To- i don't know where is the specified column to check the required format, in PSA in the data package 19 i have 13755 Records posted and i have checked many records to control these columns but i don't find something that demonstrate me a difference between the format, i don't know why the error signalated is only 6701...but you think is only a problem of format it's not not somthing that i have to signalated to the person who works on R/3 if there is something to correct in the datasource?
    Thanks
    Bilal

  • Manually loading resource bundles

    Hi,
    i'm trying to use the .properties files to configure my app.
    This is outside of the general localization discussions and i'm
    running into a few problems. i'm building an internal global tool
    and want to use property files to define the specific views and
    attributes for each section. in my project i have a folder called:
    properties and in it there is a folder for en_US.
    inside of en_US i have two folders, one for each section: UPD
    and BBS. each of those folders have their own config.properties
    file.
    the compile directives look like this:
    -locale=en_US -allow-source-path-overlap=true
    -source-path=properties/{locale}/UPD,properties/{locale}/BBS
    in my application there is a drop down with BBS and UPD
    options. I want to switch to the correct bundle when a user changes
    the dropdown values. attached is the code for the dropdown and the
    switching.
    can someone tell me how to point to the correct bundles?
    Thanks,
    d

    I've tried referencing the default properties file that gets created with a new Visual Java Faces project called Bundle.properties which is in the base directory. This works and it does not complain about a default language en_AU.
    I've searched the directory files for anything thats different about the default properties file but can't find it referenced???
    Currently I'll run with this option but is there any setting I'm missing that prevents me referencing a resource-bundle file in another folder which might cause this error?

  • Loading resource bundle issue

    i am making an application to be run on windows. It is deployed in a directory with the following structure:
    application.jar
    mainFolder/
    -----lang/
    ----------bundle.properties
    -----etc...
    I'd like to store my .properties files for the resourcebundle objects in the lang folder, not bundled with the .jar file. When loading it I have
    ResourceBundle.getBundle("mainFolder.lang.bundle")and I run the application like this:
    java -cp .;%classpath% -jar application.jar
    so the lang directory can be in the class path, but this does not work. Any ideas (i get a java.util.MissingResourceException)? Is there any other way to load the .properties files and that aren't in the class path with all your java packages?

    http://forum.java.sun.com/thread.jspa?threadID=463657&tstart=30

  • Resource Bundle loading in Java

    Hi,
    I want to know how to load resource bundle in java? I have a requirement of reading xml files by looking the path in resource bundle.
    Any help would be highly appreciated.

    FacesContext context = FacesContext.getCurrentInstance();
    ResourceBundle bundle = ResourceBundle.getBundle(properties_file);
    bundle.getString(properties_name);

  • How to cache external resource bundles?

    Hi,
    I am using Build JDEVADF_11.1.1.4.0_GENERIC_101227.1736.5923 on Windows 7.
    We have used external resource bundle for our ADF application using loadbundle which extends java.util.ListResourceBundle.
    Is there any way to cache these external resource bundles? and If yes when/how it will get cached?
    We have found following link:
    http://www.orastudy.com/oradoc/selfstu/fusion/web.1111/b31974/appendixa.htm (Section: A.11 adf-config.xml)
    But not sure if it will help for external resource bundles.
    Any pointers will be highly appreciated.
    Thanks
    Vishal

    Hi again.
    To achieve your requeriment you can try next solutions:
    - Add a external path where you are going to let your Resource Bundle in your Manage Server Classpath. For example: /language (into this folder put your baseName folder's and properties file).
    - Build your custom Java Class to load Resource Bundle in a configured classpath or path.
    - Try to do a similar solution like WebCenter Spaces copying your resource bundle in MDS path and updating/getting it with WSLT scripts.
    Regards.

  • ADF FACES: af:messages does'nt display label with resource bundles

    Hi,
    There is a problem with the af:messages component and error messages containing labels (such as Value is Required error message for required fields).
    If I have an af:inputText with it's label property refering to a resource bundle loaded using the f:loadBundle action, when the Value is Required message is displayed, I get "" for the field name.
    If I replace the label property with a constant value or with an expression refering to a managed bean property, then the label is properly displayed in the error message.
    I suspect this has to do as to when the action of getting the label is done. Maybe the bundle is not availlable at that time. Anyway, this is a bummer as it mean that we cannot use the f:loadBundle action to load resource bundles.
    This happen with AE11. I have not tested this with EA12.

    Thank's!
    I'll try EA12 when I have the time.
    I also found that in our JSPs, we've put the f:loadBundle ouside of the f:view tag. I'll fix that in our codebase.
    While researching a fix, I found out that using a managed bean (which implement Map interface) to load the bundle based on the name refered in the expression language is a lot more intuitive and allow for an easier management of the different resource bundle than the f:loadBundle tag.
    Basically, our EL expression are now #{bundles.bundleName.property} we replace any "_" in bundleName with "." and then lookup this name as a ResourceBundle with the locale of the view. We keep the managed bean in the request scope it remember each bundle it loaded.
    We could have done it with a custom VariableResolver. Maybe a future release of the JSF spec could provide a standard variable name that would implement the same behaviour. This way, one does not have to load each bundles before hand and only the bundles accessed by the JSP will be loaded.

  • Resource bundles, loading in beans or in jsp or share them?

    Hi,
    I have a question and hope it is not a stupid one.
    What is the best way to work with resource bundles/messages developing faces application?
    One way is to load and use it in jsp. It is convenient and easy. Another is to use it within a bean. It's a little bit more complicated and might take more memory. Taking into account that sometimes general messages are to be used in both is there a guideline or some usual practice on how do I can access a resourcebundle that been loaded in jsp from bean?
    Suppose I have couple beans that might use the same messages - logically it is better to load bundle in jsp and use it from beans.
    Of course it could be loaded via faces config file, but some messages are needed only by couple of pages (registration for example).
    Please let me know your thoughts or how it is done usually.
    Thanks in advance!!

    You can use as many f:loadBundle tags in the JSP page as you want. You can also use them simultaneously with any <message-bundle> and/or <resource-bundle> declaration in the faces-config.xml. Just choose the one which covers the scope of the bundle in question.

  • How to load the resource bundle message on confirmation popup

    hi every one
    i am using java script confirmation message on my delete button.
    this is my sample for that one
    <h:commandButton action="#{createCurrency.removeCurrency}"
             onclick="if (!confirm('Are you sure to delete this value?')) return false" value="#{messages.Delete}"/>    i need to load the "Are you sure to delete this value?" from resource bundle.
    is there any way to load above message from resource bundle.
    thiagu.m

    If you're using JSF 1.2, you can add the bundle config in your faces-config.xml file like this:
    <resource-bundle>
       <base-name>mypackage.i18n.MessageResources</base-name> // i18n is shorthand for internationalization
       <var>msg</var>
    </resource-bundle>     
    <locale-config>           
       <default-locale>en</default-locale>  // or whatever locale you preferred 
       <supported-locale>...</supported-locale> // other locale defined here if you need them
    </locale-config>Then create a property file called "MessageResources_en.properties. In this file, you can define something like:
    {code}
    MSG_CONFIRM=Do you wish to delete this value?
    // add other messages here. Syntax is: key=value
    {code}
    Then reference the bundle's message in your form as per normal:
    {code}
    !confirm(#{msg.MSG_CONFIRM}))
    {code}
    I haven't tried the above codes but it should help you get started.
    Edited by: icepax on 13/11/2009 19:44

  • How to compare and edit Resource bundle file using java programe

    Hi All
    I have two resource bundle with key, value and some comments. I need to write a java code to compare both of the values of the keys and if the values are different then i want to replace the second value with the first value.
    Its a programe which will udpate the second file with the first file values.
    I tried using Properties class but it didnt worked because when i am saving the file using store method it removes all the comments and the order of text also got disturbed.
    How I need to do this any help appriciated.
    Please elt me know if someone needs more info.
    Thanks in advance.

    Let's assume the ini file is a mapping type storage (key=value) so lets use Properties object. (works with java 1.4 & up)
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Properties;
    public class Test {
         private static Properties props;
         public static void main(String[] args) throws IOException {
              File file = new File("test.ini");//This is out ini file
              props = new Properties();//Create the properties object
              read(file);//Read the ini file
              //Once we've populated the Properties object. set/add a property using the setProperty() method.
              props.setProperty("testing", "value");
              write(file);//Write to ini file
         public static void read(File file) throws IOException {
              FileInputStream fis = new FileInputStream(file);//Create a FileInputStream
              props.load(fis);//load the ini to the Properties file
              fis.close();//close
         public static void write(File file) throws IOException {
              FileOutputStream fos = new FileOutputStream(file);//Create a FileOutputStream
              props.store(fos, "");//write the Properties object values to our ini file
              fos.close();//close
    }

  • Problem using Resource Bundle in XSLT File

    Hi All,
    I've been trying to use Resource Bundle on my XSLT file with no success for the last 2 weeks. So I would like some help to definitely end this problem.
    The fact is that i have a property file that i would like to read and it works fine when i use jsp or a servlet however when i try to call the same property file using my XSL i get the message below:
    java.util.MissingResourceException: Can't find bundle for base name thoth, locale en_US
    Follow the code from my Stylesheet that i'm calling the resource bundle:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:java="java.util.ResourceBundle" exclude-result-prefixes="java" version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:output method="html" indent="yes" version="4.0"/>
    <xsl:output encoding="ISO-8859-1"/>
    <xsl:template match="page">
    <html>
    <body>
    <xsl:apply-templates select="paragraph"/>
    <xsl:variable name="resources" select="java:getBundle('thoth')"/>
    <xsl:value-of select="java:getString($resources,'general.title')"/>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    Please someone could help me why this file cannot be located, I am 100% of sure the property file path is in my classpath since it works fine in a servlet. Should i have to put it some other place? Do i have some other way to read this file and show the information from the file?
    I would appreciate any help
    thanks in advance and Regards
    Fabio

    Please someone could help me why this file cannot be located, I am 100% of sure the property file path is in my classpath since it works fine in a servlet.
    Is the property file in your classpath? or whether the directory where the property file is residing is in your classpath. Please put only the directory where the property file is located in the classpath and try again.
    It may be working fine with the servlet because j2ee servlet containers put the classes and lib directory automatically in the classpath therefore resource bundle gets loaded even without putting it explicitly in the classpath. This doesn't happen when you try to test some component from the console.
    Let me know if this does not work.
    regards,
    Abhishek.

  • Error: could not find source for resource bundle charts

    I am trying to upgrade from Flex SDk 3.4 to 3.5.
    I have copied the Data Visualisation SWCs under libs, locale and rlsls folders as suggested by adobe.
    I get the following error when building the application
    flex-library:
         [java] Loading configuration file /usr/local/lib/flex_sdk/3.5.0/frameworks/flex-config.xml
         [java] Error: could not find source for resource bundle charts.
         [java]
    What am I missing? Any help is highly appreciated.
    Thanks

    Copying
    /Software/FB\ Eclipse\ Plugin/Adobe\ Flex\ Builder\ 3\ Plug-in/sdks/2.0.1/frameworks/locale/en_US/charts_rb.swc into
    the 3.5 SDK directory
    /usr/local/lib/flex_sdk/3.5.0/frameworks/locale/en_US
    solves the problem.
    Not sure why as the charts_rb.swc comes from Flex 2.0

Maybe you are looking for

  • Sub contract

    my client running fg sub contracting  (electro plating )cycle through the MRP after return from vendor with mvt type 105 (543) i check document list with MB51. i found following g/l account effects : SFG consumption for sub contract  account = 602026

  • The ipod "IPOD" cannot be updated. The disk could not be read or written to

    "The iPod "IPOD" cannot be updated. The disk could not be read or written to" "The iPod "IPOD" cannot be updated. An unknown error occurred. (-50)" I have been dealing with this ever since I installed iTunes 7. I had been getting this message with my

  • Scheduled scenarios not working

    Hi everyone, I have created and configured ODI agent as Java EE Application successfully as mentioned below: http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_11g/setup_jee_agent/setup_jee_agent.htm The test is successful. Now I a

  • Adobe Acrobat Standard8.1/MS Office Word compatibility issues

    I have a new lap top with Windows XP, MS Office 2007, and Acrobat Standard 8.1. I am trying to convert a file to pdf. The MS Office Word document uses the Table of Contents, Table of Figures, and Bibliography/citations features, among others. In the

  • Folder recovery

    My wife accidently deleted a folder with numerous files in it. Is there any way to recover them or are they gone forever?