How do I read properties file kept in the source folder in weblogic workshop

I want to have a log.properties file in the folder of the source java code which
is reading this properties file. When I build the code the properties file also
should go with the generated .class files.
I am using class.getResourceAsStream("log.properties")
I tries different ways to make the class to read the file, but it failed to find
the properties file. Is there any way to keep the configuration files in the same
directory of the source java code ? This is the problem of weblogic workshop 8.1.
This thing runs fine in Tomcat.

Did you try and add the path where the .properties file is located in the CLASSPATH?

Similar Messages

  • How to check whether a file exist in the program folder or not?

    Hi guys,
    how to check whether a file exist in the program folder or not? Let is say i recieve a file name from user then i want to know if the file is there not and act on that base.
    abdul

    Look at the class java.io.File and the .exists() method:
    http://java.sun.com/j2se/1.4/docs/api/java/io/File.html

  • UDF to capture the source file name or the source folder for mapping

    Hi All,
    i have 2 files -  File1 from File2 from 2 different folders- single comm channel FTP (FCC). i have to pass a constant A and B respectively to a field in target structure.
    my options are -
    either create a new field in source str populating different constants and  then map to the target str
    or a udf to get the source file name or the source folder so that i can map the constant using the value mapping/FixValue mapping.
    please suggest. thanks.
    rajib

    Hi,
    please use the UDF to determine the file name. Then based on file name either pass A or B to your target field.
    The code is as given below. Just tweak the code to pass either A or B as per your requirement.
    public String G_GetFileName(Container container) throws StreamTransformationException{
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName; 
    Regards,
    Deepak.

  • How can I get settings files out of the Library folder?

    I had to do a clean reinstall (erase & reinstall) to clear up some problems on my Mac. Unfortunately, when you do this, your settings, customizations, bookmarks etc. aren't transferred over as they do when you upgrade in the normal way.
    For example, dashboard widgets are in each user's <home folder>/Library/Widgets folder.
    I could restore some of these settings by dragging the settings files from the old System Folder to the new one. Unfortunately, Apple is making this harder by hiding the Library folder in the user folder, both on the Mac and on the backup drive.
    There is a command to enter in Terminal to show your Library folder, but this only seemed to work on the Mac and not on my backup drive.
    How can I get key settings files out of the Library folder on my backup drive when the Library folder is hidden?
    Thanks

    Open the enclosing folder, choose Go to Folder from the Finder's Go menu, and provide Library as the path.
    (80699)

  • Deploying properties files outside of the web application in WebLogic 8.1

    Hi
              I am wondering if it is possible to deploy a web application and place configuration files (properties files, log4j xml files etc...) in a folder somewhere within WebLogic that is on the Server instance classpath. This would allow me to edit the config files and restart the server without having to hack into the web application .war file and then redeploy.
              I am really looking for an equivalent of the /applib folder in Oracle 10gAS (each OC4J server instance has an /applib folder which is on the classpath of the server).
              Is there an equivalent for a weblogic server instance?? (i.e. not just for the entire weblogic server but for individual sever instances).
              thanks
              Will

    WLS 9.2 includes pretty advanced features in this area. Both deployment plans and application libraries could be used. There's also a domain/lib directory where jar files can be placed and are visible throughout the server instance.
              Unfortunately 8.1 has none of these features. In 8.1, your choices are to either add these into the $CLASSPATH, or package them in the application.
              -- Rob
              WLS Blog http://dev2dev.bea.com/blog/rwoollen/

  • How to read properties file(key-value) in OSB?

    Hi
    I have a scenario in which I have to read some properties(key-value) from a file. Earlier whole code was developed in java and its easy to read properties file in java.
    But now need to implement this in OSB and performance is very critical in this project.
    I followed DVM approached defined in
    http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html and http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html
    But it did not work. I have hundreds of properties(key-value pairs) to read and need pass them to the business service along with input of proxy service.
    What is the best approach for this (Can not go for db call as performance is very critical)?
    Thanks
    Vibhor

    $DVM= <dvm      name="InterfaceProperties" xmlns:ns1="http://xmlns.oracle.com/dvm" xmlns="http://xmlns.oracle.com/dvm">
         <columns>
         <column      name="PROPERTY_KEY" qualifier="false" order="1"/>
         <column      name="PROPERTY_VALUE" qualifier="false" order="1"/>
         </columns>
         <rows>
         <row>
         <cell>dealer.locate.default.buypower.link</cell>
         <cell>http://www.xyz.com</cell>
         </row>
         <row>
         <cell>dealer.locate.default.unitOfMeasure</cell>
         <cell>MILES</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.nu</cell>
         <cell>Nurun</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.bu</cell>
         <cell>Buick</cell>
         </row>
         <row>
         <cell>dealer.locate.brand.identifier.ca</cell>
         <cell>Cadillac</cell>
         </row>
    </rows>
    </dvm>
    XPATH is- ns1:dvm/ns1:rows[1]/ns1:row[1]/ns1:cell[1]/text()
    If I run this xpath in Jdeveloper,its giving me proper output.
    Please this as CQuery resource and try to run this xpath on OSB console.
    Thanks
    Vibhor
    Edited by: Vibhor Rastogi on Sep 21, 2010 4:59 AM

  • How to read Properties file once and access through the entire application

    HI All,
    I want to read properties file only once and want to access the property file values in entire application (like i want to access it in a ordinary class)

    Please do not double-post. Stick with one thread:
    http://forum.java.sun.com/thread.jspa?messageID=9678612

  • "The system cannot find the file specified" - error reading properties file

    I have packaged a class file and a .properties file in the same folder as a ejb-jar file and in the class file i try reading the properties file and it throws me the error - "The system cannot find the file specified". But when I put the complete path, it has no problem finding the file.
    I know that this must be the problem with classpath, but can anybody tell me why it is not finding the properties file even if they are in the same folder. How do I make class files find .properties file which are in a folder.
    Any help will be greatly appreciated.

    Hi,
    I am not sure if your question is realted to the Oracle Application Server - anyway, if you are packaging a class file and a properties file in a JAR File, you need to read the contents in a different manner...something like this... :
    URL url = new URL("jar:file:/home/duke/duke.jar!/");
    JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
    You might want to have a look at this link for more information :
    http://java.sun.com/docs/books/tutorial/index.html
    You may also get better responses if you post your question in one of the Java Forums.
    Regards,
    Sandeep

  • How to configure Java Properties File location in WLW

    How do we tell Workshop 7.0 where to look for Java properties files (loaded by
    PropertyResouceBundle in code) ?
    Thanks,
    Ray

    Ray,
    The build number indicates that you have not upgraded to Service Pack 2 of
    version 7.0. I will strongly recommend you to do so. That will shield you
    from the issues which were fixed in the 2 service packs.
    Regards,
    Anurag
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    >
    Raj,
    We are using WebLogic Workshop Build 7.0.1.0.0829.0 on Windows 2000.
    We shut down the WebLogic Server on Solaris 2.6, log off, log back on,startWebLogic
    in production nodebug mode, and re-run jwsCompile on the same source code.The
    error does not occur anymore. Everything seems to be fine now.
    Thanks,
    Ray
    "Raj Alagumalai" <[email protected]> wrote:
    Hello Ray,
    Can you let me know if you are using the GA version of WebLogic Workshop
    or
    if you have the latest Service Pack.
    Thank You,
    Raj Alagumalai
    WebLogic Workshop Support
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    Anurag:
    Thanks for your response!
    By moving the property files to WEB-INF/classes from WEB-INF, we arealmost there.
    But we have a follow up problem. We use a static initializer to loadthe
    log4j
    property file like this:
    static {
    try {
    ClassLoader cl= (new Log()).getClass().getClassLoader();
    InputStream is = cl.getResourceAsStream(logfile);
    Properties props = new Properties();
    props.load(is);
    PropertyConfigurator.configure(props);
    } catch (Exception e) {
    e.printStackTrace();
    When we run jwsCompile, we keep getting this:
    Compiling: com/****/TestWS.jws
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[weblogic.management.Admin
    may only be used on the Server ]
    at weblogic.management.Admin.getInstance(Admin.java:104)
    at
    weblogic.security.internal.ServerPrincipalValidatorImpl.getSecret(ServerPrin
    cipalValidatorImpl.java:79)
    at
    weblogic.security.internal.ServerPrincipalValidatorImpl.sign(ServerPrincipal
    ValidatorImpl.java:59)
    at
    weblogic.security.service.PrivilegedActions$SignPrincipalAction.run(Privileg
    edActions.java:70)
    at java.security.AccessController.doPrivileged(Native Method)
    at
    weblogic.security.service.SecurityServiceManager.createServerID(SecurityServ
    iceManager.java:1826)
    at
    weblogic.security.service.SecurityServiceManager.getServerID(SecurityService
    Manager.java:1839)
    at
    weblogic.security.service.SecurityServiceManager.sendASToWire(SecurityServic
    eManager.java:538)
    at
    weblogic.security.service.SecurityServiceManager.getCurrentSubjectForWire(Se
    curityServiceManager.java:1737)
    at weblogic.rjvm.RJVMImpl.getRequestStream(RJVMImpl.java:434)
    at
    weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:
    88)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :255)
    at
    weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
    :230)
    at
    weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown
    Source)
    atweblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)
    atweblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)
    at javax.naming.InitialContext.lookup(InitialContext.java:345)
    at weblogic.knex.bean.EJBGenerator$1.run(EJBGenerator.java:101)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:780)
    atweblogic.knex.bean.EJBGenerator.lookupAdminHome(EJBGenerator.java:84)
    atweblogic.knex.bean.EJBGenerator.ensureAdminHome(EJBGenerator.java:122)
    at weblogic.knex.bean.EJBGenerator$6.run(EJBGenerator.java:660)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:821)
    atweblogic.knex.bean.EJBGenerator.generateJar(EJBGenerator.java:482)
    at
    weblogic.knex.dispatcher.DispJar.generateJar(DispJar.java:401)
    atweblogic.knex.dispatcher.DispCache.ensureDispUnit(DispCache.java:695)
    atweblogic.knex.compiler.JwsCompile.compileJws(JwsCompile.java:872)
    at
    weblogic.knex.compiler.JwsCompile.compile(JwsCompile.java:619)
    at weblogic.knex.compiler.JwsCompile.main(JwsCompile.java:109)
    ejbc successful.
    Generating EAR ...
    The EAR was generated and we can even deploy it on Solaris. But whatdoes
    the
    AssertionError mean?
    Thanks,
    Ray
    "Anurag Pareek" <[email protected]> wrote:
    Ray,
    ResourceBundle looks for the properties file in the current thread's
    classpath.
    Since a Workshop webservice's project is nothing but a webapp, the
    properties files can be kept in the WEB-INF/classes directory, which
    is part
    of the webapp classpath.
    You can also use
    Thread.currentThread().getContextClassLoader().getResourceAsStream("MyProp
    s
    properties"); to get access to the properties file.
    Thanks,
    Anurag
    "Ray Yan" <[email protected]> wrote in message
    news:[email protected]...
    How do we tell Workshop 7.0 where to look for Java properties files(loaded by
    PropertyResouceBundle in code) ?
    Thanks,
    Ray

  • How to update MainApplicationResources.properties file

    Post Author: fjaffery
    CA Forum: JAVA
    I am trying to update a key in the MainApplicationResources.properties file in Tomcat\webapps\businessobjects\enterprise115\desktoplaunch\WEB-INF\src\com\crystaldecisions\ePortfolio\framework\main\ folder.  After the changes, I have updated the desktop.war file and redeployed but my changes are not getting reflected in the ApplicationResources.properties file in Tomcat\work\Catalina\localhost\businessobjects_enterprise115_desktoplaunch\loader\com\crystaldecisions\ePortfolio folder.  How do I propogate the .properties files changes to the combined ApplicationResource.properties file?
    Thanks.

    I think i have mixed it up :)
    I have looked at it again and believe you are using regular JSP portlets.
    Can you tell what you want to achieve by reading .properties file. Are you meaning the preferences of the portlet or what exactly are you trying to do?
    Reading propertie files is easy:
    // Read properties file.
    Properties properties = new Properties();
    try {
        properties.load(new FileInputStream("filename.properties"));
        String myKey = properties.getProperty("yourKey");
    } catch (IOException e) {
    }Edited by: Yannick.O on 13-Apr-2010 05:52

  • The best way to read properties file

    Hi folks,
    The best way to read properties file i.e.. using ResourceBundle or FileInputStream . if so how to do it , my properties file is n WEB-INF/classes/myprop.properties.It's urgent.
    Thanks & Regards,
    Rajeshwar.

    WEB-INF/classes should be in your classpath. The web container takes care of that.
    All you have to do is call ResourceBundle.getBundle("myprop").
    It'll append the .properties for you.
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/ResourceBundle.html#getBundle(java.lang.String)

  • Error reading Properties file

    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

  • How can I read pdf files from LabVIEW with different versions of Acrobat reader?

    How can I read pdf files from LabVIEW with different versions of Acrobat reader?
    I have made a LabVIEW program where I have possibility to read a PDF document.  When I made this LabVIEW program it was Acrobat Reader 5.0.5 that was installed on the PC. Lather when the Acrobat Reader was upgraded to version 6.0, there was an error when VI tries to launch the LabVIEW program. And Later again when we upgraded to Acrobat Reader 7.0.5 I must again do some changes and rebuild the EXE files again
    It isn't so very big job to do the changes in one single LabVIEW program, but we have built a lot of LabVIEW programs so this take time to due changes every time vi update Acrobat Reader. (We have build EXE files.)
    The job is to right click the ActiveX container and Click "Insert ActiveX Object", then I can brows the computer for the new version of acrobat Reader. After this I must rebuild all the "methods" in the Activex call to make the VI executable again.
    Is there a way to build LabVIEW program so I don't have to do this job every time we update Acrobat Reader?
    This LabVIEW program is written in LabVIEW 6.1, but I se the problem is the same in LabVIEW 8.2.
    Jan Inge Gustavsen
    Attachments:
    Show PDF-file - Adobe Reader 7-0-5 - LV61.vi ‏43 KB
    Read PDF file.jpg ‏201 KB
    Show PDF-file - Adobe Reader 5-0-5 - LV61.vi ‏42 KB

    hi there
    try the vi
    ..vi.lib\platform\browser.llb\Open Acrobat Document.vi
    it uses DDE or the command line to run an external application (e.g. Adobe Acrobat)
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • How can I read a file with ASCII Special Character into a SQL table using SSIS 2008?

    I've tried everything to read this file and am getting no where.   Help how can I read this file and load a SQL table?
    RS - AscII - 30  (Record Separator)
    GS - AscII - 29 (Group Separator)
    Thank you for your assistance - Covi
    Mark Covian

    We can use script component as source/transformation to read the text file and assign the contains to a string. Split the string by chr(30)  i.e RS and finally stored into an array or write to the output buffer of the script component.
    For example on how to use script component refer this link
    http://social.technet.microsoft.com/Forums/en-US/6ff2007d-d246-4107-b77c-624781baab38/how-to-use-substring-in-derived-column-in-ssis?forum=sqlintegrationservices
    Regards, RSingh

  • How can I read text files from LAN if I only know the hostname?

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    <p>1. How can I read text files from LAN if I only know the hostname, or IP address?
    <p>2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.
    (ex. how can I read the 120th line?)
    <p>Please help!
    <p>sorry for the bad english

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    1. How can I read text files from LAN if I only know the hostname, or IP address?You need to know the URL of the file. You need to know the hostname, port, protocl and relative path.
    The hostname is server, not file.
    2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.Use the seek() to get to a random byte.
    (ex. how can I read the 120th line?)The only way to find the 120th line is to read the first 120 lines. You can use other file formats to find the 120th line without reading the whole file but to need to be able to detremine where the 120th line is

Maybe you are looking for