Common strategy to read a config file???
Hi..
I'm a new java programer, in reality i program SERVLETs, JSP ,etc,ec (WEB).
I need a program to do a realy specific work, this program work fine, but now i need read
a config file , my question is if exists strategy's about this problem in JAVA;
I need comments about this, "strategy" or "ideas" to work in this case!!!
thank's to all ..
thank's to all.
Simple solution:
public static String config(String propertie){
Properties props = new Properties();
try{
props.load(new FileInputStream(new File("config.cfg")));
} catch ( IOException e){
e.printStackTrace();
return props.getProperty(propertie);
}
Similar Messages
-
Strategy to read a property file
Hi all
I'd like to know what could a good strategy with property files,where should I
put them? Is it a good idea to put it in the war file? If so then how to read
it from a jsp ?
Thanks a lot
Francesco
Or you can put them in your /WEB-INF/classes directory and read them
this.getClass().getResourceAsStream("/yourp.properties");
Note that you need to put the / before the name (refer to the
java.lang.Class documentation)
Or if you have an ear application do:
put your properties files in directory that you place in the ear file:
/propertiesDir/myprop.properties
in the manifest file of your war put a Class-Path = propertiesDir
entry
again do:
this.getClass().getResourceAsStream("/myprop.properties");
Simone
Dimitri Rakitine <[email protected]> wrote in message news:<[email protected]>...
> You can put it in a war (say, in /WEB-INF/) and use
> application.getResourceAsStream("/WEB-INF/your.properties")
> to read it
>
> Francesco <[email protected]> wrote:
>
> > Hi all
> > I'd like to know what could a good strategy with property files,where should I
> > put them? Is it a good idea to put it in the war file? If so then how to read
> > it from a jsp ?
> > Thanks a lot
> > Francesco
-
How to read a config file in xMII
Hi ,
In my scenario, I want to load a configuration file which contains all my configuration realated details -- location of file path which i have to load in my transaction for further usage.
This can be achieved using global variable concept of BLS but my requiremnet is like this then how can i proceede.
Thanks
Supriya.Supriya,
Lets Say your xml is
<ABC>
<config>value1</config>
<config>value2</config>
</ABC>
and you need to change the value of config node to "newValue" from "value1",
Then load the xml file and assign that to some Local xml property say outPutXML.
create another local property with only the xpath , in this case it will be
"/ABC/config/"
Now, use the magic of Dynamic Link editor, i.e
outPutXML.{#xPath#} to change the value
Hope this helps
Rupesh Bajaj
Reward if solved the problem -
Reading a config file from servlet
I am having an issue where my servlet on init() is trying to read a file from the filesystem in order to override the log4j configuration for the application.
Code in servlet:
ServletContext context = getServletContext();
String logInitFile =
context.getInitParameter("log-init-file");
if (logInitFile != null) {
File file = new File(context.getRealPath(logInitFile));
if (file.exists()) {
logInitFile = context.getRealPath(logInitFile);
LogManager.getLogManager().readConfiguration(logInitFile);
ServletLogAppender.setServletContext(context);
logger = LogManager.getLogManager().getLogger(CLASS_NAME);
logger.debug("Log file was loaded from \"" + logInitFile + "\"");
END CODE
My orion-web.xml has an entry pointing to
<context-param-mapping name="log-init-file">C:\jDev9052\j2ee\home\application-deployments\speed\log4j.xml</context-param-mapping>
The error I am getting is a NullPointerException on the
File file = new File(context.getRealPath(logInitFile));
line.
The point of this is to override the log4j.xml file that is packaged in the /classes folder of the .ear file with one specific to its deployment target (i.e. production, test, etc).
This worked in 9.0.2 but now that I am upgrading to 9.0.5.2 it is not working.
Is this possible to do anymore? Could someone assist.I just had -and solved- the same problem. The cause was that you tried to use getServletContext().getRealPath() to resolve the file name. That only works if the file is located some place where your Web container could serve it up as a file; i.e. getRealPath() translates a path from a Web URL into a file path.
If you have your file in the Jar, chances are it's not even accessible as a file. I used getClass().getClassLoader().getResource() to give me a URL, and used that as an argument to log4j methods. -
[SOLVED] Pacman "config file could not be read" error during Arch ins
I've been attempting to get Arch setup for a while now, and after having some trouble with partitions, my wireless connecting, and setting up repos and mirrors, which the Wiki helped me solve, I've hit a bigger bump. While updating the system using pacman as the Beginners Guide says to do, I get errors when I try to continue the update process as follows :
btw: I'm typing this on a laptop next to my computer
[root@McArch~]# pacman -Syu
error: config file /etc/pacman.d/core could not be read
error: config file /etc/pacman.d/extra could not be read
error: config file /etc/pacman.d/community could not be read
:: Synchronizing package databases . . .
error: failed to updated core (unexpected error)
error: failed to updated extra (unexpected error)
error: failed to updated community (unexpected error)
error: failed to synchronize any databases
Any tips as to whats going on? I've tried to created said files, and even insert mirrors into the file, like in the /etc/pacman.d/mirrorlist file but this doesn't seem to help
Last edited by Windfinder (2008-09-29 20:43:29)Glad you got it working.
I'm not sure what happened in your install but I just finished using an old 2007.08 iso and pacman first starts out with /etc/pacman.d/core, etc/pacman.d/extra, /etc/pacman.d/community ... etc., but I never had your problem when I did the #pacman -Syu after initial install reboot. The pacman update removes the above mentioned repos and replaces them with a single /etc/pacman.d/mirrorlist. You must have messed up an initial config file somehow as I couldn't get the same errors you got. It looks like you had your /etc/pacman.conf file messed up somehow and when you pointed it to the mirrorlist it could finally work properly. I'll just include my /etc/pacman.conf file and /etc/pacman.d/mirrorlist so you can compare. NB* these are from my x86_64 so for 32 bit machines i686 would replace x86_64 in the files.
# /etc/pacman.conf
# See the pacman.conf(5) manpage for option and repository directives
# GENERAL OPTIONS
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
HoldPkg = pacman glibc
# If upgrades are available for these packages they will be asked for first
SyncFirst = pacman
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#XferCommand = /usr/bin/curl %u > %o
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options (all disabled by default)
#NoPassiveFtp
#UseSyslog
#ShowSize
#UseDelta
#TotalDownload
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
# Testing is disabled by default. To enable, uncomment the following
# two lines. You can add preferred servers immediately after the header,
# and they will be used before the default mirrors.
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
# Add your preferred servers here, they will be used first
Include = /etc/pacman.d/mirrorlist
[extra]
# Add your preferred servers here, they will be used first
Include = /etc/pacman.d/mirrorlist
[community]
# Add your preferred servers here, they will be used first
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#Server = file:///home/custompkgs
/etc/pacman.d/mirrorlist
# Arch Linux repository mirrorlist
# North America
# - United States
Server = http://mirror.neotuli.net/arch/$repo/os/x86_64
Server = http://holmes.umflint.edu/archlinux/$repo/os/x86_64
Server = http://archlinux.unixheads.org/$repo/os/x86_64
Server = ftp://ftp.archlinux.org/$repo/os/x86_64
Server = ftp://locke.suu.edu/linux/dist/archlinux/$repo/os/x86_64
Server = ftp://ftp.gtlib.gatech.edu/pub/linux/distributions/archlinux/$repo/os/x86_64
Server = ftp://mirror.cs.vt.edu/pub/ArchLinux/$repo/os/x86_64
Server = http://mirrors.easynews.com/linux/archlinux/$repo/os/x86_64
Server = ftp://ftp.ibiblio.org/pub/linux/distributions/archlinux/$repo/os/x86_64
Server = http://mirror.rit.edu/archlinux/$repo/os/x86_64
Server = http://mirror.umoss.org/archlinux/$repo/os/x86_64
# - Canada
Server = ftp://mirror.csclub.uwaterloo.ca/archlinux/$repo/os/@carch
Well it was an interesting way to kill 30+ minutes. -
Airport Express - cannot read config file - cannot Hard reset
Anyone, please help!
I have an Airport Express as an 'add to an existing network' connected to the UFO Base Station (White). The internet connection is fine, but I cannot read the config file to access the wireless printer part. I have tried to reset the express - it resets it goes green still no read. I have tried to hard reset this back to the factory settings. Same thing, it thinks about it then everything is back green, same as before and I still cannot read the config. I will add that I have had to reset or hard reset or mess with this once a week since I got this. Is there anything else I can try. I have nothing connected to the express everything is wireless. Please I do know how to do a hard reset, its just not accepting the command.
Anyone, please....Are you sure it's not alternating amber/green? I have seen it, it's hard to tell, if you are color blind
, it's even harder.
http://docs.info.apple.com/article.html?artnum=108045 -
"Unable to open config file" Error when starting tomcat
hi all,
Here is the output from two of the log files when I start tomcat4 on my linux box. I have configured the mod_jk on the tomcat side.
From the output of the second log file, it seems that the ajp13 worker I defined was started successfully. What I don't understand is the following:
1) In catalina.out, where des the line 'Unable to open config file' come from? Which config file?
2) Tomcat4 is supposed to generate a mod_jk.conf automatically, but I don't see any file generated in 'conf/auto/'.
Content of 'catalina.out'
Unable to open config file
Starting service Tomcat-Standalone
Apache Tomcat/4.0.4
Unable to open config file
Starting service Tomcat-Apache
Apache Tomcat/4.0.4content of 'catalina_log.2002-08-16.txt'
2002-08-16 01:05:22 HttpConnector Opening server socket on all host IP addresses
2002-08-16 01:05:28 Ajp13Connector[8009] Opening server socket on all host IP addresses
2002-08-16 01:05:28 Ajp13Connector[8009] Starting background thread
2002-08-16 01:05:29 Ajp13Processor[8009][0] Starting background thread
2002-08-16 01:05:29 Ajp13Processor[8009][1] Starting background thread
2002-08-16 01:05:29 Ajp13Processor[8009][2] Starting background thread
2002-08-16 01:05:29 Ajp13Processor[8009][3] Starting background thread
2002-08-16 01:05:29 Ajp13Processor[8009][4] Starting background threadI have all those files too.
I think the 'config file' mentioned in the error log is the mod_jk.conf.
On Jason Hunter's tomcat4 guide, it says don't use the tomcat4 RPM to installed. What is the difference bettween the RPM version and the tar.gz version? The only difference I can think of is that in the RPM version, the conf directory is in the 'etc/tomcat4/conf'. Could it be the reason that tomcat4 cannot read the config file? But it has no problem reading the server.xml though. -
hello,
my scenario
EJB application, with JCA and JAAS.
My problem is, that I'm not able to read the config file. where i have to copy the .conf file that my application find that file.
System.setProperty("java.security.auth.login.config", "demo.conf");
kind regards
JohannesHello!
I've done the following tasks:
Searched for jazn-data.xml file of OC4J-installation.
Added information of jaas.conf-file to a new entry of application.
e.g.
TestJaas { com.sun.security.auth.module.Krb5LoginModule required debug=false useTicketCache=false; };
<application>
<name>TestJaas</name>
<login-modules>
<login-module>
<class>com.sun.security.auth.module.Krb5LoginModule</class>
<control-flag>required</control-flag>
<options>
<option>
<name>debug</name>
<value>false</value>
<name>useTicketCache</name>
<value>false</value>
</option>
</options>
</login-module>
</login-modules>
</application>
It should work.
regards
Harald. -
I am about to had enough of this moronic container call OC4J that's compatible to to itself.
I did a
1. clean unzip and installation.
2. setup admin account.
3. config the autodeploy in server.xml (Who in their right phreakin mind design a container with no hot deploy nowaday).
4. configure the data source.
5. test data source using a webapp with one page jsp do a JSF jdbc connection.
When try and deploy the error-free webapp (tested in tomcat) using both frontend and autodeploy,a cryptic error occur: could not read mime.types.
I have never see this error before in my life. its in oracle.oc4j.admin.internal.ApplicationDeployer.addApplication
This error happened after I configure my webapp to do phreakin orion-application.xml disable toplink, orion-webapp xml prefer local class file. If I don't get this resolve within couple days, I'll put my career on the line with full force and request we do not use OC4J anywhere in this group.
A M$FT .NET project looks very promising and efficient compare this deployment hell they call OC4J
2007-06-20 13:22:50.500 NOTIFICATION Application Deployer for norm STARTS.
2007-06-20 13:22:50.546 NOTIFICATION Copy the archive to C:\oc4j101320_SA\j2ee\home\applications\norm.ear
2007-06-20 13:22:50.890 NOTIFICATION Initialize C:\oc4j101320_SA\j2ee\home\applications\norm.ear begins...
2007-06-20 13:22:50.890 NOTIFICATION Auto-unpacking C:\oc4j101320_SA\j2ee\home\applications\norm.ear...
2007-06-20 13:22:50.890 NOTIFICATION Unpacking norm.ear
2007-06-20 13:22:50.890 NOTIFICATION Unjar C:\oc4j101320_SA\j2ee\home\applications\norm.ear in C:\oc4j101320_SA\j2ee\home\applications\norm
2007-06-20 13:22:53.625 NOTIFICATION Done unpacking norm.ear
2007-06-20 13:22:53.625 NOTIFICATION Finished auto-unpacking C:\oc4j101320_SA\j2ee\home\applications\norm.ear
2007-06-20 13:22:53.640 NOTIFICATION Auto-unpacking C:\oc4j101320_SA\j2ee\home\applications\norm\norm.war...
2007-06-20 13:22:53.640 NOTIFICATION Unpacking norm.war
2007-06-20 13:22:53.640 NOTIFICATION Unjar C:\oc4j101320_SA\j2ee\home\applications\norm\norm.war in C:\oc4j101320_SA\j2ee\home\applications\norm\norm
2007-06-20 13:22:59.828 NOTIFICATION Done unpacking norm.war
2007-06-20 13:22:59.828 NOTIFICATION Finished auto-unpacking C:\oc4j101320_SA\j2ee\home\applications\norm\norm.war
2007-06-20 13:22:59.906 NOTIFICATION Initialize C:\oc4j101320_SA\j2ee\home\applications\norm.ear ends...
2007-06-20 13:22:59.906 NOTIFICATION Starting application : norm
2007-06-20 13:22:59.906 NOTIFICATION Initializing ClassLoader(s)
2007-06-20 13:22:59.906 NOTIFICATION Initializing EJB container
2007-06-20 13:22:59.906 NOTIFICATION Loading connector(s)
2007-06-20 13:23:00.062 NOTIFICATION Starting up resource adapters
2007-06-20 13:23:00.078 NOTIFICATION Initializing EJB sessions
2007-06-20 13:23:00.078 NOTIFICATION Committing ClassLoader(s)
2007-06-20 13:23:00.078 NOTIFICATION Initialize norm begins...
2007-06-20 13:23:00.187 NOTIFICATION application : norm is in failed state
07/06/20 13:23:00 WARNING: Application.setConfig Application: norm is in failed state as initialization failed.
java.lang.InstantiationException: Error loading web-app 'norm' at C:\oc4j101320_SA\j2ee\home\applications\norm\norm: Could not read mime-mappings config file: ./mime.types
07/06/20 13:23:00 oracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
07/06/20 13:23:00 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:515)
07/06/20 13:23:00 at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:196)
07/06/20 13:23:00 at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
07/06/20 13:23:00 at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
07/06/20 13:23:00 at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
07/06/20 13:23:00 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
07/06/20 13:23:00 at java.lang.Thread.run(Thread.java:595)
07/06/20 13:23:00 Caused by: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
07/06/20 13:23:00 at com.evermind.server.Application.setConfig(Application.java:497)
07/06/20 13:23:00 at com.evermind.server.Application.setConfig(Application.java:340)
07/06/20 13:23:00 at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1879)
07/06/20 13:23:00 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:512)
07/06/20 13:23:00 ... 6 more
07/06/20 13:23:00 Caused by: java.lang.InstantiationException: Error loading web-app 'norm' at C:\oc4j101320_SA\j2ee\home\applications\norm\norm: Could not read mime-mappings config file: ./mime.types
07/06/20 13:23:00 at com.evermind.server.http.XMLHttpApplicationConfigContext.getConfiguration(XMLHttpApplicationConfigContext.java:155)
07/06/20 13:23:00 at com.evermind.server.Application.getHttpApplicationConfig(Application.java:593)
07/06/20 13:23:00 at com.evermind.server.Application.initHttp(Application.java:1345)
07/06/20 13:23:00 at com.evermind.server.Application.setConfig(Application.java:451)
07/06/20 13:23:00 ... 9 more
2007-06-20 13:23:00.218 NOTIFICATION Application Deployer for norm FAILED.
2007-06-20 13:23:00.218 NOTIFICATION Application UnDeployer for norm STARTS.
2007-06-20 13:23:00.281 NOTIFICATION Removing all web binding(s) for application norm from all web site(s)
07/06/20 13:23:00 SEVERE: ProgressObjectImpl.reportError java.lang.InstantiationException: Application: norm is in failed state as initialization failedoracle.oc4j.admin.jmx.shared.exceptions.InternalException: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
at oracle.oc4j.admin.jmx.shared.deploy.NotificationUserData.<init>(NotificationUserData.java:107)
at oracle.oc4j.admin.internal.Notifier.reportError(Notifier.java:429)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:123)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
Caused by: oracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:515)
at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:196)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
... 4 more
Caused by: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
at com.evermind.server.Application.setConfig(Application.java:497)
at com.evermind.server.Application.setConfig(Application.java:340)
at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1879)
at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:512)
... 6 more
Caused by: java.lang.InstantiationException: Error loading web-app 'norm' at C:\oc4j101320_SA\j2ee\home\applications\norm\norm: Could not read mime-mappings config file: ./mime.types
at com.evermind.server.http.XMLHttpApplicationConfigContext.getConfiguration(XMLHttpApplicationConfigContext.java:155)
at com.evermind.server.Application.getHttpApplicationConfig(Application.java:593)
at com.evermind.server.Application.initHttp(Application.java:1345)
at com.evermind.server.Application.setConfig(Application.java:451)
... 9 moreThank you Steve for your help. I really do appreciate ppl taking the time to answer questions from n00b like me.
I tried and disable global.libraries and global.tag.libraries when deploy, and at one point the login page (its Spring 1.2.8 + hibernate 3.1.3 + Myface 1.1.4 + acegi 1.0.1 ) came out, but cannot login and without exceptions, so I was guessing acegi poblem. But the spring and hibernate is working, I can see the conn and other activities. And after a couple tries, cannot even get the login page display now in MyFace, with exceptions:
include(java.lang.String) in javax.servlet.jsp.PageContext cannot be applied to (java.lang.String,boolean)
And then after some googling found out there will be code change for this webapp as well.
- change webapp.listener for double instantiation in OC4J (Code Change)
- create new class OrionSessionListener implements HttpSessionListener for session invalidation (Code Change) NEW JAVA CLASS
- acegi j_security_check URL reference change (Code Change, but minor)
I think the container has great performance, but I just wish they can look more to the compatabilities/common practices issues
full stacktrace:
2007-06-22 14:12:04.437 NOTIFICATION J2EE JSP-0008 Unable to dispatch JSP Page : oracle.jsp.provider.JspCompileException: Errors compiling:C:\oc4j101320_SA\j2ee\home\application-deployments\norm\norm\persistence\_pages\\_login.java
[jsp src:line #:13] include(java.lang.String) in javax.servlet.jsp.PageContext cannot be applied to (java.lang.String,boolean)
pageContext.include( __url,false);
at oracle.jsp.app.JspJavacCompiler.compile(JspJavacCompiler.java:304)
at oracle.jsp.runtimev2.JspPageCompiler.attemptCompilePage(JspPageCompiler.java:731)
at oracle.jsp.runtimev2.JspPageCompiler.compileBothModes(JspPageCompiler.java:456)
at oracle.jsp.runtimev2.JspPageCompiler.compilePage(JspPageCompiler.java:413)
at oracle.jsp.runtimev2.JspPageInfo.compileAndLoad(JspPageInfo.java:705)
at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:694)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:414)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:375)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17) -
[SOLVED] Only local config files for common shells?
Just to understand matter a little better: As far is I've learned, common shells like fish or zsh only look in local directories for configuration files (like ~/.config/fish/config.fish or ~/.zshrc) but wouldn't this be extremly uncomfortable to lose all custumizations when running sudo su? Or is it generally depreciated to use su and one should try to get everywhere using sudo only? Vim, for example, also looks in /etc for a global vimrc.
Thanks for some clarification!
Last edited by ysetdng (2014-07-12 22:47:06)Thanks a lot for the inputs! Now I've got some context.
ConnorBehan wrote:Are you sure they only look in local config files?
I'm unsure now, the man pages say that zsh indeed also parses /etc/zshrc, I only checked the Arch Wike page before and there it doesn't mention this.
Last edited by ysetdng (2014-07-12 22:46:36) -
Read from a config file in File Adapter in SOA Suite 11g
I want to read from a config file in order to determine whether to archive or delete the file after processing using file adapter in SOA Suite 11g. How do i do that.
only part i replied on was the part of how to read a file
but i think in your case you could do the next
use the sync file adapter to read in the file during your process
based on this content you set a variable "myOutputDirectory"
then create a file adapter (write) which will store the file on file system
http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm#CIACICFD
4.3.2.2.5 Specifying a Dynamic Outbound File Name
and use that (jca.file.Directory) property to store the file either on the archive location or the delete location -
Could not read jazn-data config file
I am using JDev 10.1.2
When deploying my app I am receiving
"oracle.oc4j.admin.internal.DeployerException: Cound not read jazn-data config file..." when deploying my app of OC4J 10.1.2.
When I deploy directly to an EAR file and open the EAR file I see:
application.xml
data-source.xml
blah.war
orion-application.xml
I belive what I should see in my EAR file is:
META-INF
blah.war
And drilling down into META-INF I should see:
application.xml
data-source.xml
jazn-data.xml
orion-application.xml
It seems that there is something that is configured incorrectly in my blah.deploy file but I can't find it. I have compared line for line with another app that creates the EAR as expected and I can successfully deploy from that application.
Please help.Hi,
the orion-application.xml file should have a content similar to this
<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE orion-application PUBLIC "-//Evermind//DTD J2EE Application runtime 1.2//EN" "http://xmlns.oracle.com/ias/dtds/orion-application.dtd">
<orion-application>
<data-sources path="./data-sources.xml"/>
<jazn provider="XML" location="jazn-data.xml"
default-realm="jazn.com"/>
</orion-application>
Otherwise the jazn-data.xml file cannot be found.
Frank -
Problem with reading config file
Hello,
I have problem with reading config file from the same dir as class is. Situation is:
I have servlet which working with DB, and in confing file (config.pirms) are all info about connection (drivers, users, passw, etc.). Everything work fine if I hardcoded like:
configFileName = "C:\\config.pirms";I need to avoid such hardcoding, I tryied to use:
configFileName = Pirms.class.getClassLoader().getResourceAsStream ("/prj/config.pirms").toString();but it isn't work.
My config file is in the same directory as Pirms.class (C:\apache-tomcat-5.5.17\webapps\ROOT\WEB-INF\classes\prj)
Also I tryied BundledResources, it isn't work fo me also.
Can anybody help me to solve this problem? with any examples or other stuff?
Thanks in advance.
AndrewThanks, but I am getting error that "non-static method getServletConfig() cannot be referenced from a static context"
Maybe is it possibility to use <init-param> into web.xml file like:
<init-param>
<param-name>configFile</param-name>
<param-value>/prj/config.pirms</param-value>
</init-param>If yes can anybody explain how to do that?
I need to have that file for:
FileReader readFile = new FileReader(configFile);Thanks in advance. -
Problem to read config file when tomcat used as service
hi,
I have an advanced installer developed for an application and the application is working fine when
my tomcat is used in "manual" mode.But when tomcat is used in "Automatic" mode(as a service)
I'm unable to login into my application, may be unable to read the config.xml....
can any one please help me out with a solution.
Regards,
Vardhanhi,
I got a solution.Jst change the mode of tomcat and restart the system.
It's working and pls provide with any other solution if you have..
thanx,
Vardhan -
Search for a specific string in web.config file
Hi
Is there a way we can search a specific word in web.config using powershell.
I have an entry of "user name" in the connection string. I want to find what the user name is and whether its a correct user name or not based on the criteria set in the script.
i believe its a simple matter of if statement but due to connection string i am unable to do this.
this is my connection string from web.config
<connectionStrings>
<add name="Membership" connectionString="Data Source=testdb;Initial Catalog=test;user
name=testUser;password=123456;MultipleActiveResultSets=true"
providerName="System.Data.SqlClient"/>
</connectionStrings>
My criteria is. if user name -eq testUser write-host "correct user name" else "user name is incorrect"
This is the script which i am using
$webConfig = 'C:\Users\test\web.config'
$cfg = [xml](gc $webConfig)
Not sure how the if statement will work in searching the document and applying criteraHere is the full web.config file. i just modified the credentials.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,
EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler,
Common.Logging" />
</sectionGroup>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468
-->
</configSections>
<connectionStrings>
<add name="Membership" connectionString="Data Source=TestDB;Initial Catalog=Test;user
id=TestUser;password=1234556;MultipleActiveResultSets=true" providerName="System.Data.SqlClient" />
<add name="Administrator" connectionString="Data Source=TestDB;Initial Catalog=Test;user
id=TestUser;password=1234556;MultipleActiveResultSets=true" providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory,
EntityFramework" />
</entityFramework>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwExceptions="true">
<targets>
<target name="f1" xsi:type="File" fileName="test.log.txt"
layout="${threadname} ${longdate}
${callsite} ${logger}[${level}] ${message}" />
<target name="console" xsi:type="Console" layout="${threadname}
${longdate} ${callsite}
${logger}[${level}] ${message}" />
</targets>
<rules>
<!--<logger name="Quartz.*" level="Warn" />-->
<logger name="*" writeTo="f1" minlevel="Info" />
<logger name="*" writeTo="console" minlevel="Debug"
/>
</rules>
</nlog>
<common>
<logging>
<factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
<arg key="configType" value="INLINE" />
</factoryAdapter>
</logging>
</common>
<appSettings>
<add key="V3Import.Import.TestMode" value="true" />
<add key="MSMQ.QueueName" value="TestQueue" />
<add key="MSMQ.ErrorQueueName" value="TestQueue" />
<add key="AdminSignaturePath" value="C:\user\test\myfolder" />
<add key="SyncQueueJobCRON" value="0 0/2 * 1/1 * ? *" />
</appSettings>
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="5000000" />
</authentication>
<membership defaultProvider="AspNetMembershipProvider">
<providers>
<add connectionStringName="Membership" enablePasswordRetrieval="false"
enablePasswordReset="false" requiresQuestionAndAnswer="false" applicationName="/Test" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="AspNetMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<profile>
<providers>
<add name="AspNetProfileProvider" connectionStringName="Membership"
applicationName="/Test" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</profile>
<roleManager>
<providers>
<add name="AspNetRoleProvider" connectionStringName="Membership"
applicationName="/Test" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
</system.web>
<system.net>
</system.net>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="dotless.Core" publicKeyToken="96b446c9e63eae34"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.1.0" newVersion="1.3.1.0"
/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0"
/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"
/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"
/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0"
/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"
/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Maybe you are looking for
-
Customizing Pivot Table format in answers
Hi, I have some questions about formats of a Pivot Table. 1) I want to change the position of row headings in Pivot Table view, show them on the right side of the table. Is there any way to do that? The reason is to show "results" column (sum on the
-
Dreaded "must be configured to use a valid SSL cert" - 2008 R2
Hello everybody, I've been browsing through hundreds of topics on the dreaded "The RD Gateway server must be configured to use a valid SSL certificate" error using BPA (Windows Server 2008 R2 Std), but still haven't found a proper solution. Here's th
-
I have iPad 2 since yesterday I can't open the videos , any one know why?!
I can't open my videos anybody knows why
-
Initial View in TabbedViewNavigatorApplication
Hello, I would like to include an opening view in my TabbedViewNavigatorApplication that explains the tabs. This view should be shown only once, when the app starts. All four ViewNavigators should have their own firstViews that I can popToFirstView t
-
How to download Mac OS X Lion from app store!!
I really can't believe how ridiculous this is.. I try to get something from the app store on my mac. The only way to download the app store is to first get a mac software update. I'm willing to pay the $30 for the Lion update. But the apple website a