I18n:bundle and properties files
Hi,
I'm currently developing a multi-language web site with some users having local administration roles for their own country.
I need to provide online resource translation feature. So I made pages for editing properties files.
The problem is that the files are correctly updated but the pages still show old values unless webapp is restarted.
I tried to clear the cache of the ResourceBundle class (by getting the cacheList class field) but it didn't change anything to the problem.
Any help on this ?
Thanks in advance.
Sorry, I forgot about my post in this forum...
I solved this problem by developping an alternative implementation of the ResourceBundle class meeting my needs, and corresponding taglib upon it to use in my pages.
This works fine.
Similar Messages
-
Revision: 2200
Author: [email protected]
Date: 2008-06-24 07:46:04 -0700 (Tue, 24 Jun 2008)
Log Message:
The main package will now also include the ja swc's and properties files.
-it will not include the samples, these will still be in the ja zip
bug:http://bugs.adobe.com/jira/browse/SDK-15852
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-15852
Modified Paths:
flex/sdk/branches/3.0.x/build.xmlHi,
First up thanks for helping out, I really appreciate it.
Is there a way to change that or should I simply add the file to the Classpath?
The config file at present sits in c:\Temp\ESFGFL\servicelayer\config\maysqlconfig.properties with the code in the servicelayer directory.
My classpath is set as .;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Program Files\Java\jre6\lib\javamail-1.4.2\mail.jar
What do I need to change here? Ultimately te code will be on a servera nd so will the config file but learning some lessons by testing locally is proving invaluable.
Thanks again for your help
nathj -
I18n, bundles and personalized taglib
Hello,
My aim is to write a personal taglib which could be used such as:
<menu:menu>
<menu:groupmenu name="${menu.group0}">
</menu:groupmenu>
</menu:menu>
the menu.group0 would be an entry in a mymessage.properties file that would be in the classpath
Actually my ${menu.group0} is not interpreted
So my question is why??!
I've set the rtexprvalue to true in my taglib class handler.
I'm not sure of versions of jsp-api to use...as well as I'm not sure if it's possible
Does el expressions evaluate message.properties entries?? or just objects in some scopes?
Any help would be very great, I'm stuck with this :-(
ThanksDoea anyone from BEA have a reply on this?
Sincerely,
Paul Nyheim
Paul Nyheim wrote:
OK. Thanks.
In our case, we have started out using <netui:label> tags with the
{bundle} value. This works great both in pageflows and in jsp's. However
we have not found a similiar feature here as in the <i18n> taglib that
allows reloading with "i18n.bundle.reload.seconds".
What is the preferred way from BEA when developing portals?
Mvh,
Paul
srini_1976 wrote:
I donno what BEA reccomended way of doing it is... but in our
application we use i18n tags to access i18n message resources.
You can paste the following in your web.xml and it checks for the
properties files and reloads it every 5 mins.
All you have to do is just refresh the JSP. While in development I
have it set to 30 secs.
<context-param>
<param-name>i18n.bundle.reload.seconds</param-name>
<param-value>300</param-value>
</context-param>
As to your question about where to place these files. I would
reccomend putting them in the root folder for the files which will be
accessing these properties.
Hope this helps. -
Hi all,
I have a jar file packaged as com.company.java located in $JAVA_HOME/jre/lib/ext. It will read a properties file when it is initialized. As I know, properties file needed to put under $CLASS_PATH. So I put it under $JAVA_HOME/jre/lib/ext also. However, the JAR file failed to load the properties file.
Below is a part that in JAR file for getting properties file.
ResourceBundle rb = ResourceBundle.getBundle("abc",Locale.getDefault());
s=rb.getString("key1");
} catch (MissingResourceException e) {
s=null;
e.printStackTrace();
Do I put the properties file in wrong location?
Where do I put it to make it work?
Rgds,
unplugby default you have 3 class loaders that load classes as well as read resources:
The bootstrap classloader (for the core classes)
The extension class loader (finds anything in any .JAR placed in $JAVA_HOME/jre/lib/ext/ [which is the home directory for "extension modules"])
And the system class loader (looks along the classpath, finds files inside JARs [listed in the classpath] and in normal subdirectory structures [of base directories listed in the classpath] that mirror the hierarchy of Java packages)
Any of these is supposed to consult the previous loader on the above list first, and try a lookup on its own only if the previous loaders did not find a class.
ResourceBundle.getBundle(String, Locale) uses the classloader of its caller to look for the properties. If your method calling getBundle() was called from another method inside your extension module it will first consult the extension classloader (which first consults the bootstrap classloader) and will not be able to use the system classloader. So you can place anything in the classpath but it won't help. And the extension class loader can only look into JARs, not plain package directories.
If the getBundle() method were called directly from the application code, however, it will use the system class loader to locate the properties file.
There is a method ResourceBundle.getBundle(String, Locale, ClassLoader) where you can pass in e.g. the system class loader if you know how to get it, so this might help. The application code would determine its own class loader and pass it to the method of your your extension module.
But I am not sure that you should place the properties file in $JAVA_HOME/jre/lib/ext/ since this is intended for Java extensions rather than normal user code, it normally does not show up on the classpath. Also, if you place it along the classpath, you have to pass in the classloader to be used since your code was loaded by the extension classloader and has no immediate knowledge of the system classloader.
But perhaps it would be wiser to load your resource bundle reader in the system classloader, like any other application code: Remember that classes loaded by the extension classloader have higher security privileges than normal application code (the security policy file that you can edit refers to application code!) and it is questionable whether a resource bundle reader needs that privileges. If it does not, you might just place it in the classpath rather than the extension directory. Then it is quite natural that a properties file will also be found on the classpath. -
okay, this may be really naive and maybe i'm missing some key piece of
documentation, but i'm missing something regarding the file structure with
iplanet enterprise 4.1 on solaris.
in my /usr/local/netscape/suitespot there's a docs directory that is the
default docs directory.
I've created a /WEB-INF directory under docs and a /classes directory under
that. I've placed a jay.properties file in the /WEB-INF/classes directory,
but when I try to access that through a servlet instantiated bean, I get an
error from the ResourceBundle call, telling me that it can't load that
properties file.
I have two questions:
1. did i build the WEB-INF directory in the correct place (ie - is this the
standard way of working under the iplanet server) - this doesn't seem to be
supported by the admin server in the sense that i can browse this directory,
when i'd expect that iplanet would build in some basic security around the
WEB-INF directory
2. what do i name and where do i put the properties file? should it be
jay_en.properties? i've tried a number of different scenarios with no luck.
thanks...
jayWhy would you create a WEB-INF directory on the web tier?
WEB-INF is a directory with a special meaning to the web container. All
of your properties files and such will need to be placed on the
application server tier, in the WEB-INF directory that was automatically
created there. And you can do that just be properly placing them in the
WAR file.
David
Jay Wright wrote:
> okay, this may be really naive and maybe i'm missing some key piece
> of documentation, but i'm missing something regarding the file
> structure with iplanet enterprise 4.1 on solaris.
>
> in my /usr/local/netscape/suitespot there's a docs directory that is
> the default docs directory.
>
> I've created a /WEB-INF directory under docs and a /classes
> directory under that. I've placed a jay.properties file in the
> /WEB-INF/classes directory, but when I try to access that through a
> servlet instantiated bean, I get an error from the ResourceBundle
> call, telling me that it can't load that properties file.
>
> I have two questions: 1. did i build the WEB-INF directory in the
> correct place (ie - is this the standard way of working under the
> iplanet server) - this doesn't seem to be supported by the admin
> server in the sense that i can browse this directory, when i'd
> expect that iplanet would build in some basic security around the WEB-INF
> directory
>
> 2. what do i name and where do i put the properties file? should it
> be jay_en.properties? i've tried a number of different scenarios
> with no luck.
>
> thanks... jay
>
>
> -
Java Internationalization and .properties files
Hi everyone,
Isn't it problematic that the way to internationalize your java apps ( .properties files ) doesn't support UTF-8 and you have to user gibberish looking unicode escapes. Some will say that you don't need to write and the converters or editors will handle the ascii conversion but the requirement for such a intermediate process doesn't seem right. Sometime you have to edit some string on the server and it should be human readable using text editors that support UTF-8. I thought loadFromXML and storeToXML methods that came with java 1.5 seemed to solve the problem but than noticed that PropertyResourceBundle doesn't support xml properties files. Is backwards compatibility the reason that properties files aren't utf-8 by default?
Thanks
BilgehanTry PRBeditor (http://prbeditor.dev.java.net).
-
Hi,
Does anyone experience similar problem. I am using NT Realm using a user already define in my NT domain. The properties File for WLS required that password be present for the system user.
Having this when I start weblogic, I can log onto WLS with password define for the system user in NT domain as well as the funny password I put in the properties file just to fill the requirement.
I thought that the password define in NT domain should prevail over the one define in the properties file. Is there any solution around this? Any help will be greatly appreciate?
Thanks.
Amen Akakpohi,
use PreferredMaxBytes=0 in the config.xml something like.
<NTRealm Name="MyNTRealm" PreferredMaxBytes="0"
PrimaryDomain="xyz.com"/>
thanks
kiran
"Marco Righetti" <[email protected]> wrote in message
news:3cc745f8$[email protected]..
>
I´m facing a problem with JVM when configured my NT Security Realm in WLS6.1 SP2.
NT server 4 SP6a. When WLS started, I got message reporting ACCESSVIOLATION at module
NTAPI32.DLL (outside JVM) in Function: LocalGroupEnum. After teh WLS isterminated.
The user that start WLS has rights in Domain as part of system and tokensand he
is member of Administrators (both Local and Domain groups)
Does anyone know what is happening ?
Regards
Marco -
Using jrun and properties files
For some reason my while deploying, the jsp cannot find the .properties file. I've tried putting it in almost every single directory on the server. Can anyone help???
ThanksThe .properties files must be in the classpath that JRun is using. There should be a <something>\classes directory in your CLASSPATH that JRun's using, try putting it in there.
Take Care,
Rob
null -
Hello,
I am wondering if an application (java classes for instance) can read a .properties file inside the ear package, when the application is deployed ?
(only reading of course)
Thank youI'd recommend using ClassLoader.getResourceAsStream to access the properties file.
This means the file needs to be in the resource path of your classloader. In WLS, an easy way to do this is to have it in the APP-INF/classes directory of your EAR file.
-- Rob
WLS Blog http://dev2dev.bea.com/blog/rwoollen/ -
Hey guys,
I have a WAR file( for my web application) . Its basically a Struts application running on weblogic7.0 server There is a MyXXX.Propeties file in web-inf/classes folder and when i run the application the property file is not recognized( unable to read it) i get something like this
???en_US.label.xxx???
Do i need to set some classpath for the server ?
Regards,
KMAny answer ??
-
Images and .properties(bunldes) files are not being found from my JSPs
Hi,
I have created .ear file by using ANT Application. And deployed into Oracle9iAS(OC4J). Here problem is that images and .properties(internationalization bundles)files are not found from JSPs.
Here is my directory structure.
public_html--->locale -->BusinessEntity -->businessentity_en_US.properties
--->enterprise -->images -->knowldege.jpg
--->BusinessEntity-->BEAdd.jsp
in my jsp bundle(.properties)file is accessed like this:-
<i18n:bundle baseName="/locale/-->BusinessEntity/businessentity" id="businessentity" locale="<%= locale %>" />
in my jsp images accessed like this:-
src="/enterprise/images/knowldege.jpg".
In my working environment, without creating .ear file, images and .properties files are being found my JSPs. But if i create .ear file and after deploy, images and .properties files are not being found my JSPs.
please let me know where i might did wrong
thanks in advance
srinivasHi i am again. Here is my configuration files(server.xml and default-web-site.xml)
server.xml :-
<?xml version="1.0"?>
<!DOCTYPE application-server PUBLIC "-//Evermind//DTD Orion Application-server//EN" "http://xmlns.oracle.com/ias/dtds/application-server.dtd">
<application-server application-directory="../applications"
deployment-directory="../application-deployments"
>
<library path="../tools.jar" />
<rmi-config path="./rmi.xml" />
<jms-config path="./jms.xml" />
<log>
<file path="../log/server.log" />
</log>
<transaction-config timeout="30000" />
<global-application name="default" path="application.xml" />
<application name="nalluri" path="../applications/trainiumear.ear" auto-start="true" />
<global-web-app-config path="global-web-application.xml" />
<web-site path="./default-web-site.xml" />
<cluster id="-1640090707" />
</application-server>
default-web-site.xml:-
<?xml version="1.0"?>
<!DOCTYPE web-site PUBLIC "Orion Web-site" "http://xmlns.oracle.com/ias/dtds/web-site.dtd">
<web-site port="8888" display-name="Default Oracle9iAS Containers for J2EE Web Site">
<default-web-app application="nalluri" name="Commonwar" />
<access-log path="../log/default-web-access.log" />
</web-site>
thanks in advance
wating for reply
srinivas -
JWS : Properties and Log file locations?
We have a swing app that used log4j to log to a file. It also uses Apache commons PropertyConfiguration to allow the user to setup and save properties to a file.
This all works great when running the app locally. The app creates the log file and properties file in the folder where the user launches the app from.
Now that I'm trying to launch the app via JWS we should have the log file and properties file in some "known" location so that it doesn't matter if they launch the app from a browser, or from a desktop icon, or from a menu - the app will always look for the file in the same location.
Any thoughts on where this location should be? For now we are just releasing to Windows users but eventually we will need to be able to launch on Mac and Linux as well. Is there some convention as to where such files should reside when using JWS?
Thanks in advance!If it is signed, it can use a subdirectory of System.getProperty("user.home").
You may want to look at PersistenceService.get(...).getXXXStream() that may overcome sandbox restrictions.
Edited by: baftos on May 3, 2012 1:16 PM -
my application uses the some image file and properties file i want to bundle all the required files into single jar file and while double click it should lonch
how can i acchive thisYou're getting on my nerves, buddy. Most of your questions could be answeed by a little research.
ClassLoader.getResource
ClassLoader.getResourceAsStream
Exectualble JARs
If you now ask me to elaborate, I'll report you for abuse. -
How to Add JAR files and Config files to CLASSPATH at runtime?
QUERY:
During runtime, I need to load the JAR files and relevant config files( .cfg files and .properties file) into CLASSPATH and run a specific java program from one of the JAR which is available in CLASSPATH.
Please advise me any relevant Java API details or a sample java program to implement the above use case.
Thanks in advance.During runtime, I need to load the JAR files and relevant config files( .cfg files and .properties file) into CLASSPATH and run a specific java program from one of the JAR which is available in CLASSPATH.
Please advise me any relevant Java API details or a sample java program to implement the above use case.
You don't add to YOUR classpath once your app is launched.
You create a NEW process for the app you want to run and provide the proper environment for it to run in - including any PATH or CLASSPATH environment variables.
The Java API for the ProcessBuilder class has a simple example that shows how to create the arguments and launch an external application.
ProcessBuilder (Java Platform SE 7 )
There are also PLENTY of other examples of using ProcessBuilder; just search the net. -
Properties file generated by netweaver
Hallo,
Can I use the properties files generated by netweaver using I18N tools (wdcontroller.xlf ==> I18N tools ==> create properties files ) for a general use instead of an external manually generated properties file ?
Thanks,
regards,
AndreaI think you are talking about the internastionaization concept in the webdynpro application, actually the propetieas file will create automatically whne u save your XLF with the changing of the text. but you can create it your self in which way ur telling is correct.
may be it will helpful for you,
Chees,
Apparao
Maybe you are looking for
-
HT4972 What's new in ios 5.1.1(9B208)
hi! i searched on the internet but couldn't find anything..Do you know what's new in ios 5.1.1(9B208)???
-
Flash page works in Safari but not in Firefox
I generate my web pages using LR. When I launch my pages on Safari they look great but on Firefox the slideshow portion is sized MUCH smaller. I have attached the page herehttp://www.8aphotography.com/Interior_Photography_Page/index.html. Please chec
-
HP Photosmart Studio freezes after launch
Does anyone else have a problem with HP Photosmart Studio freezing/not responding as soon as it is launched? I have a 15 inch MacBook Pro running 10.5.5, though the problem has been the same since 10.5.1. I have uninstalled and reinstalled the latest
-
I don't suppose it affects many people but I need to be able to show an image per quote line. To do this we'll save the images in the file system with the quote id as the filename (+".gif"). The problem is trying to work out the size of the image. It
-
Hi, I need to extend a SupplierSitesVO. I downloaded the VO from the server to my local machine and opened the VO in Tutorial.jpr I also brought all the dependent objects by referring to server.xml to the respective folder, but when I am trying to re