Using system properties in config file.
HI,
Does anybody know how we can declare System properties in OC4J.
I am talking about using System.getProperty() in java classes.
I need to use this to capture my context realtive path in log4j properties file.
JavaSiva,
If you are using OC4J stand-alone, there are two ways (I know of) to define "System" properties:
* Use "-D" option of "java" command when launching OC4J
* Use "-p" switch recognized by "oc4j.jar" when launching OC4J
Note that I haven't tried OC4J stand-alone developer's preview 10.1.3.1.0 so I don't know if the above is still correct for that version, but it is for every version prior to that one.
Good Luck,
Avi.
Similar Messages
-
Reloading the Properties form config file
the doubt is on reloading the properties without restarting the server...
Earlier, I have a PropertyReader class which loads the properties from config file, here is the process I followed.
1)Calling the getInstance() from out side, which test the local instance variable exist or not, if it exists, then skip the creating new instance, else create the object by calling the self Constructor. Here is the method
public static PropertyReader getInstance(String fileName) throws IOException{
if (instance==null){
try {
instance = new PropertyReader(fileName);
} catch (IOException e) {
throw e;
return instance;
}2) In the Constructor, I read the properties from the property file like the following.
Properties props = new Properties();
InputStream fileIn = null;
fileIn = getClass().getResourceAsStream("/" + "ldap.properties");
props.load(fileIn);In this scenario I can't access the modified properties until I restart the server.
Now, I came to change the code to reload the properties with the following scenario.
1) in my getInstance method, I skip checking the instance and just calling new objct every time.
public static PropertyReader getInstance(String fileName) throws IOException{
return new PropertyReader(fileName);
}2) Even after this, I can't access the latest properties, then I change the code in the Constructor like the following .
URL codebase = getClass().getProtectionDomain().getCodeSource().getLocation();
String subPath = codebase.getPath().substring(0, codebase.getPath().indexOf("WEB-INF")+16);
file = new java.io.File(subPath+"ldap.properties");
fileIn = new FileInputStream(file);
props.load(fileIn);Here it is, now I'll be able to get the latest properties even without restarting the server.
So here I got couple of questions.
1) What if I create new instace everytime, will that cause any trouble in the memory point-of-view? i.e. load trouble?
2) What is the difference between 2 nd step in each scenario ? I can't get the exact difference.
Thanks,
Sumant K
Edited by: sumant14 on Jun 4, 2009 6:47 PMsumant14 wrote:
So here I got couple of questions.
1) What if I create new instace everytime, will that cause any trouble in the memory point-of-view? i.e. load trouble?If you create just ONE object occasionally? Don't waste your time worrying about that. Unless you're doing this thousands of times each second.
2) What is the difference between 2 nd step in each scenario ? I can't get the exact difference.The first one just gets the properties file from the classpath. The second one is a bizarre hack which might do the same thing, or it might fail in certain circumstances. -
How to access System properties in xml file
hi,
i want to read system properties in my xml file using ${} .
I tried it but did not find any way.But when i use log4j if i set some variable in
System properties that properties is read by the log4j.properties .
I am writing a simple program that read a xml properties file file
try {
props = new Properties();
fis = new FileInputStream(xmlFile);
props.loadFromXML(fis);
}before reading this file i set some properties and accessing this properties from that xml .but i cant.
Thankssabre150 wrote:
fun_with_java wrote:
can you give some example?Not really - I would have to write the code for you and I'm not getting paid for writing your code.Thanks for your kindness.
I dont ask you to write the code.Need some help to start it .Actually i dont have knowledge that
whether xml file automatically read it or i have prase the system property manually. Now i got the way to
access system property in xml..
Ok thanks again..
Thanks & Regards -
SQL Agent Job failing - not using credentials in the config file for Data source
Hi
We have an SSIS pkg, that is secheduled as SQL Agent job using proxy account. The pkg contanins data source for connecting different SQL servers and the proxy account do not have access to the external DBs. The data source credentials are stored in the Config
file.
Why the job is not using the credentials in the config file and try to use the proxy account and failing.
Do the proxy account need access to all the external dbs in the pkg, and then what is the purpose of the config file.
I am sorry, i am not SSIS person trying to understand. If any one can explain tha will be great!!
Thank you!
VRPlease take a look at these URLs:
Schedule a Package by using SQL Server Agent
SSIS package does not run when called from a SQL Server Agent job step
Cheers,
Saeid Hasani
Database Consultant
Please feel free to contact me at [email protected] as well as on Twitter and Facebook.
[My Writings on TechNet Wiki] [T-SQL Blog] [Curah!]
[Twitter] [Facebook] [Email] -
Hello,
How can i add the shortcuts for Office 2013 feature (Word, excel, ext) to the users taskbar or desktop with using config.xml file while installing the Microsoft Office 2013 from SCCM?
I know how to do that with OCT, but i have another problem if i use OCT. So i have to do it with Config.file, but i don't know which code can i write on config.xml file to create shortcut on desktop or taskbar...
Regards,Hi
There is a known issue about
changing the shortcut location for an Office 2013 application:
When you try to change the shortcut locations for Office 2013 applications in the Office Customization Tool (OCT), you receive the following error message:
Invalid start in folder. Please try again.
Then, you add the Start in location for Office 2013 and run a customized installation. When you double-click the shortcuts that are displayed on the desktop, Configure shortcuts does
not work and you receive the following error message:
Sorry, we couldn’t find your file. Is it possible it was moved, renamed or deleted?
To work around this issue, type a single open bracket ([) in the Start in
field.
In addition, refer to the link below on "Configure shortcuts" in OCT:
http://technet.microsoft.com/en-us/library/cc179097.aspx#Configure_shortcuts
Regards
Tylor Wang
TechNet Community Support -
Should I use .INI or .XML config files on cRIO?
I'm looking to make a configuration file for an application running on a cRIO-9022. It will contain a small amount of configuration data (like numeric offsets, file paths, and IP addresses). I have 2 questions:
1) Which file format should I use (.ini or .xml)? I have used .INI in the past because it is human readable/configurable with notepad, but it seems like .xml is becoming the new standard
2) I would like to be able to modify config parameters on the PC that connects to the cRIO. What is the best way to modify the config file if it is stored on the cRIO hard disk (FTP the file to PC, make changes, FTP back? Network Streams?)
--CLD--
LV 6.1, 8.6.1, 2011 SP1, 2012 SP1JimMacD wrote:
Thanks for the info.
Any clever ways of accessing and changing the Config File data from a LV application running on a PC that doesn't require manually editing the file? I want the operator to just be able to click a button that says "cRIO Config", open a dialog, and change the values from there.
uhm.... Yes!
In This Post I show a bit of my hand on just exactly what I keep in a ini.config file (wel,l 1 section of a config file) It would be nearly idiotic of me to not provide a Config editer since there are numerous Enum type defs in the delimited value for each key. so since I, as the developer, know what sections (and possibly keys) are there I can read the file and load them to indicators on a config editor GUI.
I've actually done this two ways-
1) a seperate app that only "admin Engineers" know the location of "Launch Config editor.exe.
2) In the application referanced above I have a button that opens a MODAL panel to edit the file (remember- I know what is in the file). Users need permissions (Users- Passwords and permissions are kept in a config file, of course!) to even display the "Edit Sequence" button. but the "super user" can edit the step parameters.
HINT: one of these "Steps" loads a xml file to expose telnet commands and config for the uP on the DUT. I expect the firmware on the Linux DUT will change in the future and did not want to rebuild my app whenever a typo was fixed in a command line tool. BUT, since there are "special characters" that do not fit nicely into a .ini I exposed the telnet commands and line ends IP address and the login script in a xml file.
I know this did not directly answer your question! but It should provide some food for thought.
If you can share your data structure- I can be more specific.
Jeff -
Using JNDI to access config file located outsite j2ee app
Hi I'm wanting to store a config file for my J2ee app, somewhere on a tomcat server possibly inside the
conf/ directory so that I can update this config file without having to redeploy the j2ee app every time a change is made.
I've been told I can use JNDI to access this file, but I can't seem to find any examples or documentation on how I can do this.
I'm new to JNDI and would appreciate any help, or suggestions.
Thanks,
Tim
EDIT:
So far I can access the file with this code:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
try {
Context ctx = new InitialContext(prop);
// look up context for name
//env.put(Context.PROVIDER_URL, "file:C:\\confluence\\confluence-2.5.1-std\\conf");
File f = (File)ctx.lookup("/confluence/confluence-2.5.1-std/conf/test.txt");My new problems are:
1. The commented line env.put(Context.PROVIDER_URL, "file:C:\\confluence\\confluence-2.5.1-std\\conf"); it says in examples that this should set the dir to look in to the conf dir but if i change the lookup value to just test.txt it cannot find it.
2. Can I somehow set the context to look into the conf directory of Tomcat without hard coding the path, as the path could change or be different on different machines??
Edited by: Timothyja on Jan 15, 2008 7:00 PMHi Kiran,
Looking at the code you sent and the error, it looks like you should be casting the ds object to a javax.sql.DataSource object not a weblogic.jdbc.common.internal.RmiDataSource object.
You may find some useful info at the following URL:
http://edocs.bea.com/wls/docs81/jdbc/rmidriver.html#1026007 -
How to use env variables in config files?
i created a folder in /etc/skel called .arch to hold some wallpapers and icons relating to arch. this ended up in a new users folder as it should. well i use lxde and pcmanfm. what i did was go into the /.config/pcmanfm/LXDE/pcmanfm.conf and change the wallpaper and menu icon path to $HOME/.arch/wallpapers/filename but it didn't seem to work. if i actually put /home/user/.arch/wallpaper/filename it works. is there a way around this? so i can default the new wallpapers to the folder i created?
or should i be putting these in /opt or /usr somewhere?Could you please paste here the exact part of the config file? (Edit: Some time ago I encountered a similar issue and in my case removing the quotation marks solved the problem. Try doing the similar: either use quotes, be it " " or ' ', or remove them and see if this helps.)
Last edited by bohoomil (2011-10-01 23:34:24) -
Warning 10.4.3 upgrade delete System & Users Squirrelmail config files.
Just installed the 10.4.3 upgrade.
After the upgrade was done I noticed WebMail settings was back to default.
So I had to set everything up again.
But what makes me angry is all the users preferences has been reset aswell.
I haven't read anything about this before I upgraded.
Makes me angry!Thanks for bringing this up... I'll keep a close eye on my upgrades....
This is also a good reminder for everyone to have a previous-state clone available for such a case....
Jeff -
ClassLoader in JAR file not loading config file properly
Hi all,
I have an application that I am going to deploy using JavaWS, and everything works fine except for one little hitch. I have a configuration file, nvacconfig, located at NVAC.jar/config/nvacconfig. I'm trying to load this file into my application using a ClassLoader, but it does not seem to be working.
I have a method from a certain class that loads the configuration file. The class is not important, as it is part of an API that I cannot alter. This class has a load(String file) method, that loads the specified configuration file with a String argument. This works fine when I run my application from the command line and when the configuration file is not located in the JAR, but I need to include this configuration file in my JAR, so I can run my app in the JWS sandbox.
To load the file when it is NOT inside a JAR, and is simply located at config/nvacconfig, I just use:
id.properties.load("config/nvacconfig");and it loads the configuration file, nvacconfig.
When I include the file in my JAR and try to load it using a ClassLoader, it does not seem to work, and the load method cannot find the file. This is how I am trying to accomplish this:
ClassLoader cl = this.getClass().getClassLoader();
URL url = cl.getResource("config/nvacconfig");
String file = url.toString(); //I have also tried String file = url.getFile();
id.properties.load(file);This does not work, and I'm not sure why.
Is there something I am doing wrong? Is this the wrong way to go about this?
Any advice would be greatly appreciated.
Thanks,
Dan
Message was edited by:
Djaunltry this:
import java.io.*;
import java.util.jar.*;
import java.util.zip.*;
public class ExtractFromJAR {
public void extractFileFromJAR(String dest, String fileName) {
try {
String home = getClass().getProtectionDomain().getCodeSource().getLocation().getPath().replaceAll("%20",
JarFile jar = new JarFile(home);
ZipEntry entry = jar.getEntry(fileName);
File efile = new File(dest, entry.getName());
InputStream in = new BufferedInputStream(jar.getInputStream(entry));
OutputStream out = new BufferedOutputStream(new FileOutputStream(efile));
byte[] buffer = new byte[2048];
for (;;) {
int nBytes = in.read(buffer);
if (nBytes <= 0)
break;
out.write(buffer, 0, nBytes);
out.flush();
out.close();
in.close();
} catch (Exception e) {
e.printStackTrace();
public static void main(String args[]) {
new ExtractFromJAR().extractFileFromJAR(".", "file.txt");
} -
System.properties (what is the scope in memory)
Does each JVM have it's own System properties? Hence calls from one JVM System.getProperty() or System.setProperty() should be within each individual JVM? Also I need to know this so that I can gurantee that using the System properties for private information won't be accessed by anyone else on the system... Any input?
System properties are unique for each VM, they are therefore visible to all code running in the VM.
This seems like a good thing to use for storing things like passwords because of the global visibility however using the System properties for storing such things has to be considered as being insecure.
System properties should be regarded as a place to read data from that is relevant for either the Java runtime environment or for setting component specific properties, XML Parsers make use of this for example. Using System properties as an in memory database is neither secure nor sensible. Careless selection of keys for the properties you wish to store can have unexpected results if you accidentally overwrite a property that is used for other purposes.
I would use a separate Properties instance that has nothing to do with the System properties and I would also recommend the encryption of sensitive data like passwords. -
Newbie Help with Restoring SPA504G config file
I know just enough to be dangerous, but not enough to be completely effective. Any help is much appreciated.
I have a standalone SPA504G for which I have customized the configuration. Frequently, several times a day, the phone resets and returns to the default configuration, erasing all my efforts. As a result, I have two intertwined problems:
1 -- is there a way to prevent the resets? I am tethered to RingCentral for my VOIP service, if that is relevant.
2 -- if I cannot prevent the resets, how do I restore my configuration? I have reviewed this helpful post and have downloaded the spacfg.xml file. I have also installed Solarwinds TFTP Server for use in restoring the config file. My problem is that I am completely unfamiliar with TFTP and have been unable to locate instructions as to how to upload, download and restore the spacfg.xml file. Step-by-step "TFTP for Dummies" instructions would be greatly appreciated.
Thanks for your help.
Merkitem 1,
is your phone provisioned? if Ring Central is provisioning it, they may be overwriting your changes.
you can check by going into the provisioning tab on the phone web gui.
click admin login --> advanced --> voice -->provisioning
look for profile rule. if it has anything but SPA$psn.cfg it is probably provisioned. (especially if it says something like http://provisioning.ringcentral.com )
the profile rule will download a new config file from the server every "resynch periodic" time (3600 sec by default), then if it is different from the current config it will implement and reboot.
So to prevent this, remove the profile rule or set resynch periodic to 0.
or have ringcentral put your changes into the provisioning file.
Most providers have a web 'dashboard' to make changes to the phones they manage.
2 - to reload a config using tftp
set up your tftp, put the file in the tftp root, and set the windows firewall to allow incoming connections to the app (solarwinds, tftpd32, etc), or port 69 UDP
then in the gui of the phone use the resync url to load the config to the phone.
http://ip.of.phone/admin/resync?tftp:////
Note, if your config is in the tftproot, you should not need the / part.
hope it helps,
dlm... -
How to config JMS queues for non-AQueue products? Only config files?
Assume I have the requirement NOT to use Oracles built-in Aqueue JMS provider but use another (external)product like:
Apache ActiveMQ, JBossMQ, IBM MQseries,... instead.
Can I config these JMS products through OC4Js web browser config web pages as well or am I forced in such cases to use configuration through XML config files?
How do I tell OC4J NOT to use internal JMS Aqueue queues but use other JMS product?
Peter"lilian zhu" <[email protected]> wrote:
>
Hi,
i am having a admin server running on port 7001 for servlet1 and managed
server
running on port 8001 for servlet2. how can config the httpd.conf to make
the apache
web server recongize both uri path?
i tried <IfModule mod_weblogic.c> WebLogicHost localhost WebLogicPort
7001</IfModule>
and <IfModule mod_weblogic.c> WebLogicHost localhost WebLogicPort 8001</IfModule>,
only can recongize port 8001.
i also tried WebLogicCluster localhost:7001,localhost:8001, doesn't work.
i would like to know, for my case, will the clustered server work, how
can i make
this working for non-clustered servers?
Thanks.
Lilian
Hi,
we have the same problem. We are running two non-clustered weblogic servers and
we want to configure only a failover
with the plugin.
We contacte the bea support but we haven't find a solution.
Greetings
Hans. -
Using Multiple Properties Files in Struts Framework
Hi Everybody!
I just to know how to use a multiple message-resources files in a Struts Framework.
I've 2 properties file :
1. ApplicationResources_A.properties
2. ApplicationResources_B.propertiesI put the files under WEB-INF/classes dir.
My configuration in struts-config file something like below:
<!-- Begin Testing -->
<message-resources key="A" parameter="ApplicationResources_A" />
<message-resources key="B" parameter="ApplicationResources_B" />
<!-- End Testing -->
</struts-config>
if my JSP code is like below , this error is thrown:
org.apache.jasper.JasperException: Cannot find message resources under key A
<tr>
<td width="17%">Language A</td>
<td width="83%"><bean:message bundle="A" key="user.lang.desc"/></td>
</tr>
<tr>
<td width="17%">Language B</td>
<td width="83%"><bean:message bundle="B" key="user.lang.desc"/></td>
</tr>
but if I change the JSP code like below it work fine:
<tr>
<td width="17%">Language A</td>
<td width="83%"><bean:message key="user.lang.desc"/></td>
</tr>
<tr>
<td width="17%">Language B</td>
<td width="83%"><bean:message key="user.lang.desc"/></td>
</tr>
In this code , I dont know which resources file is used.
So how do I solve this problem. Thanks you.I have defined the following:
struts-config.xml
<message-resources key="ldap" parameter="com/project/struts/ldap"/>
Action.java
In execute method:
MessageResources messageResources= MessageResources.getMessageResources("com/project/struts/ldap");
System.out.println("INITIAL_CONTEXT_FACTORY"+messageResources.getMessage("INITIAL_CONTEXT_FACTORY"));
and it is working, however I have to change "com/project/struts/ldap" value in Action.java file whenever there is any change in name or location of ldap.properties.
Can I access this properties in such way that I don't have to change parameter path manually in Action.java (modifying in struts-config.xml is okay)? like access through key="ldap" or something.
Thanks and regards, -
Unable to configure log4j using a properties file
So i have an xml log4j config file that i stole from JBOSS, so i know it has the correct syntax. i put this file into my project dir, and i do this in the main method:
System.out.println(new File("crawler.log4j.properties.xml").exists()); //prints true
PropertyConfigurator.configure("crawler.log4j.properties.xml");i have the console appender set to INFO
I am seeing DEBUG messages.
i searched my project for log4j* files and there are no other configs laying about.
what am i missing?i should have been using DOMConfigurator instead of PropertyConfigurator
Maybe you are looking for
-
How do i fix the hdmi sound on mini lion server 10.7.5
After upgrading to anythig past 10.7.3 the HDMI sound on my mini server does not woek. I need to know either how do I fix the sound or how can I roll back to 10.7.3
-
Hi can u guid me on how to run halfcycle payment
-
My display is too big, what do I do?
I reset the PRAM and booted in safe mode, but nothing works. The icons are huge. I can't seem to get the display to reset to the proper screen size. Has anyone had this issue? I was working in Photoshop and was resizing an image display (command +) a
-
How do I have to set an external HD, so that it supports trash under LR5?
I use OSX10.9.5 and LR5. It is said by LR5 that my ext HD does not support trash. How do I have to set an external HD, so that it supports trash under LR5? Thanks in advance Uwe
-
Error importing a biar file in edge 3.0
I can create the biar file, but when i go to import it i get this error message 'Failed to open the BIAR file. Reason: com.businessobjects.sdk.biar.om.internal.iw.ObjectManagerIWException:Input/Output exception occurred:'Couldn't find entry 'Business