One properties file in resouce adapter

I add one property file under resource adapter
myadapter.rar
   \configuration.properties
   \myadapter.jar
in my java classes located in myadapter.jar,How can I access the parameter info I setup in the configuration.proeprties

Hi,
Try using this code.
InputStream inputstream = null;
inputstream = getClass().getResourceAsStream ("Filename.properties");
p.load(inputstream);
See if this code works. Moreover try to reshuffle you property file location .
I havent used it in JCA adapter, while writing a module i have called a property file in the same project where module bean is with this code.
Hope it helps,
cheers,
Satish

Similar Messages

  • About properties file values in descendind order

    hi,
    I have one query . I have one properties file ab.txt in that
    user       marks
    a    =           1
    b     =           5
    c      =           8
    here my query is  now i want to display marks in descendindgorder
    can any one give idea about this one

    Fine that it works for you, but please keep in mind: writing raw java code in a JSP file is a bad practice. Whenever you need to do so, your design is flawed. You should be using tablibs (JSTL, JSF, etc), EL and/or Java classes (servlets, beans, etc).
    You´ve been warned.

  • Passing properties file to portal

    Hi experts,
    I have one application which was built on PDK. I have one properties file which holds connection information of backend. now how can i pass these properties file to portal. In webdynpro java, we can achieve this using application parameters. but in PDK which procedure we have to follow?
    one more question is, For PDK applications creating the system object is mandatory or optional?. if mandatory how can we do that one for PDK application?
    Regards
    maha

    Hi,
    If it is a AbstractPortalComponent, DynPage or JSPDynPage you can put the information in the portalapp.xml file of the project into the component profile-section for example:
        <component-profile>
            <property name="z.system" value="R3_SYSTEM"/>
            <property name="z.debugMode" value="false"/>
        </component-profile>
    See [http://help.sap.com/saphelp_nw70/helpdata/en/c9/c8af42a6f6cb6ae10000000a155106/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/c9/c8af42a6f6cb6ae10000000a155106/frameset.htm] for more info about portalapp.xml.
    Then in code you access the values:
    String system = request.getComponentContext().getProfile().getProperty("z.system");
    The properties are visible in iview properties in Content Administration -> PortalContent -> [iview properties] - here you can change them.
    Hope that helps,
    Romano

  • Aout access properties file

    i have one package connpool
    it contains DBConnectionManager.java
    and one properties file db.properties
    now in my code i have write
    InputStream is = getClass().getResourceAsStream("/db.properties");
            Properties dbProps = new Properties();
            try {
                dbProps.load(is);
            catch (Exception e) {
                System.err.println("Can't read the properties file. " +
                    "Make sure db.properties is in the CLASSPATH");
                return;
            }it gives error
    Can't read the properties file. Make sure db.properties is in the CLASSPATH
    when i run on eclipse and tomcat
    what is an issue ,where i have to put .properties file
    please help me
    Edited by: hns on Mar 3, 2008 10:25 AM

    Hi,
    Today only i joined the sun Forum. This is the first reply in this forum.
    In the catch block u have given "Can't read the properties file. " + "Make sure db.properties is in the CLASSPATH" in Sysout. Thats what displaying in the console while an exception caught(whatever the exception may be). since you haven't handled a specific exception. better use e.printStackTrace() instead which will tell where the problem exactly in your code.
    You can better use the following code for reading a properties file
    File file = new File("Path of the property file");
    FileInputStream fs = new FileInputStream(file);
    Properties prop = new Properties();
    prop.load(fs);
    now u can use getProperty() method of Properties class to read a property from the file.
    Note: Dont forget to import the following classes
    import java.io.FileInputStream;
    import java.io.File;
    import java.util.Properties;
    i think this will help u out.

  • SAP XI - Combine Two files as one in File Adapter

    Experts,
    I want to combine two files as one in File adapter itself.  I am using a simple scenario of File-to-File where i am just sending the file from sender to receiver as it is , EXCEPT, i want to add one line at the end of the file .
    I was thinking of doing this in File adapter , avoiding any mapping program in Integration Repository ..
    ANY INDEA's ??
    Regards,
    Ashutosh

    Hey
    You have 3 options,first one can be to execute a OS command before message processing or use adapter modules to append the new line in the sender adapter.
    the second option(and better one) is to do this via message mapping.
    third option is to write a OS script and execute it after message processing on receiver file adapter.
    one thing you need to make sure is that since OS scripts run on XI server itself(not on FTP server) so in case you are picking file from FTP server and delivering to FTP ,then you can't use option 1 or 3,you can only use option 2
    Thanx
    Aamir

  • Passing Arguments/Properties File to SUN JAVA ONE WEBSERVER at startup

    We are porting a Java App currently running on an Orion Web Server to Sun Java One Web Sever.
    We have found that with the various java application servers we've used over the years, that each want to find the properties file in a different spot. They way we've got around this is that we start Orion with a -D option to java to set a system property called cdsProps. Example: java -DcdsProps=Path_to_properties_file. We then reference that cdsProps arugment throughout the java code so it knows where to find the properties file. Because the cdsProps argument is used thoughout the java code, if the -D option is not used when starting the webserver to point to the properties file, the website will not function properly.

    in the case above, the command line arguments are passed in the aaaaaaaaaaaaaaaaaaaaaaarggggggggggs array
    you probably want aaaaaaaaaaaaaaaaaaaaaaarggggggggggs[0] for the filenameAm not sure i understand, do you mean i must change the param of the main method to String[] args[0] as this resulted in error when i did so. Or do you mean at command line instead file simply being passed to the Compressor program as
    "java Compressor < examplefilename"
    It has to be "java Compressor < examplefilename[0]" ?
    If you could expand on this, would be grateful,
    Thanks.

  • How can load properties file for one time and use in entire application

    Hi folks,
    I dont want to read properties file every time , and want to get property value in any servelet or jsp page.(means i want to read only property file only for once and want to get value in any where ) , how to do this.
    Message was edited by:
    RajeshwarReddyT

    means we have to read file every time Know but i dont
    want to be happen that ??? No you don't . You read the file once. You store it in the hashmap. Then you hand that hashmap to whatever class needing the data.
    getProperties() returns the hashmap, doesn't read the file.
    Maybe I should have called the method getMap or something.
    Message was edited by:
    karma-9

  • Can't locate .properties file on Visual Admin

    Hello,
    I have created an RID.properties file inside a DynPro application under src/packages/... and I am able to load it and get it's attributes from the DynPro code.
    So far so good...
    As far as I know this properties file can be viewd and modifed on the Visual Admin under:
    Configuration Adapter -> webdynpro...
    I've browsed all the folders at this location and couldn't locate my .properties file. So where is it...?
    Roy

    i think you only want to access and maintain the properties on server side...
    ok, check out
    http://help.sap.com/saphelp_nw04/helpdata/en/b8/aa343e32ff1033e10000000a114084/content.htm
    for an example how to access the properties from your wdp app.
    i suggest loading all props into a specific context node and corresponding attributes. perhaps there are better ways.
    Now sth. uncomfortable:
    Be careful when you redeploy your app. All properties are overwritten with the ones you defined locally.
    you also cant delete the config on local side, it would be deleted on server, too. (at least i think so)

  • Changing properties file value without redploying code

    Hi,
    If I use properties file colors.properties in my web dynpro application for storing key-value pairs as
    color1=RED
    color2=BLUE
    color3=GREEN
    is it possible to change colors.properties  in future to show new colors
    color1=ORANGE
    color2=YELLOW
    color3=PURPLE
    without redeploying code ? through Visual Admin / Config tool  ?
    If not, what is the other way to avoid hard coded values in Web Dynpro Java ?
    Thanks !!

    Hi,
    Its can be achieved using the WDConfiguration API of Java Webdynpro.
    The details are given in the blog below;
    /people/daniel.wirbser/blog/2005/09/28/properties-files-in-web-dynpro-applications-how-to-use-the-wdconfiguration-api
    Also for changing this properties all we need to do is from Visual Administrator/Config tool(changing from config tool will need a re-start)
    Proceed as follows to start the Visual Administrator:
           1.      Start the Visual Administrator by double-clicking on file go.bat in the file directory C:\usr\sap\<System ID>\<System Number>\j2ee\admin, in which the J2EE Engine is installed. For example, the background file can be stored in directory C:\usr\sap\J2E\JC00\j2ee\admin.
    You can find a description of the Visual Administrator in the SAP Library under SAP NetWeaver u00AE Application Platform (SAP Web Application Server) u00AE J2EE Technology in the SAPWeb Application Server u00AE Administration Guide u00AE Server Administration u00AE SAP J2EE Engine Administration Tools u00AE Visual Administrator.
           2.      Navigate to directory Server 0/Services/ Configuration Adapter / webdynpro/ <sap.com/Your namespace>/ <Your Web dynpro application>
           3.      Select the property file
           4.      The Visual Administrator opens so that you can edit the values. You can change or redefine the parameters and check the option "Use Custom " to take the new value.
    Thats all.
    One more URL is
    http://help.sap.com/saphelp_nw04/helpdata/en/09/a4d6a674bc1d4a9e74abf81bed3ef6/frameset.htm
    Regards
    Priya

  • No oidAdminClass property not found in servicename.properties file

    Hi ,
    I am new to forum. I got one exception in lione no 2 as follows, when i am trying to get the user information , as follows.
    the code is like this.... Any help...
    Tons of advance in advance...
    1.ProviderContext pc = pReq.getProviderInstance().getProviderContext();
    2.OidManager oidMgr = new OidManagr(pc);
    The exception is as follows...
    oracle.portal.provider.v2.ProviderException: No oidAdminClass property not found in servicename.properties file
    08/04/17 18:43:03      at oracle.portal.utils.v2.ContainerException.fillInStackTrace(Unknown Source)
    08/04/17 18:43:03      at java.lang.Throwable.<init>(Throwable.java:195)
    08/04/17 18:43:03      at java.lang.Exception.<init>(Exception.java:41)
    08/04/17 18:43:03      at oracle.portal.utils.v2.ContainerException.<init>(Unknown Source)
    08/04/17 18:43:03      at oracle.portal.provider.v2.ProviderException.<init>(Unknown Source)
    08/04/17 18:43:03      at oracle.portal.provider.v2.oid.OidManager.<init>(Unknown Source)
    08/04/17 18:43:03      at htdocs.oratest._OraTestShowPage._jspService(_OraTestShowPage.java:90)
    08/04/17 18:43:03      at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    08/04/17 18:43:03      at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:569)
    08/04/17 18:43:03      at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:305)
    08/04/17 18:43:03      at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
    08/04/17 18:43:03      at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
    08/04/17 18:43:03      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/04/17 18:43:03      at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/04/17 18:43:03      at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    08/04/17 18:43:03      at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:253)
    08/04/17 18:43:03      at oracle.portal.provider.v2.render.http.AbstractResourceRenderer.renderBody(Unknown Source)
    08/04/17 18:43:03      at oracle.portal.provider.v2.render.RenderManager.render(Unknown Source)
    08/04/17 18:43:03      at oracle.portal.provider.v2.DefaultPortletInstance.render(Unknown Source)
    08/04/17 18:43:03      at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.showPortlet(Unknown Source)
    08/04/17 18:43:03      at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.handleHttp(Unknown Source)
    08/04/17 18:43:03      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    08/04/17 18:43:03      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    08/04/17 18:43:03      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    08/04/17 18:43:03      at java.lang.reflect.Method.invoke(Method.java:324)
    08/04/17 18:43:03      at oracle.webdb.provider.v2.adapter.SOAPServlet.doHTTPCall(Unknown Source)
    08/04/17 18:43:03      at oracle.webdb.provider.v2.adapter.SOAPServlet.service(Unknown Source)
    08/04/17 18:43:03      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    08/04/17 18:43:03      at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
    08/04/17 18:43:03      at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    08/04/17 18:43:03      at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    08/04/17 18:43:03      at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
    08/04/17 18:43:03      at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
    08/04/17 18:43:03      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    08/04/17 18:43:03      at java.lang.Thread.run(Thread.java:534)

    the password value stored in OID is just a hashed value (by default) and it's virtually impossible to retrieve the original value of password, as entered by the user.
    There are option in OID for storing the encrypted value (vs the hash value). Perhaps that in this case there are means to do the job.
    In my opinion it's a bad choice (from governance perspective) to allow developers retrieving a user password value from a directory.
    Patrick.

  • Unable to load properties file from filesystem

    Hi,
    I have a client swing-applicatiion packaged in a jar-file. The application uses some resource files, including a xxxx.properties file to set defaults for the application. All resource files are included in the jar file and everything works as expected. I load the xxxx.properties file as follows:
    is_ = getClass().getResourceAsStream("/resources/xxxx.properties");
    Because it is not possibl to change any property values inside the jar-file without recreating this jar-file, i want to exclude the xxxx.properties file from the jar-file and put it in the folder containing the jar-file.
    So i have:
    drive:/folder/app.jar
    drive:/folder/xxxx.properties
    Now i read the xxxx.properties file from disk in stead of the 'resouce'-folder within my application (jar):
    is_ = getClass().getResourceAsStream("drive:/folder/xxxx.propoerties");
    but it doesn't work, the file isn't found.
    What am i missing here?
    Any suggestions?

    The best way to approach this is to include the properties file in the Jar as you originally did. If the user changes any property, save the entire set of properties to a sub-directory of user.home (perhaps based on the package name of the main class). Check for the copy in user.home before using the 'default' properties built into the Jar.
    Other places/ways to store the changed information.
    - java.util.prefs.Preferences
    - Assuming the app. has a GUI and can be deployed over a network, the JNLP API PersistenceService. Here is a demo. of the PersistenceService (http://pscode.org/jws/api.html#ps).
    Edit 1:
    I did not at first notice that this post was in Java Applet Development.
    <li> Applets can also (theoretically) use cookies to store information. This is prone to failure when users disable cookies.
    <li> To store information on the local file system (e.g. in user.home) or to use Preferences (AFAIU) would require trusted code.
    <li> If the user has the Next Generation Java Plug-In (Java 1.6.0_10+) it is possible to leverage the JNLP API services in an embedded & sand-boxed applet.
    Edited by: Andrew Thompson on Feb 1, 2011 9:32 AM

  • How Can i specify multiple server names in rwservlet.properties  file?

    How Can i specify multiple server names in rwservlet.properties file without clustering?
    I am using oracle 10g Application server. we have 3 servers Repsvr1, RepSvr2 and RepSvr3. Now i need to configure rwservlet.properties file to point to these servers based on any running report. i got 3 keymap files with reports info.
    Sample entry in the key map file is:
    key1: server=Repsvr1 userid=xxx/yyy@dbname report=D:\Web\path1\path2\reports\Report1.rdf destype=cache desformat=PDF %*
    key2: server=Repsvr2 userid=xxx/yyy@dbname report=D:\Web\path1\path3\reports\Report2.rdf destype=cache desformat=PDF %*
    rwservlet.properties file letting me to enter only one servername. Even though i merged all 3 keymap files into 1, still i have the server name issue. If i leave the server to the default name still i am getting the below error.
    REP-51002: Bind to Reports Server Repsvr1 failed. However, i know the default rep_<servername> would be used incase we dont have SERVER=<value> parameter in the rwservlet.properties file.
    If i specify the servername in the rwservlet.properties file then only Repsvr1 reports are working fine and other 2 server reports are giving the same error like
    REP-51002: Bind to Reports Server <<Server Name>> failed.
    how can i configure the info which will work all 3 reports. 2 Port servers are invoking using oracle forms and report server is invoking using ASP pages.
    If i specify Server name & Key map file in rwservlet.properties one at a time, all the reports are working without any error, whenever i am trying to integrate all 3 to workable i am getting binding error. if i exclude the server from rwservlet.properties still i am getting the same error.

    My RELOAD_KEYMAP setting is YES only.As i said If i specify Server name & Key map file in rwservlet.properties one at a time, all the reports are working without any error.
    keymap file entries
    key1: server=Repsvr1 userid=xxx/yyy@dbname report=D:\Web\path1\path2\reports\Report1.rdf destype=cache desformat=PDF %*
    key2: server=Repsvr2 userid=xxx/yyy@dbname report=D:\Web\path1\path3\reports\Report2.rdf destype=cache desformat=PDF %*
    If i use http://server.domain:port/reports/rwservlet? cmdkey = key1 should bring the report from Repsvr1 and http://server.domain:port/reports/rwservlet? cmdkey = key2 should bring the report from Repsvr2, but i am getting an error from Repsvr2 saying that REP-51002: Bind to Reports Server repsvr2 failed.
    Only Servername Repsvr1 is in rwservlet.properties file. Now what is the best option to by pass the server from rwservlet.properties file and should be from keymap file. if i comment server name in rwservlet.properties file still i am getting REP-51002: Bind to Reports Server <<Server Name>> failed error for both keys.

  • How to load a properties file?

    Hello Everyone,
    We are experiencing difficulties when trying to load a properties file from a directory other then the one where the servlet is located. We are using the following code for this purpose:
    private final String PROP_FILE_NAME = "my.properties";
    Properties props = new Properties();
    try {
    props.load(getClass().getResourceAsStream(codeBase + PROP_FILE_NAME));
    } catch(IOException e) {
    //handle error ...
    where codeBase is either physical directory path to the properties file or the URL. In either case we get a NullPointer exception which means that file is not found. But when we copy the properties file into the same directory where the servlet resides, everything works fine.
    Does anybody have an idea as to how to resolve our problem?
    Any help will be greatly appreciated!
    Thanks in advance!
    Y.M.

    URLs try to address this issue for cross-platform file reference.
    I'd try doing something like:
    URL u = new URL(codeBase + PROP_FILE_NAME);
    props.load(getClass().getResourceAsStream(u));
    Regards,
    Eric

  • To Read the contents of the properties file which is located in webserver

    Hi,
    I have one requirement where I have to read the contents of a property file which is located in some path in server. Say for example, when you click on link abcd then contents of abcd.properties file should be displayed in one text view in webdynpro . I am trying to implement this in webdynpro for java. The main thing is like I am not able to retrieve the server path of the file and hence not getting the file contents. I tried using methods like  getApplicationPath() or getRealPath() but its not working. So can you guys please help me on to how to read the server file contents.
    Thanks and regards,
    Sai

    Hi Romano,
    Thanks a lot for your reply. However, I forgot to mention one thing in my question. Its like the path will be different everytime. Say, we have systems like development, acceptance, production. So when the user clicks on the link abcd, it should take the path of development system and similarly when the user clicks on the link in acceptance or production, the path will be different. say for example, in development the path will be
    usr/cluster/dev/abcd.properties but it acceptance it will be usr/cluster/acc/abcd.properties. So just want to know whether this will work? Anyway, I will give this a try.
    Thanks once again,
    Sai

  • How to give Path for a properties file

    Hi,
    I am using a SQL.properties file to load all my SQL statements to my EJB JDBC prepared Statement. I have placed the SQL.properties file in com.company.sql package. I have another SQL class in the same package which is loading the SQL.properties file to cache for future use. I am using the path as "SQL.properties" (the file name straight ) in the SQL class to access the properties file.
    I am using Sun App Server 7. To get access to this file I need to copy the SQL.properties file to the config directory of the app server instance. Otherwise it is not able to locate the file. I don't want to put the properties file in the config directory of the app server instance. Please help me, what path I have to give to access the file from the package itself, rather from the config directory of server instance.
    I think , some one who is doing localization can help me out here. They have to put the localized properties file to access the text out of it. Please help me. Thanks in advance.
    Thanks
    Amit

    You can use ResourceBundle class to load this properties file from the classpath:
    ResourceBundle props = null;
    props = ResourceBundle.getBundle("com.company.sql.SQL");

Maybe you are looking for