Application specific properties file
Hello
Can any body help me how to build application specific properties file
so that we can have independent application specific server with its own
java class path environment.I read the procedure in beasys manuals but i
could'nt understand clearly.
Setting application-specific properties
The weblogic.properties file is only accessible by WebLogic; that is,
you can't add application-specific properties to the weblogic.properties
file and expect that they will be read at startup time. However, you can
set properties for your own application by creating a separate
properties file. This file can be created and used in two ways:
Put your application-specific properties file in the same directory as
your weblogic.properties file. You can then use the following code to
access the properties:
Properties props = new Properties();
String propertiesName = "myapp.properties";
T3ServicesDef services =
T3Services.getT3Services();
String location =
services.config().getProperty("weblogic.system.home") +
java.io.File.separator + propertiesName;
props =
props.load(new DataInputStream(new FileInputStream(location)));
Thanks in advance
Ravi
Hi, Ravi.
I think I am "WeiG".
Basically, you can not put your own properties on weblogic.properties. Every
property in weblogic.properties managed by WLAS is pre-registered in WLAS
internally. WLAS will print "Fund undefined property ...." messages for the
un-registered property in weblogic.properties files.
To use your application-specific properties, the paragraph you read suggests
you create your own file, put it in $WL_HOME, and use the example code to
read your own file.
Hope it helps.
Cheers - Wei
Ravi <[email protected]> wrote in message
news:[email protected]...
> Hi Purdy
>
> Who is WeiG,can you tell me please
>
> Thanks
> Ravi
>
> Cameron Purdy wrote:
>
> > I know that WeiG has answered this before ... try to ask Wei directly.
> >
> > --
> >
> > Cameron Purdy
> > http://www.tangosol.com
> >
> > "Ravi" <[email protected]> wrote in message
> > news:[email protected]...
> > > Hello
> > >
> > > Can any body help me how to build application specific properties file
> > > so that we can have independent application specific server with its
own
> > > java class path environment.I read the procedure in beasys manuals but
i
> > > could'nt understand clearly.
> > >
> > > ************************
> > > Setting application-specific properties
> > > The weblogic.properties file is only accessible by WebLogic; that is,
> > > you can't add application-specific properties to the
weblogic.properties
> > > file and expect that they will be read at startup time. However, you
can
> > > set properties for your own application by creating a separate
> > > properties file. This file can be created and used in two ways:
> > >
> > > Put your application-specific properties file in the same directory as
> > > your weblogic.properties file. You can then use the following code to
> > > access the properties:
> > >
> > > Properties props = new Properties();
> > > String propertiesName = "myapp.properties";
> > >
> > > T3ServicesDef services =
> > > T3Services.getT3Services();
> > > String location =
> > > services.config().getProperty("weblogic.system.home") +
> > > java.io.File.separator + propertiesName;
> > > props =
> > > props.load(new DataInputStream(new FileInputStream(location)));
> > >
> > > ****************************
> > >
> > >
> > >
> > >
> > > Thanks in advance
> > > Ravi
> > >
>
Similar Messages
-
Location of application-specific properties files
I am using Tomcat 4.0.3 under WinXP Pro, and I am trying to get my
application to "find" an application-specific properties file. I am having problems trying to determine which directory to put this file in.
Here is the Java code I am using for this class:
import java.util.Properties;
import java.io.FileInputStream;
public class ForumProperties extends Properties {
private static final String DEFAULT_FILENAME = "/WEB-INF/classes/mystuff.properties";
private static ForumProperties globalProps;
private ForumProperties() {
private ForumProperties(String fileName) throws Exception {
this();
load(new FileInputStream(fileName));
public static ForumProperties getInstance() throws Exception {
try {
if (globalProps == null)
globalProps = new ForumProperties(DEFAULT_FILENAME);
} catch (Exception ex) {
ex.printStackTrace(System.out);
throw new Exception("Error loading properties file");
return globalProps;
}I have put the properties file in just about every directory I can think of to try and find out where it's supposed to be, but I can't get it to work. I can put the file into the "user.home" System property (which turns out to be C:\Documents and Settings\Administrator) and have it pick it up, but I would prefer to put the file into the path of the application.
I have tried four different methods to load this file:
1. load(new FileInputStream(fileName)); (same as above)
2. load(Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName));
3. load(this.getClassLoader().getResourceAsStream(fileName));
4. load(getServletContext().getResourceAsStream(fileName));
All of them fail for not finding the file except #4, but that's not the
optimal solution as it requires a servlet context, which for "genericness of code reasons", I DON'T want to do.
As an aside, I pulled the "java.class.path" from the System properties to see where it's pointing, and all it has in it is
"<CATALINA_HOME>\bin\bootstrap.jar" with no other paths included.
Is there an attribute or something in the server.xml or web.xml file I am forgetting to set, or another approach I should be taking?
BobSee if this code fragment helps.
String MAIN_FILE_PATH = "./BlueGnome/demos/Properties/DemoPropertiesFile.properties";
java.net.URL url = ClassLoader.getSystemClassLoader().getResource(MAIN_FILE_PATH);
System.out.println("PATH: resolved name = " + url);
// Get the file.
// We could just use FileInputStream here. Then we would have
// to provide a path that was meaningful to the system like
// c:\java\BlueGnome\demos\Properties\DemoPropertiesFile.properties
// Doing it this way allows us to use generic directory
// seperators and allows for it to search for the file using
// the CLASSPATH. That also allows for it to be in a jar file.
java.io.InputStream is;
is = ClassLoader.getSystemClassLoader().getResourceAsStream(MAIN_FILE_PATH);
if (is == null)
throw new Exception("Resource File "
+ MAIN_FILE_PATH + " not found.");
aProperties.load(is); -
How to create an application-specific policy file?
Hi Everybody:
I'm a .NET developer with C #. I have a few applications currently running on my computer using the ODP 10.1
Two weeks ago I installed on my computer the ODP 10.2 Release & now my previous applications have stopped working: when I try to make the connection to the database gives me this exception:
OraOLEDB (0x80004005)
ORA-12154: TNS: could not resolve the connect identifier specified
In FAQ section for ODP.NET I found the next:
Q: I have two .NET applications on the same machine running two different versions of ODP.NET. How do I ensure both these applications use the correct ODP.NET version?
A: Beginning with ODP.NET 10.1.0.3, the Oracle installer will register the following publisher policy DLLs in the Global Assembly Cache (GAC) that redirect 9.2, 10.1 and 10.2 ODP.NET applications to use the last installed version of ODP.NET: Policy.9.2.Oracle.DataAccess.dll and Policy.10.1.Oracle.DataAccess.dll.
ODP.NET 9.2 includes just the first policy DLL above. These policy files ensure that all your ODP.NET applications use the most recently installed version of ODP.NET.
You may undo the redirection manually. Policy DLLs can be de-installed through gacutil.exe using the /u option. Another approach is to navigate to the GAC directory (i.e. C:\WINNT\assembly) through the Windows Explorer and delete the policy folders. That will eliminate any policy enforcement for all your ODP.NET applications.
If you have applications on the same machine using different ODP.NET versions, you should create an application-specific policy file.
I'm trying to do that, but I don't know what is an application-specific policy file. Someone can give me an example of How can I create and application-specific policy file???
RegardsHi,
Binding redirection is a ".net thing" as opposed to a "odp.net thing", see if this helps:
http://msdn.microsoft.com/en-us/library/7wd6ex19(VS.71).aspx
Hope it helps,
Greg -
How do I use a MessageSelector with application-specific properties
According to a couple of JMS references (Sun, Oreilly) and the oracle documentation (under the heading "Using Oracle Java Messaging Service (JMS) to Access AQ", page 102 of 1082 , Application Developers Guide - Advanced Queuing, Release 2 (8.1.6))
Standard JMS Features
"Message selection based on message header fields/properties"
Is there a special syntax for using application-specific (user defined) JMS message properties as message selectors in Oracle 8.1.7?
I've tried to create a message selector based on a custom property that I set, i.e. "username != 'William'". (example from O'Reilly JMS book, pg. 44)
I always get a JMS-159: Invalid selector Selector Parse error unless the property is a JMS-Defined property. i.e., " JMSMessageID = 'ID:9789D65E215B3613E034080020B1456E' " works fine.
From the docs and the oter examples, I figure application-specific (user-defined) properties are legal.
Thans for any help in advance.Well I found an article in another forum that states in oracle 8i, message selectors are only supported on JMSCorrelationID and JMSMessageID
(9i will have/has the full JMS spec support for message selectors , or so the response to the message says)
Thanks anyway
(Aricle Is In Products > Database > Oracle Advanced Queueing
Title is JMS AQ: selector in createReceiver does not work) -
How do I use a JMS MessageSelector with application-specific properties
According to a couple of JMS references (Sun, Oreilly) and the oracle documentation (under the heading "Using Oracle Java Messaging Service (JMS) to Access AQ", page 102 of 1082 , Application Developers Guide - Advanced Queuing, Release 2 (8.1.6))
Standard JMS Features
"Message selection based on message header fields/properties"
Is there a special syntax for using application-specific (user defined) JMS message properties as message selectors in Oracle 8.1.7?
I've tried to create a message selector based on a custom property that I set, i.e. "username != 'William'". (example from O'Reilly JMS book, pg. 44)
I always get a JMS-159: Invalid selector Selector Parse error unless the property is a JMS-Defined property. i.e., " JMSMessageID = 'ID:9789D65E215B3613E034080020B1456E' " works fine.
From the docs and the oter examples, I figure application-specific (user-defined) properties are legal.
Thans for any help in advance.Well I found an article in another forum that states in oracle 8i, message selectors are only supported on JMSCorrelationID and JMSMessageID
(9i will have/has the full JMS spec support for message selectors , or so the response to the message says)
Thanks anyway
(Aricle Is In Products > Database > Oracle Advanced Queueing
Title is JMS AQ: selector in createReceiver does not work) -
Application setting - properties files, user settings - Preferences API
HI!
I have 2 rules:
1. All application settings (e.g. debug level, path to resources - icons, images, path to localization resources) I store in properties files.In other words all information that user CAN NOT change I store use a properties files.
2. All user settings (e.g. language, skin and so on) I store with Preferences API. In other words all information that user CAN change I store a use Preferences API.
Is this a good rules?a_subscriber wrote:
HI!
I have 2 rules:
1. All application settings (e.g. debug level, path to resources - icons, images, path to localization resources) I store in properties files.In other words all information that user CAN NOT change I store use a properties files.
2. All user settings (e.g. language, skin and so on) I store with Preferences API. In other words all information that user CAN change I store a use Preferences API.
Is this a good rules?Sounds good. -
Non-application specific static files not visible in shared components
Hello,
We recently upgraded to APEX 4.0.2.00.07. In the past we have uploaded a number of static files with no specific application linked to them.
Now, when I search on these files using Shared Components -> Static Files, I don't find them back.
But, if I directly query the view APEX_WORKSPACE_FILES (using the APEX schema owner), I see all the files. They have APPLICATION_ID = 0 and APPLICATION_NAME is empty.
Is this a bug? I couldn't reproduce this with newly added static files, whether I specify an application or not.
Matthias
Edited by: mhoys on Mar 1, 2011 11:40 AMOwen:
Excellent idea/perspective...I did not think of that. Each of our forms/screens has a seperate class file. Each class file has a CreateForm() routine that is called when an instance of the class is intiated behind the menu selection.
Here is a block of code In Main.vb I use to execute a menu selection:
Case "MPA"
'8/30/07 EJD - Work Order Parameters Screen
If GetFormCount(G_MPAMaint_Form_Type).ToString = "0" Then
Dim MPAForm As New MPA
BubbleEvent = False
Else
UpdateStatus("Another MPA maintenance screen is already open", SAPbouiCOM.BoStatusBarMessageType.smt_Error)
BubbleEvent = False
End If
So, I can utilize this code in the case statement where I was doing the ActivateMenu if I hear you right. Now, can you help me with how I would pass the
variables instead of making them Public Shared in the Main class? Or is it ok to expose them that way?
I Appreciate the help,
Ed -
Hi,
I have a java DC which should be able to read some application properties like
mdm.servername
mdm.repositoryname
mdm.username
I have tried using the ApplicationConfigHandler class in which I created a EAR and Web Module DC and when I run this web module dc as standalone, the properties file "sap.application.global.properties" gets loaded successfully.
But when I call this webmodule Dc's method to load properties from a Java DC , all the properties are null.
Is there any other way that I can load properties in java DC which can be modified without having to redeploy the java dc.
Thanks
MLSHi
Use [configuration services |https://help.sap.com/saphelp_nw04/helpdata/en/b8/aa343e32ff1033e10000000a114084/frameset.htm] in order to created application-specific properties that can be modified at run-time.
Good luck,
Ola -
Can I programatically read the wls properties file
I'd like to set my own application specific properties in the properties
file and then read them programmatically. Can I do this?
thanks for any help,
Edwin Marcial
http://homepage.beasys.com/denali/classdocs/javadocs/weblogic/common/ConfigServicesDef.html#getProperty(java.lang.String)
Yes, you can programmatically get this information with the help of a t3
client. I am sure there is documentation on the web on how to do this.
-- Prasad
Edwin Marcial wrote:
> I'd like to set my own application specific properties in the properties
> file and then read them programmatically. Can I do this?
>
> thanks for any help,
>
> Edwin Marcial
-
I have a main method which i am using to call a servlet located in the same Development Component. Until recently i had the servlet location hard coded and it was working without issues. Now i decided to make the location configurable. For this i created an sap.application.global.properties file in the EAR DC which contains the WAR of this DC.
The contents of the above file are as follows:
SAP application properties
SERVLET.LOCATION=http://<server-name>/ControllerServlet/servlet/com.nike.xapps.eqptsp.swem.controller.ControllerServlet
The code i am using in the main method to call this properties file and access the property is as follows:
Context ctx = new InitialContext();
ApplicationConfigHandlerFactory cfgHdlr = (ApplicationConfigHandlerFactory)ctx.lookup("ApplicationConfiguration");
Properties props = cfgHdlr.getApplicationProperties();
String servlet = props.getProperty("SERVLET.LOCATION");
contained in a try...catch block.
On dubugging i get a NoInitialContextException repeatedly in the statement where the lookup is performed.
These are all the additions i have made for reading this properties file. Does anyone know if there is anything more that needs to be done for this to work.
Thanks,
Murtaza.thank for the help mangst. i guess the IO approach is also applicable ^^; i changed my code to:
configFile.load( new FileInputStream( ".\\resources\\config.properties" ) );but i had a little trouble in debugging it since it starts the file search from the main project directory. however it works fine upon deployment. ^^; thanks again.
Edited by: xnofate on Sep 23, 2008 6:21 PM -
Properties file not deploys the path correctly
Hello,
I am deploying a Web dynpro application with properties file.
One of the properties contains a path that I am later using in my app, something like this:
PATH =
myserver
folder1
folder2
The problem is that after deployment I see this property in the config tool with one backwards slash like this:
PATH = \myserver
older1\folder2\
And I need it with
in my app.
Even after applying a custom value: "
myserver
folder1
folder2
" and clearing the cache it doesn't seem to work.
I know that in java \ states that the char afterwards is special so
realy means \ so I even tried to deploy this : PATH =
myserver
folder1
folder2
but got the same behaviour.
Any idea why is this happening?Hi,
Since you have already tried using four slashes and it didnt work.
I thot putting space in between will give different result.
For me, the four slash option shud have worked.
Ashu -
Setting Application Specific Classpaths
Good afternoon,
I am trying to figure out a way to set classpaths to application specific jar files with several other applications running on the same JVM. Is there a way to do this within the main configuration files?
Thanks,
GaryHi,
in OC4j or Oracle Application Server, orion-web.xml should be the place to look for. You can set multiple occurences of
<classpath path="<path to jar>" />
Frank -
Properties file for a servlet at netbeans
I want to make a servlet to use a properties file. The file name is passed as a initialization parameter. I�m developing with netbeans, where should I put this properties file?
And if I want to deploy this to an independent tomcat server?
Thanks in advance,It's an arbitrary decision by you where you want to put it. If it contains sensitive data, you should consider putting it outside the web root. (Note that if you do that, JAR/WAR/EAR/ZIP, etc. your application, the properties file won't be implicitly included.)
This is where the suggestion for JNDI could be useful, because as far as the app is concerned, it doesn't matter where the properties file is physically located. -
Application specific key-value pairs in jndi.properties
Hello,
Can I specify my application specific key-value pair in jndi.properties?
I tried something like this
java.naming.factory.initial=.jndi.WLInitialContextFactory
java.naming.provider.url=t3://localhost:7001
myVar=myVal
When i tried looking up "myVar" from my client program, I got an error.
The other parameters like weblogic.jndi.WLInitialContextFactory are picked up.
Anyhelp will be appreciated
VasimWe have a similar problem.
We would like to configure our PROVIDER_URL for a specific web application - not
for the entire server. Since the URL should be different in development, test
and production environments, we would prefer to just set it in the deployment
descriptor. And we have a lot of code that just uses
ctx = new InitialContext();
when looking up EJBs, queues etc.
Actually, to take the problem one step further, it should be expected that later
we will have EJB's deployed on different machines/clusters - so we will actually
need specific urls for each EJB.
Is there a good way to do this? Or will we have to custom-develop our own jndi
configuration standard using application parameters to set which JNDI provider
each EJB should be looked up with?
Alternativaely, can we "import" the JNDI trees of the app server in the JNDI tree
of the web servers?
So, how should we go about this?
Robert Patrick <[email protected]> wrote:
Vasim wrote:
Hi Robert,
You are right. But The object "myVar" which I am trying to look upis not in
the JNDI tree nor am I interesed in binding it . But my requirementis that
I have one application specific variable which I am trying to lookup and I
dont want to have a separare config file for this..and hence the question..So, put the properties you want in the jndi.properties file and load
the properties
file from your code by doing something like this:
Properties props = new Properties();
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
cl = System.getSystemClassLoader();
InputStream is = cl.getResourceAsStream("jndi.properties");
props.load(is);
Personally, I would not use this file and would create an application-specific
file
or, as Daniel suggested, define your properties as a System property
and use
System.getProperty("myVar").
btw, is jndi.properties only for those objects which are bound to jnditree?
jndi.properties is only used for creating the JNDI InitialContext. The
whole idea
of this file is that in remote client code (without the jndi.properties
file), you
need to do something like this to tell the JNDI classes how to connect
to the JNDI
provider:
Properties props = new Properties();
props.put(Context.PROVIDER_URL, "t3://myservername:7001");
props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
InitialContext ctx = new InitialContext(props);
but inside the server, you only need to do this because the server is
the provider
and already knows how to connect to itself:
InitialContext ctx = new InitialContext();
Therefore, the jndi.properties file allows you to externalize this property-setting
code that sets up the properties to be passed to the InitialContext constructor
so
that the remote client code can now look exactly like the code inside
the server.
The InitialContext constructor will look for this jndi.properties file
in your
classpath and load it to get the necessary configuration information
to determine
how to connect to the JNDI provider.
Hope this helps,
Robert -
Initializing Application Params (web.xml vs. Properties file)?
Hi Friends,
Basically a question where I do not have much experience...
I think that I have the choice of initializing web application wide parameters either with:
a) Properties file (text file as managed by the Properties framework) or,
+ Here it is easy to read, modify parameters, ...
- I dislike the deployment (manual procedure of storing the file in a particular directory...)
b) web.xml (deployment descriptor) and "context-param".
- The problem here is that it does not seems "easy" to change the deployed values in a web.xml from a java program.
+ Very easy to deploy (war, ear files)
I would like to implement a solution that is:
* Easy for the end-user to change its values
* Easy to deploy and configure
From some testing, I think that the properties file (and framework) is a better solution, but not sure...Any more expert advice?
Thanks in advance!A properties file is often used with parameters that vary depending on a particular Locale. Under these circumstances, I find it impractical to store the file in an archive because the user in a given Locale may want to use the original file as a template to create a new Locale-specific version.
Whenever I need to initialize my application with parameters that are totally under my control (e.g., when the parameters do not vary by Locale but new ones may be added or old ones removed), I often use just a plain .txt file kept inside of an archive file like a jar and access it file with something like this:
URL url=myDialog.class.getResource("Params/myParams.txt");
That's just my 2-cents.
V.V.
Maybe you are looking for
-
IPhoto video clips does not work in iMovie
I just installed Leopard and ilife '08 into my MAC. The video clips from my iPhoto library are not shown properly in iMovie. I'm only able to hear the sound of the clip but unable to watch it. when i skim through the clip, i don't see anything on the
-
I receive the message "The iTunes library cannot be saved. An unknown error occured (-50)" while watching a video podcast. Once I get this message, I usually lose my video as the podcast continues to play. iTunes usually will crash and I need to rest
-
So annoying! My imessages finally activates but when I have conversations with other imessage users, my side of the conversation is iMessage and theirs is normal message? How can I fix this?
-
=Urgent===anonymous ActionListener===
Hi, I want to realize the function like "search" in Windows Notepad. Persue-code is like the following: Press "Find" icon If(string is found) highlight the string else pop up the dialog window Dialog window is in the following: else JOptionPane canno
-
Hi , I have 2 swf files one load the other. I am looking for any method or tool that will wrap them up or shell them together to create 1 swf file. I Any suggestions ???