Read a file in the war

We have packaged our application into a war file. The classes in the war can read some property files which are put in the weblogic server directory. How to open and read the files if we move those property files into the war file? Where can we find some example source codes for it?thanks.
          

Unless you have a very good reason to use disk files, you
          can package your properties files with the web app and use
          Class.getResourceAsStream() or ServletContext.getResourceAsStream()
          (if you put these into WEB-INF for example).
          YZhu <[email protected]> wrote:
          > We have packaged our application into a war file. The classes in the war can read some property files which are put in the weblogic server directory. How to open and read the files if we move those property files into the war file? Where can we find some example source codes for it?thanks.
          Dimitri
          

Similar Messages

  • I have a created a directory structure ias\ias-samples\myapps\src\docroot.In docroot folder i have a single jsp.i created a war file having that jsp,and ear file having the war file

    I deployed the ear file.Now i try calling http://localhost/myapps/test.jsp ??
    i'm i doing the right thing ?

    Hi,
    This is right provided you have installed the webserver & app server
    on the same machine and the port number for the web server is 80 by
    default.
    Regards
    Raj
    Arif Khan wrote:
    I have a created a directory structure
    ias\ias-samples\myapps\src\docroot.In docroot folder i have a single
    jsp.i created a war file having that jsp,and ear file having the war
    file
    I deployed the ear file.Now i try calling
    http://localhost/myapps/test.jsp ??
    i'm i doing the right thing ?
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Reading trace file on the fly.

    I came across one cool trick mentioned by Tanel Poder, but it doesn't seem to work for me. Could anyone please help in reading trace file on the fly.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    SQL> !uname -a
    Linux abc 2.6.16.60-0.34-smp #1 SMP Fri Jan 16 14:59:01 UTC 2009 x86_64 x86_64 x86_64 GNU/Linux
    SQL> select value ||'/'||(select instance_name from v$instance) ||'_ora_'||
      2             (select spid||case when traceid is not null then '_'||traceid else null end
                     from v$process where addr = (select paddr from v$session
      3    4                                               where sid = (select sid from v$mystat
      5                                                          where rownum = 1
      6                                                     )
      7                                          )
      8             ) || '.trc' tracefile
      9      from v$parameter where name = 'user_dump_dest'
    10     /
    TRACEFILE
    /n01/oraadmin1/diag/rdbms/abc/inst1/trace/inst11_ora_28754.trc
    SQL> host mknod /n01/oraadmin1/diag/rdbms/abc/inst1/trace/inst11_ora_28754.trc p
    SQL> set define off
    SQL> host grep "WAIT" /n01/oraadmin1/diag/rdbms/abc/inst1/trace/inst11_ora_28754.trc &
    SQL> set define on
    SQL> alter session set events '10046 trace name context forever, level 8';
    Session altered.
    SQL> select * from dual;
    D
    X
    SQL>
    SQL> select * from dual;
    D
    X
    {code}
    I dont get any WAIT printed into the pipe file created before tracing.
    Am i doing something wrong here ?
    Edited by: Yasu on Nov 12, 2012 10:14 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I tried manual method and yes i am able to find WAIT lines in trace file.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    SQL> select value ||'/'||(select instance_name from v$instance) ||'_ora_'||
               (select spid||case when traceid is not null then '_'||traceid else null end
      2    3                   from v$process where addr = (select paddr from v$session
      4                                               where sid = (select sid from v$mystat
      5                                                          where rownum = 1
      6                                                     )
      7                                          )
      8             ) || '.trc' tracefile
      9      from v$parameter where name = 'user_dump_dest'
    10     /
    TRACEFILE
    /n01/oraadmin1/diag/rdbms/proddba/proddba1/trace/proddba1_ora_23021.trc
    SQL> alter session set events '10046 trace name context forever, level 8';
    Session altered.
    SQL> select * from dual;
    D
    X
    SQL> alter session set events '10046 trace name context off';
    Session altered.
    SQL> !ls -lrt /n01/oraadmin1/diag/rdbms/proddba/proddba1/trace/proddba1_ora_23021.trc
    -rw-r----- 1 oracle oinstall 2738 2012-11-12 01:13 /n01/oraadmin1/diag/rdbms/proddba/proddba1/trace/proddba1_ora_23021.trc
    SQL> !grep "WAIT" /n01/oraadmin1/diag/rdbms/proddba/proddba1/trace/proddba1_ora_23021.trc
    WAIT #1: nam='SQL*Net message to client' ela= 6 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704368368424
    WAIT #1: nam='SQL*Net message from client' ela= 4057810 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704372428142
    WAIT #1: nam='SQL*Net message to client' ela= 6 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704372428492
    WAIT #1: nam='SQL*Net message from client' ela= 195 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704372428892
    WAIT #1: nam='SQL*Net message to client' ela= 3 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704372428939
    WAIT #1: nam='SQL*Net message from client' ela= 46319788 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1352704418748740Not sure why using mknod fails in my case.
    Edited by: Yasu on Nov 12, 2012 12:48 PM

  • I can't read a file with the ext PDF the sender informed me that the file was reset to PDF.

    I can't read a file with the .ext PDF the sender informed me that the file was reset to PDF. But when I tried to open it the caption box informed me"the file is not in PDF format. I suspect the sender simply changed the file .ext which is why I can't open it! What can I do about it! I am working on an iPad.
    Thanks
    Mr Jim Lapthorn

    If the document is not, in fact, a PDF, then you will need to get your sender to provide a PDF.
    Can you open this document in any other application?

  • I have a problem with the mac can not read video files with the extension IMOD. How can I solve this problem?

    I have a problem with the mac can not read video files with the extension IMOD. How can I solve this problem?

    By doing a Google search. 

  • Is it possible to read Prezi files within the iOS app?

    Hello,
    I want to implement Prezi into my iOS app. I am totally unaware that "Is it possible to read Prezi files within the iOS app?".
    If Yes, please provide some tutorial link, so that I can implement into my application.
    Thanks & regard.

    You will get a better answer in
    Developer Forums
    Use your Developer credentials to log in there.

  • I tried to download the trial version of elements 10.  I only got the read me files and the organize

    I tried to download the trial version of elements 10.  I only got the read me files and the organizer.

    Please post the PSE query over the following forums and lets discuss it over there.
    http://forums.adobe.com/community/photoshop_elements
    Thanks and regards
    Harshit yadav

  • I removed chrome 10 and newly installed FF4 final, and I can't read PDF files within the browser. There was no problem in Chrome.

    I removed chrome 10 and newly installed FF4 final, and I can't read PDF files within the browser. There was no problem in Chrome. I can't even see the acrobat reader plugin in the plugins page. Acrobat 10 is already installed in my PC. Every time I try to read a PDF file on the web, FF tries to download it instead.

    As recommended above by Bernd Alheit, I posted this on the Adobe Reader forum. There, I received the advice to repair the installation under the help menu, which I did and it fixed the problem.
    Similar to your solution but found it's a fix found under "HELP" menu and not Add/Remove.
    Thank you.

  • How to read, write file inside the JAR file?

    Hi all,
    I want to read the file inside the jar file, use following method:
    File file = new File("filename");
    It works if not in JAR file, but it doesn't work if it's in a JAR file.
    I found someone had the same problem, but no reply.
    http://forum.java.sun.com/thread.jsp?forum=22&thread=180618
    Can you help me ? I have tried this for all night !
    Thanks in advance
    Leo

    If you want to read a file from the JAR file that the
    application is packaged in (rather than a separate
    external JAR file) you do it like this ...
    InputStream is =
    ClassLoader.getSystemResourceAsStream("filename");Better to use
    this.getClass().getClassLoader().getResourceAsStream();
    From a class near to where the data is. This deals with multiple classloaders properly.

  • How do I read PDF files from the SARS website

    How do I read PDF files from the SARS website
    Got the latest version xi.0.08 of Abobe Reader
    Operating system is win XP Sp3

    You need Adobe Reader or Adobe Acrobat or other PDF reading application installed on your system. Then just double click on the form or publication wanted and follow the prompts as needed.

  • I want to read a file on the client side

    Hi all,
    I want to read a file on the client side, then the server show the contents of that file.

    Signed applet sounds cool - I guess Microsoft's ActiveX technology would be the mirror of this.
    Write you file access code as you normally would and then just drop it in a applet and JAR it up.
    Use keytool to sign it - users will be requested to accept/review your certificate in order to grant file-access permissions.
    Warm regards.

  • Is it possible to read txt files on the new ipod nano? as it was on the 5th gen

    is it possible to read txt files on the new ipod nano? as it was on the 5th gen.

    We won't know for sure until either the iPod is released and somebody can verify that or when the manual is available online from Apple.
    B-rock

  • Do i have to pack all files into the war file/

    Hi,
    suppose a file (say bb.html, for example) within a war has a link to a document outside the war, say c:\aa.doc for example, after deploying the war into the j2ee application server, the linked file cant be found, simply because the file(aa.doc) isn't packed with bb.html. I am wondering if there is a way that I can establish the link, even they are placed in different location.
    to exend the question, in my understanding, the web container within the j2ee application server is a Tomcat run evironment, do I need to connection the applicaiton server to one of web servers like appache web server, IIS etc to get better preform? if yes, how?
    Can anyone give some explanation please?
    Thank you very much!
    Ken

    No they do not have to be packed into the same War file.
    The application server does have to know where they are so that it can handle requests for a given "html" file.
    For example: "bb.html" was found in the war file you deployed.
    it links to "aa.doc" - where is the directory or war file that contains "aa.doc"?
    It too needs to be "deployed" within the server in order to be found.
    I hope this helps.

  • Error reading Remote file when the connection is slow

    I have a program that reads a file from a remote server. The file is an xml file.
    This uses URL inputstream.
    This works just fine but when the xml that it reads grow in size, the content of the file is not completely sent to the variable string.
    I have come to a conclusion that slow connection to the server could somehow cause this. The error is intermittent. Sometimes it works, sometimes it doesn't.
    I hope you guys could help me tune this code or if you have suggestions like other ways to read a remote file. Which will work even if the file grows bigger.
    Thanks
    public String readRemoteFile(String fName)
    try
    boolean bolContinue = true;
    URL tUrl = new URL(fName); //create a URL object with the server source file
    //Logger.log("Getting filesize : " + fName);
    InputStream is = tUrl.openStream();
    String strFileSize = "";
    StringBuffer sbXML = new StringBuffer();
    byte[] b1 = new byte[10];
                   int intBytesToDownload = 0;
    int i = is.read(b1);
    strFileSize = new String(b1, 0, i);
    //Logger.log(fName + " --- " + strFileSize);
    try
    intBytesToDownload = Integer.parseInt(strFileSize);
    catch (NumberFormatException nfe)
    Logger.log("Could not read the file : " + fName);
    return null;
    int bytesReadInTrip = intBytesToDownload;
    int bXMLLocation = 0;
    while (bytesReadInTrip > 0)
    bytesReadInTrip = 0;
    bolContinue = true;
    //System.out.println(strFileURLPath);
    tUrl = new URL(fName + "&fileOffset=" + bXMLLocation);
    //Logger.log("reading file1 : " + fName + "&fileOffset=" + bXMLLocation);
    is = tUrl.openStream(); //get Input stream of the server file.
    //continue download till continuation flag is set i.e. input stream
    // is available.
    while (bolContinue)
              byte[] bXML = new byte[intBytesToDownload];
    i = is.read(bXML);
    //Logger.log("i " + i);
    if (i > 0)
    bXMLLocation += i;
    bytesReadInTrip += i;
    String strTmpXML = new String(bXML,0,i);
         sbXML.append(strTmpXML);
    else
    bolContinue = false;
    is.close(); //close the input stream of the input file.
    //Logger.log("bytesReadInTrip : " + bytesReadInTrip);
    //Logger.log("Read file : "+ sbXML.toString());
    return sbXML.toString();
    catch (Exception e)
    Logger.log("Exception while reading the file : " + fName);
    return null;
    }

    well looks that ur run() method is being called more then one time (..)
    why dont u try file method exists() before writing it to ensure that it is not written previously

  • I tried to back-up my music files to an external hard drive when I purchased a new pc. Now  there are no actual files just the folder when I go to move them to the new PC. itunes doesn't bring them up either, just a read-me file listing the songs. What ca

    I think I lost all of my music when I tried to back-up to an external hard drive. I purchased a new PC and when I tried to transfer from the external hard drive to the new PC, the folders where there, but the music files were "empty". I have an itunes library file that lists all the music that I cannot find, but it is a read-me file and will not repopulate the music into itunes. I seriously lost like 70 gigs af music. Does anyone know if there is a way to salvage these files?

    I think I lost all of my music when I tried to back-up to an external hard drive. I purchased a new PC and when I tried to transfer from the external hard drive to the new PC, the folders where there, but the music files were "empty". I have an itunes library file that lists all the music that I cannot find, but it is a read-me file and will not repopulate the music into itunes. I seriously lost like 70 gigs af music. Does anyone know if there is a way to salvage these files?

Maybe you are looking for

  • I have Adobe Photoshop Elements 8 on my old lap top.  How can I install it on my new lap top?

    I already have Elements 8 installed on my old laptop.  I got a new laptop and need to take it off my old computer and install it on my new one.  Is this possible or do I need to buy a new program?

  • CASE Statement error in function -- Please help!

    Hi All, I created a function in my report. It has a SQL query similar to the one below. The query works fine in SQL plus. It has a CASE statement. I am getting error at line4 at the select statement. Error is: "Encountered symbol 'SELECT'....." Can w

  • Image Processor Task Progress

    Bridge should display an overall progress bar when it is performing a batch image processor task. It would be nice to see at a glance how many of the images have been completed and how many remain. Bridge should have an option to play a sound (fanfar

  • Asset Change - AS02

    Hi, When I am trying to change the Main Asset Master Record, when I am assigning a Cost Center in Time dependent tab, the changes are not effected, it is giving a message "Update Terminated contact your system administrator", Update was terminated Sy

  • Installed Beta 8 -- now version 3.6.13 is using settings used for Beta 8 ????

    Installed V4 Beta 8 -- now version 3.6.13 is using settings used for Beta 8 ???? I thought you are supposed to be able to run the 2 as different programs with different settings, but this is not the case for me right now. What am I doing wrong? I dow