Tomcat 5 under NetBeans 3.6 read files with wrong path

The problem is quite simple:
I have XSLT file which I read in my servlet. Under Tomcat 4.1.29 (and earlier till 4.0.1) everything works fine, but Tomcat 5 under NetBeans 3.6 produces an error while he tries to read a file not from a directory
$CATALINA_HOME/webapps/..
but from a dir
$CATALINA_HOME/bin/webapps/...
anybody knows how to fix it? Why he wants to start reading from "bin" directory
P.S. Tomcat runs under WIn2000

Actually, sorry, it's more complicated than that... the rules for <xsl:include> say that by default the transformer will look in the same directory as the XSLT file that's doing this include. But that only works if the transformer knows what directory that is. So if you give the transformer an InputStream containing the XSLT (e.g. by using getResourceAsStream), it has no way of knowing what directory it came from. Use the version that creates a File object for the XSLT, and wrap that in a StreamSource when passing it to the transformer. That works for me.

Similar Messages

  • [javaSE + NetBeans] Pasing between remote file with local files

    I'm developing an application to achive this goals:
    1) connecting to remote host using the TCP protocol.
    2) parse a remote file with one in local (the 2 files have the same name)
    3) if this file is not equal with the one in local dowload this file and overwrite the old.
    How can I manage the parse with this files? How can I get the remote file?

    So if there is a file on the remote server under C:\Temp\ called TestFile.csv; should I be able to call that file in a function?
    When I do so, all I see is an error saying cannot find a drive with the name C.
    My thought on how to get the content of the CSV into the session is just to import it to a variable and then use that variable.  This is possible right?
    Thanks,
    Brian
    ------ Brian
    Yes - assuming the file is accessible to the account you are running with and you are in the remote session.
    ¯\_(ツ)_/¯

  • Read files with no app suffixes (.pdf, .doc. xls, etc ...)

    Hi,
    On a Macintosh, files do not have suffixes (.pdf, .xls or .doc, etc ...) to identify the application that created the file. How can I open a file on my iPhone if there is no suffixes ?
    Thanks in advance.

    You're welcome.
    The files on your Mac include the file extension, which you can choose to show or not show with the files on your Mac.
    Since I don't email files to Mac users only, I'm in the habit of including the file extension with all email attachments.
    I'm not aware of a way to force open a file with the iPhone.

  • How to read files with codepage UTF16LE with "Sender File Adapter"

    Hi everybody,
    I am using a XI-Filesender-Adapter to get a (UTF-16LE encoded) file und process it in XI-Mapping.
    This is my File-Content:
    Cost Centre,Cost Code,Page Count (B&W),Page Count (Colour),Job Count
    Unknown,Lexmark,"37,480",334,"11,968"
    Unknown,Unknown,312,0,177
    110000,Lexmark,128,228,43
    The HEX-representation of this content is:
    FF FE 43 00 6F 00 73 00 74 00 20 00 43 00 65 00
    (The starting 2 Bytes FF FE represent UTF16-LE )
    And this is the payload I get for mapping:
    <?xml version="1.0" encoding="utf-8" ?>
    <ns:MT_POM_KOSTEN xmlns:ns="http://aua.com/pom">
    <POM_REC>
      <COSTCENTER>uFEFFCost Centre</COSTCENTER>
      <COSTCODE>Cost Code</COSTCODE>
      <PAGECOUNT_BW>Page Count (B&W)</PAGECOUNT_BW>
      <PAGECOUNT_COL>Page Count (Colour)</PAGECOUNT_COL>
      <JOBCOUNT>Job Count</JOBCOUNT>
      </POM_REC>
    <POM_REC>
      <COSTCENTER>Unknown</COSTCENTER>
      <COSTCODE>Lexmark</COSTCODE>
      <PAGECOUNT_BW>37,480</PAGECOUNT_BW>
      <PAGECOUNT_COL>334</PAGECOUNT_COL>
      <JOBCOUNT>11,968</JOBCOUNT>
      </POM_REC>
    <POM_REC>
      <COSTCENTER>Unknown</COSTCENTER>
      <COSTCODE>Unknown</COSTCODE>
      <PAGECOUNT_BW>312</PAGECOUNT_BW>
      <PAGECOUNT_COL>0</PAGECOUNT_COL>
      <JOBCOUNT>177</JOBCOUNT>
      </POM_REC>
    <POM_REC>
      <COSTCENTER>110000</COSTCENTER>
      <COSTCODE>Lexmark</COSTCODE>
      <PAGECOUNT_BW>128</PAGECOUNT_BW>
      <PAGECOUNT_COL>228</PAGECOUNT_COL>
      <JOBCOUNT>43</JOBCOUNT>
      <POM_REC>
    I can see the correct strings (for example Cost Centre) in  payload, but the string-comparison in the user defines function cannot recognize the equality of the strings:
    for (int i =0; i < a.length; i++) {
    if (
       (a<i>.equals("Cost Centre"))  )
      result.addSuppress();
    else
      result.addValue("");
    Actually I am using UTF-8 as codepage in Fileadapter (and Text as type)
    When I try to use UTF16 (or UTF-16LE) as Codepage, I am getting unreadable characters.
    I also tried binary, UTF16-BE,...
    The only way is to covert the file to ANSI before  I use it with XI. Then my function does work correctly.
    Does anybody have an idea, how I can read a UTF16-LE File and process it correctly in XI?
    I am using XI 7.00 0023  and JSDK 1.4.2-34
    Thanks a lot
    Armin

    Hello Armin,
                        I have gone through some SAP notes and blogs  to find solution to your problem, here is what I found
    1. SAP NOTE 821267
    q) How do I correctly configure the File Encoding used by the File
    Adapter?
    Flat Files with File Content Conversion
    For a File Sender channel, configure the encoding of the source
    file. The file will be interpreted according to the configured
    encoding and converted to XML with an UTF-8 encoding.
    For a File Receiver channel, configure the encoding to match
    the encoding you would like to be written to the target flat
    file.
    - Flat Files without File Content Conversion
    Whether to configure an encoding in this case depends on if you
    want to pass through the file "as is", e.g. within a File
    Sender to File Receiver scenario, or if you want to convert the
    file's encoding on its way through the Integration Server. For
    "as is" processing, configure both the sender and the receiver
    using the File Type setting "Binary".
    To apply an encoding conversion, configure the respective
    source and target encoding in both the sender and receiver
    channel.
    Important: Configuring an encoding in the receiver channel
    will only lead to the expected results if the payload sent to
    the receiver channel is in UTF-8 format (e.g., by having
    specified an encoding conversion in the Sender channel).
    So as per this note if you configure the encoding scheme of sender communication channel to UTF-16LE, adapter should be able to convert it to UTF-8 by default. But you have posted that this encoding scheme is leading to unreadable charcters
    2) SAP note 880173
    This speaks of use of module XMLAnonymizerBean which can be applied to XML payload to change its encoding.
    3) How to guide on encoding : http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42?QuickLink=index&overridelayout=true
    4) SAP note:960663
    http://help.sap.com/saphelp_nw04/helpdata/en/45/da2deb47812e98e10000000a155369/content.htm
    TextCodePageConversion Bean details which might solve your problem.
    5) Finally if nothing above works you need  a java mapping code to convert to target XML structure without any File content conversion. The mapping will convert the received file to proper target XML in "UTF-8" encoding. Please let us know if you need help on the code with this final option.
    Regards
    Anupam

  • Read file with nio and flush with servlet

    Can I read file, by using java.nio (for example by FileInputStream.getChannel()) and then flush the file content thru the servlet?
    I kwow about reading without java.nio, get a byte array and then flush it by httpservletresponse writer or outputstream, but I wish to know if it is possibile with java.nio reading.
    thanks

    I'm doing it only for file reading..
    protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();    
            FileInputStream fis = null;                               
            try
                String path = "/var/hello.txt";
                fis = new FileInputStream(path);       
                FileChannel channel =  fis.getChannel();
                ByteBuffer bb = ByteBuffer.allocate((int) channel.size());
                channel.read(bb);
                byte[] data2 = bb.array();
                channel.close();
                out.write(new String(data2));
            } catch (FileNotFoundException ex)
                ex.printStackTrace();
            } finally
                try
                    fis.close();
                } catch (IOException ex)
    ex.printStackTrace();
                out.close();
        }

  • Specifying byte stream type for Read File with Type Descriptor

    Hi.
    I'm trying to write a VI that reads an image file format that can have
    different datatypes. What I have so far is that I open the file, read
    the header, and get the width, height, number of frames, and datatype.
    I calculate number of pixels by nrows*ncols*nframes with no problem,
    but I'm not sure how to tell Read File the correct datatype to read
    the data into.
    I tried using a Case structure where I have a Read File in each case
    with the correct type constant as input for that case. The problem is
    that the tunnel graduates the datatype to the highest representation.
    I found in Application Note 154 the discussion about Type Descriptors.
    Is there a way to generate a Type Descriptor and output it from a C
    ase
    structure? I tried just returning the value (e.g. 0x0402 for a Word),
    but Read File will just see that the byte stream type is a uint32.
    Is there any other way to do this?
    Thanks for any help.

    I converted the code to LabVIEW 6.1 for you and attached it below.
    Don't worry about being a newbie. We all start there. Keep asking this type of question and you won't stay there long.
    As you are discovering, being strictly typed means that you must rewrite code even for a simple data type change, or convert everything to the same data type first. For image data, conversion can result in a lot of extra space being wasted. Use a modified version of the GLV_WaveformBuffer.vi to hold your data. Use the array functions, which operate inline, to add to and delete the data wires in the buffer. This allows you to save several different data types. You will need several different inputs and outputs to handle these data types. I ha
    ve also attached a similar file created for exactly the problem you have - storing arrays of different data types (data from NI-SCOPE devices, in this case - can be float, I8, I16, or I32).
    Routines that take any type work in one of two ways. LabVIEW primitives, such as plus and minus operators, work by figuring out the type and doing the right thing in the C code layer of the LabVIEW environment. Users of LabVIEW can't do this. Users can make polymorphic VIs. Polymorphic VIs are actually a single VI for every data type that are referenced by a "wrapper", the polymorphic VI. Users still need to write a different VI for every data type they need.
    Take home message - if you need to work with different data types, you will need to rewrite your code for every data type or convert your data to a common data type. Polymorphic VIs and case statements are your friend.
    Let me know if you need more help.
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    GigaLabVIEW61.zip ‏362 KB
    sfpScpChan_Waveform_Buffer.zip ‏74 KB

  • Reading file with BufferedReader

    Hi i have a problem iam trying to make a linked lists, where i read a file and
    each word in that file is putt into the list.
    but the problem is when i use a while loop and the eadLine() method.
    like this
    <method >
    String word;
    try .....
    while((word = file.readLine() ) ! =null){
    word = file.readLine();
    The problem is that readLine() only reads the first word in the file and doesnt make the rest of the list
    any suggestions??
    here is the rest of the code:
    import java.io.*;
    class Lister
    public static void main(String []args) throws Exception {
              Listene l = new Listene();
              l.initiate(args);
    class Listene {
    private BufferedReader file;
    Listerr list = new Listerr();
    public void initiate(String args[]) throws IOException
         String filename =args[0];
         String word;
         try
              file = new BufferedReader(new FileReader(filename));
              while( ( word = file.readLine( ) ) != null ){
              word = file.readLine();
              //System.out.println(word);          
              list.insert(ord);
              shutdown();
         catch (FileNotFoundException e)
              System.out.println("Minila-filen kan ikke �pnes: " + filename);
    public void shutdown()
         if (file != null)
              try
                   file.close();
              catch (Exception e)
                   System.out.println("F�r ikke lukket Minila-filen") ;
    class Listerr{
    Node liste =null;
    Node next;
    void insert(Object element){
         if(liste==null){
         liste=new Node(element);
         System.out.println("setter inn element: "+element);
         else{
         Node n = liste;
         while(n.neste!=null){
              n=n.neste;
         n.neste=new Node(element);
         System.out.println("setter inn element: "+n.element);
    class Node{
         Object element;
         Node neste;
         public Node(Object element2){
         element=element2;
         neste=null;
    }

    Hi, I assume you are trying to read WORDs seperated by newline. i.e., each WORD occuring in a newline in the input-file. If that is the case, the code you have written should work perfectly. One reason why it may fail is when the newline character inserted by the input-file editor is not the one as listed by System.getProperty("line.separator");
    One small change to your code to avoid redundant calls to BufferFileReader::readline() can be done as follows...
    String word = null;
    try
    while( (word = file.readLine()) != null )
    list.inert(word);
    catch (IOException  ex)
    //System.out.println("Could not read file: " + filename + ex.getMessage());
    }

  • Opening .doc files with wrong program

    Hi *,
    first I've installed open office. A few month later I installed micorsoft office. After that I converted all office files. Everything was working fine. Now my mac forgot to open .doc files with ms word, he chooses oo word. I do'nt have these problems with .xls files.
    Where are the global settings that I can tell my mac to open .doc files with ms word (I will not use "open with" each time;-)
    Thanks in advance
    Michael
    Message was edited by: MichaelLudt

    Select the file. Do a "Get-Info" from the File menu. (command-I). In the drop down menu "open with" select the program and then confirm you want all files like these to open with that program.

  • File adapter picking up files with wrong content

    Hello, We configured a file adapter to read *.xml files. We also defined the xsd for the files. We expected that the adapter would only pick up files that conform to the xsd. However we found that all *.xml files (even renamed jpeg's) are read. Is this intended behaviour? Or did we miss some configuration setting?
    Richard

    A short follow-up:
    To make matters worse. If I take a completely different file (like the jpeg) and rename it .xml it gets picked up by the file adpater but there is no audit trail of the BPEL process instance. The file is not archived either, so it's completely gone! If I just change one of the elements the file is read and archived. I can also have the file adapter write the file with the wrong content.
    I found a reference to a bug. (bug 5926809 or SR 6327165.994) is this related, is it solved?
    Richard

  • How to get InputStream from a file with absolute path?

    Hi, guys:
    If I have file with a absolute path that may be inside/outside
    my Eclipse plugin, I want to get an InputStream from it. It just keeps giving me null for "is":
    String absFilePath = "/D:/my_dir/.../sample_file.txt";
    InputStream is = getClass().getResourceAsStream(absFilePath);
    regards,

    Don't use resource as stream if you have an absolute path, use FileInputStream.

  • How to execute sql files with windows path ?

    Hi , here's my stupid question :
    I have my parent SQL script say A.sql in directory C:\program files\my files\A.sql
    A.sql has calls to multiple sql files like this
    @@1.sql;
    @@2.sql;
    When I call A.sql using sqlplus as:
    sqlplus <username> <connection_string> @"C:\program files\my files\A.sql"
    A.sql gets executed but then while calling "1.sql" it fails with the error
    SP2-0310: unable to open file "C:\program.sql"
    This is happening because of the space, how can this be handled. thx in advance :)
    Regards,
    Neuron

    my A.sql is:
    @@1.sql
    @@2.sql
    1.sql and 2.sql are in the same directory as A.sql.
    sqlplus <username> <connection_string> @"C:\program files\my files\A.sql"
    VG2,
    Yes. Specify the entire path/filename and put double quotes around itA.sql has the double quotes around it, however what additional things can be done so that 1.sql and 2.sql which are present in same directory as A.sql also runs.
    Ashish,
    Yes the assumption is correct. Although when I cd to this directory then this issue won't come for sure.
    But the requirement is you can't 'cd' to the directory and want to execute with complete path.
    There is no issues in Solaris as the space is not allowed.

  • Links to PDF files with relative paths from a Captivate 4 project

    I'm creating a presentation in Captivate 4 (I'm making an exe file) with some links to PDF files; the links are buttons with the 'open URL or file' set. The presentation will be distributed in CDs and obviously the links will not work for they point to an absolute path in my PC. Is there another way to display external files? thanks

    "file:\file folder\filename" is not a relative path.  It's still an absolute path because you're specifying the path all the way from the root drive, whether you used a drive letter or not.
    A relative path shows where to find the other file in relation to the file that is calling it.
    Relative paths look like this:
    myDoc.doc (if the file is in the same directory as the file calling it)
    folderName/myDoc.doc (if the file is inside a folder in the same directory as the file calling it)
    ../myDoc.doc (if the file is located in the parent directory above the file that is calling it)
    ../../myDoc.doc (if the file is located two levels above the file that is calling it)
    etc
    Here's a tutorial that explains it better: http://www.communitymx.com/content/article.cfm?cid=230ad

  • Web Application Transaction Monitoring Alerts with "wrong" Path

    Hello,
    i have created some web transaction monitors, such as
    http://foo.htm who is  hosted on the server foo123.cologne.org.
    It works.. but
    we have also a mssql monitoring, the discovery of the mssql management pack discovers the reporting part of mssql server on our managementserver Operations12.cologne.org. So (it's right..) the server Operations12.cologne.org is a member of the SQL Instances;SQL
    Compontents;SQL Computers group.
    When the web transaction monitor generates an alert, it have the pathname Operations12.cologne.org and not the pathname of the "right" server foo123.cologne.org.
    For our mssql admins i have build an email-notification, when somethings going wrong at our sql servers (member of the SQL Instances;SQL Compontents;SQL Computers group) they received a mail.
    The problem is, that they received a mail, when a web transaction monitor generated one, because the pathname is the name of our management server, because the management server is a member of thos sql server groups.
    Someone have an idea to fix my "problem"?
    - Best way: changing the path names of the web transaction monitorings... but how? i can't find anything to change..
    Kind regards
    Wolfgang Winter

    Thank you, it's a help to decide, what to do, so i have to solutions:
    - installing an agent to the web-appliction-hosting-server and configure it as a watcher node
       (may be i will have problems with our firewall admins, because they have to allow the communications and.. when the hosting watcher is down, i have no alerts.. when i use more than one watcher nodes (good).. i have the wrong path names..
    - configure a part of our management server group without  SQL-Reporter Component as a watcher node
       (more easy, because i have to tell my firewall admins: "the server foo456 is the standard watcher node"
    Crazy.. because i don't know, how to assign the web transaction monitors to the "causing" server.., for mail notification and for our integration to HP Service Desk...

  • How to read file with JNI?

    Hello,
    I want to implement a native function that has as a parameter a File type. For example:
    public native void readFile(File f);
    But as far as I know the JNI does not support File type, or I am wrong? One way to solv this problem i of course to convert the file into an array of chars end then to implement some method like:
    public native void readFile(char [] f);
    So if there is another way of solving this problem, please help me.
    Thank you in advance.:)

    I would recommend against passing a File object as a paramater. The implication of trying to do that is that you will be using the File object, which means you will be making JNI calls back into the JVM in order to do what you need to do. If there are very many of those calls, well, no fun!
    If you do it by hand, then yes, it can be very difficult and time-consuming. Jace, http://jace.reyelts.com/jace, (a free, open-source project) let's you do this sort of stuff in your native code very easily. For example,
    * A C++ function that accepts a java.io.File and reads its contents.
    void readFile( java::io::File& file ) {
      const int bufferSize = 512;
      JArray<JByte> buffer( bufferSize );
      try {
        FileInputStream input( file );
        for ( int numBytesRead = 0; bytesRead != -1; ) {
          numBytesRead = input.read( buffer, 0, bufferSize );
          // Do something with the buffer
      catch ( IOException& ioe ) {
        cout << ioe << endl;
    } is just as easy to write as straight Java, and it's all implemented using standard JNI function calls under the covers. For example, the above code results in the invocation of several JNI functions, like, NewObject, NewByteArray, CallIntMethod, FindClass, GetMethodID, ExceptionOccurred, etc...
    God bless,
    -Toby Reyelts

  • Printing Adobe Reader files with a DeskJet 6540 and OS X.6

    Ever since I upgraded to Mac OS X.6, I've had problems printing .pdf files.  No matter what I teil the printer, it only prints one copy of one page of the document.  I've upgraded to Adobe Reader 9.2.0.  Is this a driver problem?  OS X.6 is supposed to take care of that.  Adobe Reader is the only software that causes this problem, and of course Adobe does not provide support.  Any ideas?

    Hi There...I'm having the same problem, although I'm using XP Pro with Service Pack 3 and an OfficeJet 6500 , e709n ...and
    it was working until this past couple of weeks.  I can't print ANY PDF, doesn't matter if it's old or new...  If I "do" a preview, all I see is a line of print across the top of the page.
    Anything else will print other than PDF's, so of course it's driving me nuts! I've even reinstalled the driver for the printer; but it didn't make any difference except for my time and frustration. I hope someone can give us an answer soon...there are important docs I need to print out.

Maybe you are looking for

  • Unable to close web form.

    Here is a typical 11g forms development session for me. 1. Create/modify a form using Forms builder on my PC. 2. Transfer the form to the Solaris box. 3. Compile the form. 4. Open the form on my web browser. 5. With the form still open, repeat steps

  • Otf fonds are installed, but not recognized by Windows XP

    I moved InDesign CS3 to a now notebook (Dell Latitude E6500). After a quiet installation, everything looked ok at first glance. When opening a document which I worked on yesterday on the old Notebook (Dell Latitude D800, 4 years old), the Myriad Pro

  • How to restrict the Report based on sales office

    Hi Experts, I am using BW 3.5. I have a requirement that my sales report should give output to  particular user with his respective sales office only. For Example :   User,   Sales Office    A , Delhi    B, Mumbai User A should not be able to see the

  • Copy and paste text in closed captioning

    Hi, need to copy text in to CC, but it seems not working. I have latest AC6 version on Mac.

  • My screen goes black everytime i click an app

    Everytime i clcik an app it downloads but then it goes black and it send me back to my Home Page! What do i do to fix this?