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

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.

  • Resource Bundle issue in ATG 10 migration

    Hi,
    Migrating from ATG 2007.1 to 10 & getting issues with resource bundle for Merchandizing pages in BCC.Page is loading the StoreMerchandisingIcons.swf from the WAR module.Additionally the page is throwing error #404 for StoreMerchandisingIcons_en.swf & StoreMerchandisingIcons_en_US.swf (which is not available in the WAR)
    This URL is loading fine
    http://localhost:8180/store-merchandising/StoreMerchandisingIcons.swf
    404 for these URLs
    http://localhost:8180/store-merchandising/StoreMerchandisingIcons_en.swf
    http://localhost:8180/store-merchandising/StoreMerchandisingIcons_en_US.swf
    Configured the resource bundle & default locale in the StoreConfiguration but still I am getting this error.Am I missing anything?
    Debugged through FireBug , not getting any error in the page or Jboss console
    Thanks in advance!
    Mani

    Hi,
    Application.getResourceBundle(FacesContext, String) retrieves the named ResourceBundle from faces-config.xml and is indeed a good way to access a bundle from an application.
    Now, however, you're trying to access a Model layer bundle which is itself an aberration imho. I already mentioned that in numerous posts in the past, but I won't ever think that specifying localized information in the model layer is a good design. At best I could accept it for default value, but localized message it in no way a business logic concern, it's pretty much a pure presentation one. The model layer should return error code/keys and parameters and it should be the responsibility of the view layer to translate it in an understandable version for the target client (human or automated). Can't you use a view layer bundle?
    Regards,
    ~ Simon

  • 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

  • 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
              

  • 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

  • Jstl resource bundle issue

    Hi, I am using JSTL resource bundle. It is defined in
    web.xml:
    <context-param>
    <param-name>
    javax.servlet.jsp.jstl.fmt.localizationContext
    </param-name>
    <param-value>
    package.ApplicationResources
    </param-value>
    </context-param>
    My question is that if I have two or more resource
    bundle properties such as
    ApplicationResourcesBase.properties,
    ApplicationResourcesApp.properties, how do I regiester
    them in web.xml, and how do I call it in my JSP using
    fmt tag?
    Thanks,
    Hong

    Same problem...
    It looks like a bug

  • 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?

  • Resource Bundle Issue in BackingBean

    Hi,
    JDeveloper 11.1.1.3.0
    I am getting null, when I am trying to retrieve the ResourceBundle using the below code. Please help.
    FacesContext fc = null;
    ResourceBundle rb = null;
    fc = FacesContext.getCurrentInstance();
    rb = fc.getApplication().getResourceBundle(fc, "com.model.ModelBundle");
    System.out.println("rb is: "+rb);
    Note: I am trying to get the value from default resourceBundle from Model project.
    Thanks.

    Hi,
    Application.getResourceBundle(FacesContext, String) retrieves the named ResourceBundle from faces-config.xml and is indeed a good way to access a bundle from an application.
    Now, however, you're trying to access a Model layer bundle which is itself an aberration imho. I already mentioned that in numerous posts in the past, but I won't ever think that specifying localized information in the model layer is a good design. At best I could accept it for default value, but localized message it in no way a business logic concern, it's pretty much a pure presentation one. The model layer should return error code/keys and parameters and it should be the responsibility of the view layer to translate it in an understandable version for the target client (human or automated). Can't you use a view layer bundle?
    Regards,
    ~ Simon

  • 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.

  • Resource bundle naming issue across platforms

    Sorry, but there's no issue anymore. After a complete restart of the windows server it now accepts lowercase "da".
    We're using resource bundles to internationalize our app for English and Danish users. The default resource bundle is named "ViewControllerBundle" and the Danish bundle is named "ViewControllerBundle_DA" (on windows at least).
    Our problem occurs, when we deploy the application on different platforms. At the moment we have Weblogic 10.3.5 running on Linux and on Windows. Our development environment (JDeveloper 11.1.2) is running on Windows.
    When we deploy the application on Weblogic/Linux we need to rename the Danish resource bundle to lowercase "da", like "ViewControllerBundle_da".
    When we deploy on Windows or runs the application from JDeveloper we need to name the Danish resource bundle with uppercase "DA", like "ViewControllerBundle_DA".
    If we don't rename the bundles we're not able to display danish labels etc.
    I would like to know, whether we are naming the bundle the right way or whether it is possible to avoid this manual renaming before deploy. We would like to use the same EAR file for all the servers, if possible.
    From faces-config:
    <locale-config>
    <default-locale>da_DK</default-locale>
    <supported-locale>da_DK</supported-locale>
    <supported-locale>en_GB</supported-locale>
    </locale-config>
    Edited by: wmjaboj on 2011-08-30 02:45

    b) In some parts on our website, we need to show data, depending on an attribute in a user's profile. So, for instance, if the user is not an administrator, the address shouldn't be shown when his profile is shown to a regular user. Is there an elegant way to solve this? I'm a Struts programmer (first JSF project) and normally you do <c:if test="${}">, but that's not possible in JSF :-).You can certainly use JSTL in JSF. You need at least JSF 1.2 at a JSP 2.1 environment and JSTL 1.2. Google for "unified EL" in Sun.com. But if you want to use a JSF-only solution, then make use of the 'rendered' attribute which is supported by every JSF HTML component and a few JSF core components. It accepts a boolean expression and when it evaluates to true, then the component will be rendered in the view.
    E.g.<h:panelGroup rendered="#{user.admin}">
        <h:outputText value="I am an admin." />
    </h:panelGroup>where the User bean look likepublic class User {
        public boolean isAdmin() {
            return admin;
    }Here are some more EL examples which you can use in the 'rendered' attribute:<h:someComponent rendered="#{myBean.booleanValue}" />
    <h:someComponent rendered="#{!myBean.booleanValue}" />
    <h:someComponent rendered="#{myBean.intValue > 10}" />
    <h:someComponent rendered="#{myBean.objectValue == null}" />
    <h:someComponent rendered="#{myBean.stringValue != 'someValue'}" />
    <h:someComponent rendered="#{!empty myBean.collectionValue}" />
    <h:someComponent rendered="#{!myBean.booleanValue && myBean.intValue != 0}" />
    <h:someComponent rendered="#{myBean.stringValue == 'oneValue' || myBean.stringValue == 'anotherValue'}" />

Maybe you are looking for

  • How can I see the "attachment" icon in my inbox viewing screen?

    All I want is to see which emails in my Inbox have attachments included in them. However, there is no icon in the Inbox viewing screen. I can only see it after I've opened email. Does anyone have any advice on what customization I can use for this pr

  • FI HR Integration

    Hi friends, HR module is implemented in our project and I need some help on payroll integration with FI. 1.     If HR module is implemented is it necessary to create all employees as vendors? 2.     Assuming that there is no need to create all employ

  • No images in Library grid view

    Hi, In V1.0, when I set my Library to grid view I only see my images for a short while. Then all images turn to grey squares. Updating the grid (like changing thumbnail size or sorting order) again shows images only for a short while. Loupe and Compa

  • How to Use Regex Options in CS2 [JS] - Reg.

    Dear All, Hai, I have doubt about the Regex options using in CS2 - Script. Problem : filename = "FTR0123a.indd"; k = Regex.match(filename,"(^FTR)(\d+)([A-Z*])\.(indd|indt)) if k.match = success k1 = "." k2 = $1 [ Stored in First Value only] k3 = $2 [

  • May I know how to confighure the ADF views,Entity to load while startup

    Hi, I want to load some lookup tables i.e adf views/entities while starting server. May I know how I can confighure that in oc4j? Thanks,