Read Application Properties
Hi,
I have created a web module dc and an ear dc for reading the properties from "sap.application.global.properties" file using the ApplicationConfigHandlerFactory class.
When I run this web module DC, all the properties gets retrieved successfully.
Now the issue is,
I created a Web Dynpro dc and added the above web module DC as a used DC. When I try calling a method in web module dc from my web dynpro dc which reads the properties, it returns all null.
What I am trying to accomplish is, read the properties of "sap.application.global.properties" file from WD dc. I do not want to use the ConfigurationService in WD because I want to be able to modify the properties file at runtime without rebuilding the DC.
Any help is appreciated.
Thanks
MLS
This issue is still open. Anybody came across this issue?
Similar Messages
-
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 -
Reading a properties file in a servlet and passing its contents to a JSP pa
Hi all,
I'm totally new to Servlet pgmg n JSP. Please can ne1 tell how to read a simple properties file (in a servlet) and pass its contents to a JSP page.Actually the reason is to fill a combo box in a JSP page with the contents of a properties file.If calling a servlet for the same is d best way to do that, plz can ne1 tell me :
1> whether to override the doPost method in the servlet in which to read d file using FileInputStream
2> Putting the contents in an array and then how to pass this array to the JSP page.
Thanks,
deepthy.I'm using a properties file to let my web application know what the name of the database is. I'm using an abstract class GeneralDao which will be extended by all the DAO's (Data Access Objects or java classes containing SQL statements).
Here's the code :
protected Connection getDatabaseConnection()
throws Melding
Connection dbconn = null;
ResourceBundle resBundle;
try
Class.forName("com.mysql.jdbc.Driver").newInstance();
resBundle = ResourceBundle.getBundle("gcoConfig");
String dbConnectie = resBundle.getString("databaseconnection");
gcoLogger.debug("lezen databaseconnection in resourceBundle " );
dbconn = DriverManager.getConnection(dbConnectie);
} catch (InstantiationException exc)The ResourceBundle is used to read the properties file, named gcoConfig.properties.
With the getString() command I read the content of the string named databaseconnection.
The gcoConfig.properties file is placed inside the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes
The GeneralDao is placed in the folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco\WEB-INF\classes\org\gertcuppens\cluifDao.
So this class is placed some folder below the WEB-INF\classes folder of gcoConfig.properties.
And the content of the properties file is just one line :
databaseconnection=jdbc:mysql://localhost/cluif
If you want to let the JSP know what's inside the properties file, wrap the content in a Javabean, put it in the request or even the session and pass the control to the JSP. -
How to read the properties file available in Server File structure in webdy
hi all,
I have developed one webdynpro application. In this application i need to access mdm server to continue. For getting the connection i need to pass the IP addresses.
Can i have code how to read the properties file which is residing in the server file. with out included along with the application. keeping some where in the file structure in the server. I want to read that properties file by maintain the iP addresses and users in properties file based on the key i want to read like below.
servername="abcServer"
username="john"
password="test123"
Please send me the code how to read this properties file from the file structure and how to read this values by key in webdynpro application
Regards
VijayHi Vijay,
You can try this piece of code too:
Properties props = new Properties();
//try retrieve data from file
//catch exception in case properties file does not exist
try {
props.load(new FileInputStream("c:\property\Test.properties")); //File location
String serverName = props.getProperty("servername"); //Similarly, you can access the other properties
if(serverName==null)
//....do appropriate handling
} catch(IOException e)
e.printStackTrace();
Regards,
Alka. -
Error: Could not read reports properties. java.lang.NullPointerException
Hi All,
I am facing Could not read reports properties. java.lang.NullPointerException while trying to run the report using below string
String:_
/rcrmap2/weblogic/bea/ORA_PFRD/bin/rwrun module=/rcrmkr1/exe_dir/CA_PG1_T.rdf CUSTGRPID=''001139'' CANO=104 CACOPY=''F'' OPTION=''W'' CCODE=''KR'' USERID=apl_D_RCRMNIU3/Q5e3C4l1FPjrG6epG6f3C4dqFMgsDP@krcrmd DESTYPE=FILE DESNAME=/rcrmkr1/crms_RG/rep_dir/gcapg1_to_test_20110112_121902.rep BATCH=YES MODE=CHARACTER DESFORMAT=/rcrmap2/weblogic/bea/ORA_PFRD/reports/printers/wide.prt pagesize=132x80
Environment Variables :*
export ORACLE_LOCALPREFERENCE=/rcrmap2/weblogic/bea/rcrms/config/FRComponent/frcommon/tools/admin/
export WIDE_DEF=/rcrmap2/weblogic/bea/ORA_PFRD/reports/printers/hplwide.prt
export WIDE_VIW=/rcrmap2/weblogic/bea/ORA_PFRD/reports/printers/wide.prt
export REPORTS_FONT_DIRECTORY=/rcrmap2/weblogic/bea/rcrms/reports/fonts
export REPORTS_TAGLIB_URI=/WEB-INF/lib/reports_tld.jar
export REPORTS_NO_DUMMY_PRINTER=TRUE
export REPORTS_TMP=/tmp
export RW=/rcrmap2/weblogic/bea/ORA_PFRD/reports
export LD_LIBRARY_PATH=/rcrmap2/weblogic/bea/ORA_PFRD/jdk/jre/lib/ppc64:/rcrmap2/weblogic/bea/ORA_PFRD/jdk/jre/lib/ppc64/classic:/rcrmap2/weblogic/bea/ORA_PFRD/lib:/usr/dt/lib:
export LIBPATH=/rcrmap2/weblogic/bea/ORA_PFRD/lib:/usr/dt/lib:/rcrmap2/weblogic/bea/ORA_PFRD/jdk/jre/lib/ppc64:/rcrmap2/weblogic/bea/ORA_PFRD/jdk/jre/lib/ppc64/classic:/usr/lpp/cobol/lib:/oracle/oracle/11.1.0.7/lib:/oracle/oracle/11.1.0.7/lib32:/rcrmkr1/exe_dir/pvcs_12july/pco:.
export LDR_CNTRL=USERREGS@MAXDATA=0x80000000
export TK_ICON=/rcrmap2/weblogic/bea/ORA_PFRD/reports/plugins/resource
export REPORTS_DEFAULT_DISPLAY=NO
export REPORTS_CLASSPATH=/rcrmkr1/exe_dir:/rcrmap2/weblogic/bea/ORA_PFRD/reports/jlib/rwbuilder.jar:/rcrmap2/weblogic/bea/ORA_PFRD/reports/jlib/rwrun.jar:/rcrmap2/weblogic/bea/ORA_PFRD/jlib/zrclient.jar:/rcrmap2/weblogic/bea/ORA_PFRD/modules/oracle.jsp_11.1.1/ojsp.jar:/rcrmap2/weblogic/bea/ORA_PFRD/javacache/lib/cache.jar:/rcrmap2/weblogic/bea/ORA_PFRD/modules/oracle.javacache_11.1.1/cache.jar
Please help to provide your inputs
Regards,
HarishHi,
The problem was resolved by setting proper acl's to the corresponding directories (cache directory) in the application server
Regards,
Harish -
Application.Properties Loosing Content
I am using Action.Properties to set error codes and display them as part of my validation.
I am setting the Error in a Validate class using the following Syntax
errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("error.FirstField.invalid"));
I am routing control back to homepage incase of an error and printing the same using
<html:errors/>
This Works Just FIne, Until i re-build the application.
Once i re-Build, the content in application.Properties disappears. Just Gone!
Have you guys had the same problem or do i have the patent this rare finding, LOLIf you are loosing the complete application.Properties file, the reason may be that you are putting this file at wrong place. I think you are putting it in classes folder and when you re build the complete application, all the existing files are flushed by the newly genrated class files. If you are using any advanced editor like WSAD, you should put this file in a package in Java Source. So that when you rebuild the project, it will be copied as it is in the classes folder. And accordingly you need to change the path of this file into struts-config.xml.
-
(Urgent) How to read file properties with virtual path?
I have the data.properties file, and write a servlet file to read properties from this properties file. But I get a problem, that is: I CANNOT USE VIRTUAL PATH!
How can I solve?
My Application Directory is,
WEB-INF
classes
loadProperties.class
data.properties
More Question,
I can use Context in Web.xml to assign values to parameters. But its will be shown. How can I hide value with a properties file?This is not working.
I am using Tomcat 4.0.6, for my JSP application I am trying to read ini.properties file from \webapps\myapp\WEB-INF\classes\common\
directory through java bean.
System.getProperty("user.dir")
is giving <tomcat-home>\bin directory.
unless I hard code the path this way, I could couldn't read the ini file.
Properties props = new Properties();
String strIniFilePath = <webappPath> + "\\WEB-INF\\Classes\\Offenders\\Common\\";
props.load( new FileInputStream(strPropsFile)); -
Struts and Application.properties
I think this has been broached before, but if someone could restate the answer, I
would be most obliged:
It appears that WLS 6.1 SP2 does not load properties files (like the typical Struts
Application.properties) when it loads a webapp. This leads to an exception in my
Struts apps (that work fine on Tomcat 4.0.3) when it can't find any of the application
tags.
Anybody run into this?
Name it whatever you want. All that matters is the part before the .properties extension matches what you put in the struts-config.xml:
<!-- Main resource bundle, contains errors and some generic stuff. -->
<message-resources parameter="com.company.app.MainResources"
null="true"/>
<!-- Alternate resource bundle, contains some special things maybe. -->
<message-resources parameter="com.company.app.AltResources"
key="altResourceKey" null="true" />
// and have the files...
appdir/WEB-INF/classes/com/company/app/MainResources.properties
appdir/WEB-INF/classes/com/company/app/AltResources.properties
// and use them with the bean:message tag...
<bean:message key="some.main.key" />
<bean:message bundle="altResourceKey" key="some.alt.key" />The only thing that matters is that several Struts tags, like the <html:errors /> for ActionErrors will only use 1 message resource file. The html:errors tag can specify an alternate resource file, but all the error keys used for that html:errors instance must be in that same bundle. So usually I put all my error messages in the main one and if it's a large app, I put several other resource files for different areas of the app. -
Classic planning application properties
Hello,
How to view created classic planning application properties as what options had selected when creating application from Classic Application Wizard, Select, Calendar, Currencies, Plan Types, etc.
Regards.One of the ways:
Take a LCM export of planning application and have a look at ApplicationDefinition.xpad file.
Once backup is done, you can find it at: in 11.1.2.1:
Oracle\Middleware\user_projects\epmsystem1\import_export\<user>\<Dir>\resource\Configuration\Properties
Cheers...
Rahul S. -
I think this has been broached before, but if someone could restate the answer, I
would be most obliged:
It appears that WLS 6.1 SP2 does not load properties files (like the typical Struts
Application.properties) when it loads a webapp. This leads to an exception in my
Struts apps (that work fine on Tomcat 4.0.3) when it can't find any of the application
tags.
Anybody run into this?
Name it whatever you want. All that matters is the part before the .properties extension matches what you put in the struts-config.xml:
<!-- Main resource bundle, contains errors and some generic stuff. -->
<message-resources parameter="com.company.app.MainResources"
null="true"/>
<!-- Alternate resource bundle, contains some special things maybe. -->
<message-resources parameter="com.company.app.AltResources"
key="altResourceKey" null="true" />
// and have the files...
appdir/WEB-INF/classes/com/company/app/MainResources.properties
appdir/WEB-INF/classes/com/company/app/AltResources.properties
// and use them with the bean:message tag...
<bean:message key="some.main.key" />
<bean:message bundle="altResourceKey" key="some.alt.key" />The only thing that matters is that several Struts tags, like the <html:errors /> for ActionErrors will only use 1 message resource file. The html:errors tag can specify an alternate resource file, but all the error keys used for that html:errors instance must be in that same bundle. So usually I put all my error messages in the main one and if it's a large app, I put several other resource files for different areas of the app. -
Struts - Application.properties and ApplicationResources.properties
Java Guru's,
Could some one tell me the difference between Application.properties and ApplicationResources.properties and which one shd i use in my application.
Thank you in Advance ..Name it whatever you want. All that matters is the part before the .properties extension matches what you put in the struts-config.xml:
<!-- Main resource bundle, contains errors and some generic stuff. -->
<message-resources parameter="com.company.app.MainResources"
null="true"/>
<!-- Alternate resource bundle, contains some special things maybe. -->
<message-resources parameter="com.company.app.AltResources"
key="altResourceKey" null="true" />
// and have the files...
appdir/WEB-INF/classes/com/company/app/MainResources.properties
appdir/WEB-INF/classes/com/company/app/AltResources.properties
// and use them with the bean:message tag...
<bean:message key="some.main.key" />
<bean:message bundle="altResourceKey" key="some.alt.key" />The only thing that matters is that several Struts tags, like the <html:errors /> for ActionErrors will only use 1 message resource file. The html:errors tag can specify an alternate resource file, but all the error keys used for that html:errors instance must be in that same bundle. So usually I put all my error messages in the main one and if it's a large app, I put several other resource files for different areas of the app. -
Read UWL properties in WebDynpro
Hi,
I have to read a couple of parameters from the UWL in WD.
The UWL for the WD launch part is configured as follows:
[code] <ItemType name="uwl.task.webflow.TS91000001.PP1CLNT100" connector="WebFlowConnector" defaultView="DefaultView" defaultAction="launchWebDynpro" executionMode="default">
<ItemTypeCriteria systemId="PP1CLNT100" externalType="TS91000001" connector="WebFlowConnector"/>
<Actions>
<Action name="launchWebDynPro" groupAction="no" handler="SAPWebDynproLauncher" returnToDetailViewAllowed="yes" launchInNewWindow="no">
<Properties>
<Property name="WebDynproApplication" value="WebDynproFromUWLApp"/>
<Property name="WebDynproDeployableObject" value="local/WebDynproFromUWL"/>
<b><Property name="DynamicParameter" value="wi_id%3D${item.externalType}%26wi_system%3D${item.systemId}"/></b>
<Property name="System" value="XD1WDS"/>
</Properties>
<Descriptions default="launchWebDynPro"/>
</Action>
</Actions>
</ItemType>[/code]
The question is more about the dynamicParameter part.
First I added the wi_system and wi_id to the application properties in WD.
Then I used the following code:
[code] IWDWebContextAdapter adapter = WDWebContextAdapter.getWebContextAdapter();
String wi_id = adapter.getRequestParameter("wi_id");
wdContext.currentGenericApplicationElement().setWorkItem(wi_id); [/code]
I am able to retrieve the <b>wi_id</b>, but NOT the wi_system. I retrieve this parameter the same way as shown in the WD code above.
I also used the <b>requestParameterMap</b>, but that gave me information about SaptestID, sap-css-url etc.
Who can help me? Is the UWL dynamic parameter configured correctly?
SandhyaHello Sandhya,
when i add more properties of name "DynamicParameter" to the xml file
E.g.
<Property name="DynamicParameter" value="name1=value1"/>
<Property name="DynamicParameter" value="name2=value2"/>
and upload the file again, just the last one of the 2 Properties get uploaded.
The uploaded file looks like this:
<Property name="DynamicParameter" value="name2=value2"/>
seems like a property name has to unique.
How did you solve that?
cheers
Markus
p.s.: we are on NW04s SP9 -
Unable to load ITUNES onto PC HP, windows 7 Home Version. Error message reads "Application Application Support not found". "Uninstall and reload". I have done that 4 times on Explorer and Firefox without success. Help??
I had gotten a similar problem, except with "provider services", i believe, but i solved it by copying sqlite3.dll from E:\Program Files\Common Files\Apple\Apple Application Support to E:\Program Files\Common Files\Apple\Mobile Device Support. doing that solved my first problem, but now i have been getting the error described in this topic (unable to load dataclass info... etc.). i tried reinstalling itunes (i already had 9.1.1, and thats what i reinstalled) by using the method described on apples site (using the "remove programs" tool in the control panel) and then downloading and installing itunes. when i opened it again, i still got the same error, and just now i got an error saying "the instruction at "0x00aadb6b" referenced memory at "0x00000008". the memory could not be read" it gave me the option to cancel and debug, or to press ok and terminate the program. I tried pressing cancel, and the popup went away but nothing else happened. a minute later the popup was back, so i pressed ok and itunes quit. Upon opening Itunes again, i got the very same error. sorry for the long post, but its really been bugging me. thanks for any help you might give, and if you need anymore info, feel free to contact me.
-
How do I read a properties file in WEB-INF without hard-coding a path?
Hello,
How do I read a properties file in WEB-INF without hard-coding a path?
I tried:
Properties properties = new Properties();
properties.load(new FileInputStream("db.properties"));
driver = properties.getProperty("driver");
but it cannot find the db.properties file.
Thanks for the help.
FrankDon't use a File to read those properties.
Better to use the servlet context and
getResourceAsStream() method to get the InputStream.
It'll look for any file in the CLASSPATH. If you put
that properties file in the WEB-INF/classes directory
you'll have no problems, even if you deploy with a
WAR file.Completely agree with this approach. Just have to mention the following for completeness
according to the API,
"This method is different from java.lang.Class.getResourceAsStream, which uses a class loader. This method allows servlet containers to make a resource available to a servlet from any location, without using a class loader. "
So using this method, the resource can be anywhere under your web context, not just in the classpath.
Cheers,
evnafets -
Java.lang.NullPointerException in the code to read a properties file
I have written the following code to read a properties file...........
<b>
public Property(String fileName)
try
InputStream is = MyClassName.class.getClass().getClassLoader().getResourceAsStream(fileName);
prop.load(is);
is.close();
catch (Exception ex)
System.out.println("The Exception is: " + ex.getMessage());
ex.printStackTrace();
</b>
But this code is giving <b> java.lang.NullPointerException </b> at <b> prop.load(is) </b>
please help me....
regards
Brahmachaitanyahi,
If you are loading a resource (property) file from a jar file you can use
getResourceAsStream("com/test/test.properties").
if the propery file is in outside of your jar file . you can use
Property portalProps = new Property ();
try {
FileInputStream fileInputStream = new FileInputStream("<FilePath + FileName>");
portalProps.load(fileInputStream);
fileInputStream.close();
} catch (IOException e) {
//Log the error
refer the following link for more details
http://www.javaworld.com/javaworld/javaqa/2003-08/01-qa-0808-property.html
Maybe you are looking for
-
Generation BP master data in Excel
Hi My requirement is I have sold to party say XYZ and XYZ is having 2 to 4 contact persons in Relationship. In this way I have got some BP master data. Now can I get a excel report like: First Name Last Name Add1 Add2 City Phone Email id
-
Blue screen with error code and I have no recovery disks for HP Pavilion dv6-1260se
I have a HP Pavilion dv6-1260se with factory installed operating system of Vista. When booting up the computer, I receive a blue screen with this error message: STOP: c000021a {Fatal System Error}.
-
How to pass back results of gATP from APO to R/3
Dear all, we're currently working on a gATP implementation and face following open challenges for which we kindly ask you for your valuable support: 1.) We need to pass back the allocated CVC of the gATP (product allocation) check from APO to z-appen
-
I know the Web Photo Gallery has been removed from PS CS4 and put into Bridge. However, I created a few templates I would like to keep. Is there any way besides using CS3 that I might do this in Bridge? Is there going to be a way in Bridge to create
-
Shortcuts in x term (alias)
I've brought this up before but never really perfected it, i've spent a bit of time on it now and its very useful and quite easy to do. Firstly the shortcuts - 'alias' is similar to macro's in windows. Its using a letter, series of letters/numbers or