Issue in reading multiple time properties file
Use Case:
I have a page in which i have to show some Outage Messages on page. So I have configured outage message in properties files. This message should me rendered each time when it finds that properties file in class path or it finds the values w.r.t their keys.
So what I decide that I shall write java method and call this method on Loading the page but here what happen is that whenever that page is load each time that reader file will call , that will create memory leak .
So, anyone help me on this. What will be the best approach for that reading multiple times properties file?
I will be grateful for any help you can provide
Thanks
Hi,
have a bean at applicationScope, somewhat like this
import java.util.HashMap;
public class ApplnProperties {
private HashMap _propMap;
public HashMap getPropMap() {
if(_propMap == null){
//read the properties file and populate _propMap
return _propMap;
}here we put condition _propMap == null so it would be called only once during application lifecycle.
and on page you can refer the prop map like following
#{beanName.propMap['KEY1']}Regards,
Similar Messages
-
Message Driven Bean reading multiple times from a jms queue
Hi,
I am facing a strange problem with my message driven bean. Its configured to read message from a jms queue. But sometimes it read the same message multiple times from the jms queue.
We are using weblogic server 8.1 sp5.
Please find below our descriptor files
ejb-jar.xml
<ejb-jar>
<display-name>ClarifyCRM_Process_Manager_13.1</display-name>
<enterprise-beans>
<session>
<display-name>ProcessManager</display-name>
<ejb-name>ProcessManager</ejb-name>
<home>com.clarify.procmgr.ejb.ProcessManagerHome</home>
<remote>com.clarify.procmgr.ejb.ProcessManagerRemote</remote>
<ejb-class>com.clarify.procmgr.ejb.ProcessManagerEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<message-driven>
<display-name>ProcessManagerListener</display-name>
<ejb-name>ProcessManagerListener</ejb-name>
<ejb-class>com.clarify.procmgr.ejb.ProcessManagerMDB</ejb-class>
<transaction-type>Bean</transaction-type>
<acknowledge-mode>Auto-acknowledge</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>ProcessManager</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
weblogic-ejb-jar.xml
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>ProcessManager</ejb-name>
<stateless-session-descriptor>
<pool>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
<initial-beans-in-free-pool>10</initial-beans-in-free-pool>
</pool>
</stateless-session-descriptor>
<enable-call-by-reference>False</enable-call-by-reference>
<jndi-name>ProcessManagerHome</jndi-name>
<dispatch-policy>PMExecuteQueue</dispatch-policy>
<remote-client-timeout>0</remote-client-timeout>
</weblogic-enterprise-bean>
<weblogic-enterprise-bean>
<ejb-name>ProcessManagerListener</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
<initial-beans-in-free-pool>10</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>clarify.procmgr.jms.queue.Execution</destination-jndi-name>
<connection-factory-jndi-name>clarify.procmgr.jms.factories.ExecConnection</connection-factory-jndi-name>
</message-driven-descriptor>
<enable-call-by-reference>True</enable-call-by-reference>
<dispatch-policy>PMListenerExecuteQueue</dispatch-policy>
<remote-client-timeout>0</remote-client-timeout>
</weblogic-enterprise-bean>
</weblogic-ejb-jar> The MDB is sometimes reading multiple times from clarify.procmgr.jms.queue.Execution
Also i would like to add here that the connection factory we are using clarify.procmgr.jms.factories.ExecConnection is having the following properties
ServerAffinity Enabled=true
XA connection factory enabled=false.
Please help me out here!!Maybe, your MDB "sometimes" throws an Exception in onMessage.
Check if this happens when you set <max-beans-in-free-pool>1</max-beans-in-free-pool>. -
HT202450 If the issue is reported multiple times, is it still covered?
If the issue is reported multiple times, is it still covered?
Security Software and Related Troubles
http://support.apple.com/kb/TS3125 Basic Troubleshooting
http://support.apple.com/kb/TS3297 Advance Troubleshooting
http://support.apple.com/kb/ts1629 Ports List
Basics
Check correct date, time, and timezone.
Log in as administrative user account
Verifiy iTunes updated
Update Operating System “OS” (Ms Windows, Mac OSX)
Update Modem / Router firmware
Update security software (Antivirus, Firewall)
Remove Outdated Security Software (Always restart afterwards)
Advanced
Remove Mobile Software not used anymore
(Motorola, Android, Nokia, Sony, Blackberry)
Add Apple programs to firewall permissions
Allow Ports 80, 443, 3689, 5297, 5298, 5353, 8000-8999, and 42000-42999
Permit Domains - apple.com , edgesuite.net , mzstatic.com
Disable Security Software
Remove Security Software (restart!)
Delete “Hosts” file and restart, or edit and save.
Check Browser Settings: Use SSL3, TLS1, Auto Detect, No Proxy Settings
Reinstall itunes FOLLOWING ARTICLE while all security off / disabled or completely removed.
http://support.apple.com/kb/HT1923
http://support.apple.com/kb/HT1925 -
i am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g
hi TimoHahn,
i am getting following exception in JDeveloper(11g release 2) Studio Edition Version 11.1.2.4.0 but it works perfectly fine in JDeveloper 10.1.2.1.0
Root cause of ServletException.
java.lang.NullPointerException
at java.util.PropertyResourceBundle.handleGetObject(PropertyResourceBundle.java:136)
at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
at java.util.ResourceBundle.getString(ResourceBundle.java:334)
at org.rbi.cefa.master.actionclass.UserAction.execute(UserAction.java:163)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178) -
How to read from a .properties file...?
Hello all,
I'm new to this forum.
I have a problem in reading data from .properties file...
Follow is my properties file...
log4j.properties
log4j.rootLogger=warn, file, mail
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.maxFileSize=100KB
log4j.appender.file.maxBackupIndex=5
log4j.appender.file.File=D:\log.txt
log4j.appender.file.threshold=info
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
#email appender
log4j.appender.mail=org.apache.log4j.net.SMTPAppender
#defines how othen emails are send
log4j.appender.mail.BufferSize=1
log4j.appender.mail.SMTPHost="smtp.Honeywell.com"
log4j.appender.mail.From=[email protected]
log4j.appender.mail.To=[email protected]
log4j.appender.mail.Subject=Log ...
log4j.appender.mail.threshold=error
log4j.appender.mail.layout=org.apache.log4j.PatternLayout
log4j.appender.mail.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
I want to access file path given in .properties file..
I'm coding like this...
Properties props = new Properties();
String p=props.getProperty("file.FILE");
The above code is not getting me the string.. it shows null value...
Any solution...?
Thanks in advance......RahulSharna wrote:
public Properties getProperties(String fileName)throws Exception{
Properties prop = null;
FileInputStream fis = null;
Exception e = null;
File file = new File(fileName);
if(!file.exists())
new FileNotFoundException(fileName);
try{
prop = new Properties();
fis = new FileInputStream(file);
prop.load(fis);
}catch(Exception exp){
e = exp;
}finally{
if(fis != null){try{fis.close();}catch(Exception ep){}}
fis = null;
file = null;
if(e != null)
throw e;
return prop;
}Hope the above snippet helps :)
REGARDS,
RaHuLYou do know that you can throw out of the catch block without "short-circuiting" the finally block, right? Making the declaration of e completely foolish. (Unless you actually want to do something after the try/catch block, of course.) And, if all you're going to do is throw the exception anyway, why bother catching it? -
JApplet and Read a serverside .properties file
hi,
can anyone me help with my problem;
i have a japplet and cannot read a serverside .properties file; in the applet i use the code:
in = FileInputStream(getCodeBase() + "xxx.properties");
this throws an AccesControl Exception, please HELP!!!
thanks,
smatApplet to server comm isn't easy, it never was, it was never meant to be, applets were not designed for this and that's the way it is. There are workarounds - many of them, none are easy to implement, however, one of the best ones is;-
rewrite it (JSP/servlets) -
Hi i am trying to write a program which reads from a properties file the pr
hi,
this is ayesha.
I am trying to write a program wherein i will be reading the value of a property from a properties file which will be true initially. I want to loop in there till the time when the value of the property is false.
The code is as follows:
public static void main(String[] args) {
ReadingAPropertiesFile propers=new ReadingAPropertiesFile();
propers.ReadingFileRegularly("F:\\ayesha.properties");
public String ReadingFileRegularly(String FilePath){
Properties props = new Properties();
String message;
String filePath=FilePath;
try {
props.load(new FileInputStream(filePath));
message = props.getProperty("ayesha");
boolean theValue = Boolean.parseBoolean(message);
while(theValue){
System.out.println("trueeeeeeeeeeeeeeeeeeeeeee");
Thread.sleep(60000);
ReadingFileRegularly(filePath);
catch(Exception ex){
ex.printStackTrace();
String messagean="something";
return messagean;
The contents of ayesha.properties are :
ayesha=true
After 5 minutes it will be set to false so i want to loop in there till the value of ayesha=false at which time i will return
But i dont know how to loop in there for that time:
while(theValue) ?????????????/ what after this???????????
Any suggestons are awaited.ayeshaparween wrote:
hi,
this is ayesha.
I am trying to write a program wherein i will be reading the value of a property from a properties file which will be true initially. I want to loop in there till the time when the value of the property is false.
The code is as follows:
public static void main(String[] args) {
ReadingAPropertiesFile propers=new ReadingAPropertiesFile();
propers.ReadingFileRegularly("F:\\ayesha.properties");
public String ReadingFileRegularly(String FilePath){
Properties props = new Properties();
String message;
String filePath=FilePath;
try {
props.load(new FileInputStream(filePath));
message = props.getProperty("ayesha");
boolean theValue = Boolean.parseBoolean(message);
while(theValue){
System.out.println("trueeeeeeeeeeeeeeeeeeeeeee");
Thread.sleep(60000);
ReadingFileRegularly(filePath);//recursive call this is a bad idea might result in stack overflow error
catch(Exception ex){
ex.printStackTrace();
String messagean="something";
return messagean;
The contents of ayesha.properties are :
ayesha=true
After 5 minutes it will be set to false so i want to loop in there till the value of ayesha=false at which time i will return
But i dont know how to loop in there for that time:
while(theValue) ?????????????/ what after this???????????
Any suggestons are awaited.I think you better rethink your design , do not use recursion, I would normally use a loop like you did but without loading the content of the file each time, I would use File.l lastModified() method and compare with previous results from this method to see if the file was modified. Then if it was modified then load the new File and check if the property value has changed. -
How to read sql from properties file in database control
Hey Guys,
I want to know that how a properties file can be used in bea built-in database control to read SQL.
Any help would be greatly appreciated.
Thanks,
Deepak Kumar
Qwest, Indiahi
ok i tried it like its written in the tutorial...i do it like this:
ClassLoader cl = ResourceAnchor.class.getClassLoader();
props.load( cl.getResourceAsStream(pathname));
-> tha pathname is dvd.properties
and there always appears a NullPointerException: error reading properties file: java.lang.NullPointerException
-angela -
How can i read comments from properties file in the right order??
Hello
I want to build a console that read a properties file and print to the screen the property name, property value and property description and the developer can change the name or the value or the description of the property and update the property file.
But the problem in using the properties class that it doesn�t read the comment and not save the properties in their order so I can�t couple description and name of the property.
Does any one know any utility that do the job or know how to solve the reading the comments problem???
Thank you a lot?sorry but i dont understand how the solution of using
a dot ( property_key.description ) helping me to
solve the problem?
please try to explain it agin.
thank youYou wrote:
"I want to build a console that read a properties file and print to the screen the property name, property value and property description and the developer can change the name or the value or the description of the property and update the property file."
So i'm as developer imagine that somebody edit properties in GUI or console. So you have 3 text fields: property name, property value, and propety description. Then developer save edit changes, then text fields maped to properties file and:
text field "property name" and text field "property value" construct property:
name=valuetext field "property name" adding ".description" and text field "property description" construct property:
name.description=descriptionFor one described property, you will have put two properties.
Thanks! -
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
-
Multiple weblogic.properties files?
Hi all,
We're in the stage now where I need to "quickly" switch between different
versions of our app running on WLS 5.1.
Can I pass the path to the weblogic.properties file to the java command in
startWebLogic, or is it based solely on the weblogic.home property?
If it is based on the weblogic.home property, what else depends on that
property. Ideally, I'd like to not to have to duplicate the weblogic tree.
Thanx!
Will Hartung
([email protected])You can specify server name in the command line (startWebLogic.cmd foo)
and add -Dweblogic.server.name=%1 to the list of java arguments. When
weblogic starts it will read wl_home/weblogic.properties first and
wl_home/foo/weblogic.properties second.
(with clustering enabled it reads weblogic.properties from wl_home
first, wl_home/cluster_name second and wl_home/cluster_name/server_name
third).
Will Hartung <[email protected]> wrote:
Hi all,
We're in the stage now where I need to "quickly" switch between different
versions of our app running on WLS 5.1.
Can I pass the path to the weblogic.properties file to the java command in
startWebLogic, or is it based solely on the weblogic.home property?
If it is based on the weblogic.home property, what else depends on that
property. Ideally, I'd like to not to have to duplicate the weblogic tree.
Thanx!
Will Hartung
([email protected])
Dimitri -
Reading values from properties file
Hi All,
I am in need of a help from you all.I have a login.jsp which gets username and password as user input and checks in the servlet that if it was admin and admin it will take to index.jsp and if it was other than admin and other users it should take to index1.jsp.For now i am using an if condition to check the values and to dispatch the request.I need to use a properties file for this and need to check by getting the values from the properties file.And also it should check for each entry in properties file and if it finds any matches it should take to the corresponding page.
Please help me in achieving this.
Thanks,
laxmiHi All,
I am in need of a help from you all.I have a login.jsp which gets username and password as user input and checks in the servlet that if it was admin and admin it will take to index.jsp and if it was other than admin and other users it should take to index1.jsp.For now i am using an if condition to check the values and to dispatch the request.I need to use a properties file for this and need to check by getting the values from the properties file.And also it should check for each entry in properties file and if it finds any matches it should take to the corresponding page.
Please help me in achieving this.
Thanks,
laxmi -
Reading multiple records in file adaptor
Hi,
I am trying to read records from one file and write them in another file.
But the thing happened is it ready and write only first record.
I check in the Audit... At receive it reads all three records, but in transform it takes only first record.
I have defined schema in inbound adaptor and used same for outbound.
Where should I make changes to read all the records from the input file.
Thanks,
KrunalI assume you are using a transform to do the mapping.
The trick here is to use the for-each function on the target mapping when the element repeats.
In the transformation design window right-click on the repeating element, choose the option for-each. This will create a new node just above. Map the source repeating node to the for each element.
Deploy and retest.
cheers
James -
Reading Multiple lines using File Adapter in PI 7.1
Hi Friends,
We are using PI 7.1 Service pack 4, scenario is File to IDOC .
I am using Sender File Adapter with File content conversion for fixed lengths to read file from FTP XI-SAP.
File Format :
EDI_DC40 , A, B, C, D, E
E1WPU01, F, G,H, I
E1WPU02 , J,K,L
E1WPU02 , J,K,L
I have maintained Fcc parameters . I am able to read files for mulitple rows when manually set the count in recorset structure
like :
Recordset Structure : EDI_DC40,1, E1WPU01,1, E1WPU02,2...
Problem is when I set * in Recorset Structure : EDI_DC40,1, E1WPU01,,E1WPU02,
Nothing is coming .
Could anyone help me how to resolve this issue.
Regards,
VijayHi Vijay,
As u mentioned in earlier post...
keyfieldName = TABNAM
EDI_DC40.fieldNames :
EDI_DC40. fieldFixedLengths:
EDI_DC40.keyFieldValue :
E1WPU01.fieldNames :
E1WPU01.fieldFixedLengths:
E1WPU01.keyFieldValue
E1WPU02.fieldNames :
E1WPU02.fieldFixedLengths:
E1WPU02.keyFieldValue
Here actually you are trying to get the key field value even from EDI_DC40 and E1WPU01 also....
So obviously u dnt have those values in that rows so.. it cannot get the rows....
So please u try this one..... The same FCC but remove the 2 lines.... for EDI_DC40 and E1WPU01
keyfieldName = TABNAM
EDI_DC40.fieldNames :
EDI_DC40. fieldFixedLengths:
E1WPU01.fieldNames :
E1WPU01.fieldFixedLengths:
E1WPU02.fieldNames :
E1WPU02.fieldFixedLengths:
E1WPU02.keyFieldValue
I hope this wil solve ur problem..
Lemme know if any issues...
Thanks & Regards,
H.L.Babu -
How to read Multiple sheet Excel file( One of the sheet generated by rule )
Hi Folks,
I have one critical requirement about reading an Excelsheet.
I have an Excelsheet, which has got 2 tabs. Now TAB1 is having the data stored and TAB2 has got data, which is created by some Rule using in Excelsheet.
Now when i am trying to pass this Excel sheet to Function module ' TEXT_CONVERT_XLS_TO_SAP' this Fucntion Module is returning the data from TAB1. But my requirement is that, i have to read data from TAB2, which is generated by implementing some rule on TAB1.
So Please help, me how can i read the multiple sheet Excel document and how to read the tab , which is generated by some rule.
Thanks.
PGHi Guru,
Thanks for your reply.
I have seen this blog, and treid to implement the code. But when i am caaling method GET_RANGES_DATA
in the program, it's hanging my whole program and followed by hanging my SAP login.
I have no clue, why my program is getting hung up, bcoz of this call.
After debugging this method, i found that the program is getting hung up at call of one function module DP_GET_TABLE.
This Function Module is internally called by above menthioned method.
So please let me know, if you have some input on above issue, or if you know some other way to implement this problem.
Regards
PG
Maybe you are looking for
-
does anyone know the cost of an airport card for a powerbook g4? got my logic board replaced and airport card hasn't been installed onto it?
-
ITunes 10 starting conhost.exe and it won't die
I updated to the latest version of iTunes about 3 weeks ago (haven't run it in over a week, due to this problem). Immediately after installing, I began seeing conhost.exe start multiple times. It took me a week to figure out which installed software
-
Connecting Envy 5660 to AT&T wireless network
Can the Envy 5660e be connected to an AT&T wireless router?
-
My BB Torch 9860 freezes while it reboots and refuses to turn on
My BB torch 9860 froze 4 days back while a normal hard reboot. it refuses to turn on freezes and a particular spot on the bar while rebooting. i cant update the software or do nothing as it requires the fone to turn and it refuses to do so. Please he
-
I recently bought a MacBook Pro with OSX.7.5. I am trying to download my subsequent purchase of Finale 2014, which is a 1.7gb file. Where can I see the progress of the download, and watch it? I need to make sure it is completely downloaded before