Help: Problems accessing XML file in WebSphere 3.5 Fix Pack 4 on Solaris

We are having an emergent issue with WebSphere 3. 5 Fix Pack 4 on Solaris 2.6: The WAR file we deployed fails with runtime exception due to the inability
to access a local resource(XML file) in the converted WAR file's web directory.
The way we access this XML file is as follows:
ServletContext theCon = getServletContext();
URL u = theCon.getResource ("/web/test.xml");
String newPath = u.toExternalForm ();
InputStream is = new URL (newPath).openStream();
The InputStream returned from the URL object is NULL.
After checked the URL's externalForm string, we noticed that its protocol part is "classloader", e.g. the whole URL string is like "classloader:/opt/...../web/test.xml". However, if we replaced "classloader" with "file", the problem disappeared and the XML file can be read without error.
Anybody know why "classloader:" in the URL string cause this problem, and what is the solution without changing the URL string?
Thanks a lot!

Hi,
Can you try to replace the two last lines with:InputStream is = new FileInputStream (u.getFile());Hope this helps,
Kurt.

Similar Messages

  • Problems Accessing Local Files

    Hi,
    I'm sure this has been discussed before, but I'm havign problems accessing a file on the target machine's local filesystem. I've signed all my jars and added the all-permissions tag to the jnlp file. However, my code:
    ClassLoader cl = getClass().getClassLoader();
    InputStream is = cl.getResourceAsStream("c:/resources/testsuite.xml");
    fails to find the file "testsuite.xml".
    Is this a classpath issue? I've tried to add c:/resources to the class path but with no luck.
    any help would be much appreciated
    Thanks

    Try "file://c:/resources/testsuite.xml" instead. I
    believe you are suppose to be passing in a valid URL
    and what you passed in wasn't.That's wrong. Resource name should be just a path. It could be a full path started from "/" or just a relative path from given class (here better to use this.class.getResourceAsStream() method).
    Better yet, since you are giving full security access
    to the user's local machine you don't really need to
    rely on the class loader at all. It's just a normal
    file, so you could create your File object and read it
    in the way you do normally. I would suggest to do not rely on File object at all because it can only be dealing with local file system and thats can't be changed in future.

  • How to access xml file using c

    how to access xml file using c. are there any libraries regarding xml fastinfoset in c? Please let me know about any resources if u know? thanks!!!
    samitha

    There are different methods to access XML data which have pro's and cons. Let us know more about what you want to do and we can help you.

  • Access XML files from HTTP

    Hi,
    I need access XML file from HTTP. Server need parameters in the URL to generate XML files. For example, http://fileserver/xmlfile?orderid=123&custid=321.
    I created a XML Data Server in ODI 11g. The JDBC Url should be jdbc:snps:xml?f=<filename>&s=<schema>&d=<DTD>.
    However, it reports error when replaced the <filename> with "http://fileserver/xmlfile?orderid=123&custid=321".
    I found it's caused by ampersand of the HTTP Url. I guess ODI treat custid=321 as JDBC parameter rather than HTTP parameter.
    How to fill the JDBC Url in this situation?
    Thanks,

    i solved my problem by using the Socket object and controlling my file access by writing requests to the outputstream

  • Accessing XML files through java

    Can any one explain me the easiest way of accessing XML files from Java.

    Hi,
    If you want to only access the XML file, use the SAX parser It will be very easy to handle and identify the element and value.
    else if u want to change the XML value also, then better go with DOM, Which has very good flexiblity.
    use according to the need, let me know if any help is required......
    With Cheers
    PrasannA

  • Is XML adapter should be installed in BODS server in order to access XML files?

    Hi All,
    I have doubts while working withe XML/XSD files.
    1.Is XML adapter should be installed in BODS server in order to access XML files?
    2.What is startup_script.xml that we need to set up in Admin side.
    Thanks,
    Deepthi

    Hi Shiva,
    Thanks for reply. With out XML adapter I am able to load .xml file throght BODS using template XML. But I am notable to view the file properly like it is not showing schema.
    I doubt I need to check with XML source using BODS.But I have few doubts.
    1. XSD in local mechine and XML in Remote server (FTP).- In this case I am able to read the stucture of XSD.
    2. XSD and XML in FTP server-- In this case I am unable read the XSD structure from FTP server
    Please suggest how access XSD and XML in the job with out error.
    Thanks,
    Deepa

  • I am receiving the 'Could not sign you in [Access denied: 530]. Check your user name and password' problem on Adobe Muse CC 2014 and I cannot access the xml file that is supposed to fix this issue?

    I am a PC user and I have Adobe Creative Cloud Muse 2014. I have received the 'Could not sign you in [Access denied: 530]. Check your user name and password' error when trying to upload my muse site to my ftp host, GoDaddy. I have successfully done this in the past and only recently it has stopped working. I looked online at the FAQ Adobe Muse Help | Uploading an Adobe Muse Site to a third-party hosting service and it said to download the ftpprefs.xml file but this file simply leads to a blank page that says /*Not found*//*Not found*/.
    Can someone direct me to a working page with this file or provide a different solution? Thank you!

    Hello,
    As you are getting error [Access denied: 530] it means issue is with access. Either the username and password you are entering is incorrect or you do not have proper permissions.
    I would suggest you to contact Godaddy to either reset password or reset the permissions.
    Regards
    Vivek

  • Problems accessing parameters, files - problems in general.

    I've been posting my problems to comp.lang.java.programmer but Google Groups is exceedingly slow to update and I've been stuck on this for nearly two whole days:
    I am developing what will be a series of web utilities for our company and our client's company. Unfortunately I am hampered by the fact that my Java is not that good having come from a C++ background.
    My current setup is Windows XP, JDK 1.3.1.07 (which is what our client is running), Tomcat 4.1 for testing on my local box.
    I've been middling around with small examples and decided to do something slightly more complex. What I am trying to do is access a file that is described in web.xml as a parameter. However when ever I run the program it is unable to find the file. All the documentation I have (web-based plus a Professional Java Server Programming J2EE Edition - way over my head) either skims across it/takes it as read it will be set up correctly/doesn't touch it at all.
    I thought I was trying to access the wrong directory so I mapped the file to the root of C and still can't access it - it always comes back as null. Also between attempts I restart the Tomcat server so it always loads in the web.xml file.
    This is my web.xml:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <display-name>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description>
      <servlet>
        <servlet-name>LogIn</servlet-name>
        <servlet-class>website.LogIn</servlet-class>
        <init-param>
          <param-name>passwordFile</param-name>
          <param-value>C:\\passwords.txt</param-value>
        </init-param>
      </servlet>
      <servlet-mapping>
        <servlet-name>LogIn</servlet-name>
        <url-pattern>/logged</url-pattern>
      </servlet-mapping>
    </web-app>And the Java:
    package website;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    *  Handles the login to the administrators section of the website
    public class LogIn extends HttpServlet
        private String passwordFile;
        /** Read the password file from the location specified
         *  by the passwordFile initialization parameter.
        public void init(ServletConfig config) throws ServletException
            super.init(config);
            passwordFile = config.getInitParameter("passwordFile");
            System.out.println(passwordFile);
            if (passwordFile == null)
                System.out.println("The \"passwordFile\" property must be set to a file name");
            try
            catch (Exception e)
                System.out.println("Error: Unable to read passwordFile.");
        public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
        public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    }It was suggested on comp.lang.java.programmer to check the path that the system was thinking I was searching which I did by inserting this code fragment:
         // initialise the servlet and load password(s)
    //     super.init(config);
    //     passwordFile = config.getInitParameter("passwordFile");
         // added code
         passwordFile = "passwords.txt";
         File f = new File( passwordFile );
         System.out.println( f.getAbsolutePath() );
         // added code.
            ...This lead me to learn that the directory being returned was:
    C:Program Files\Apache Group\Tomcat 4.1\passwordFile.txt
    Which is strange since I would of thought that the lowest directory
    that is visible to the class would of been ROOT (hence it's name).
    Does this mean if I copy the passwordFile.txt to the above directory
    it would work? Actually no. I still can't get the filename as a
    parameter from web.xml which is frustrating. If you could give me any
    pointers on what might be wrong then that would be cool.
    I thought I could move forward by accessing the file directly. But no: An addition of f.exists() to check that the file exists returns false. I've now got a copy of passwords.txt in every single directory from the classes directory all the way down to C:\ and it still doesn't work.
    I hope someone can help out here since this is very frustrating to be stuck on something so basic as file handling.
    Graham Reeds,
    http://omnieng.co.uk | [email protected]

    I can see how this is frustrating but it should be fixable. The last example you posted won't work because you have "passwords.txt" instead of "c:/passwords.txt".
    If you're still looking for a solution could you cut and paste the following code into your servlet code and then post the results?
    // Check that init param is read correctly
    String filename = config.getInitParameter("passwordfile");
    System.out.println("config param = " + filename);
    // try filenames
    String[] filenames = new String[] {"c:/passwords.txt", "c:\\passwords.txt", "passwords.txt"};
    for (int i=0; i < filenames.length; ++i) {           
       File file = new File(filenames);
    System.out.println("File " + filenames[i] + " - exists = " + file.exists());
    System.out.println("Abs path = " + file.getAbsolutePath());
    This is based on the file c:\passwords.txt existing - if I have the wrong filename, please adjust. Also, you may need to change <i> to [[i]i] in a couple of places.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

  • Urgent help importing an XML file

    Hi all,
    I'm currently exporting my XML files from Magento, the webshop client. However I cannot use the XML task in ETL because I get the error about namedspaces. I can open the XML file itself no problem, it contains a few columns with data, some empty values.
    What I do to solve the error is create the script in ETL that converts the XML file so that I can make the SDX schema. The ETL script itself works 
    <?xml version="1.0" encoding="utf-8" ?> 
    <xsl:stylesheet version="1.0"         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
      <xsl:output method="xml" indent="no" /> 
      <xsl:template match="/|comment()|processing-instruction()"> 
        <xsl:copy> 
          <xsl:apply-templates /> 
        </xsl:copy> 
      </xsl:template> 
      <xsl:template match="*"> 
        <xsl:element name="{local-name()}"> 
          <xsl:apply-templates select="@*|node()" /> 
        </xsl:element> 
      </xsl:template> 
      <xsl:template match="@*"> 
        <xsl:attribute name="{local-name()}"> 
          <xsl:value-of select="." /> 
        </xsl:attribute> 
      </xsl:template> 
    </xsl:stylesheet> 
    But when I open the newly created file he looks really odd: See below for the initial file and the new file (based on how many times I open the file, i get another weird look...). Please help me out it's killing me :)

    Or you can apply a XSLT transform as per http://blogs.msdn.com/b/mattm/archive/2007/12/15/xml-source-making-things-easier-with-xslt.aspx
    Arthur My Blog

  • Problem in XML file download

    types: begin of type_s_data,
             record(65000) type c,
           end of type_s_data.
    data: w_xml_out type string.
    data: t_xml_tab type table of type_s_data with header line,
    Source code
          t_code    type table of type_s_data with header line,
    After populating t_code table,
    convert internal table data into XML document
      call transformation id
           source code = t_code[]
           result xml w_xml_out.
    append XML docu to internal table
      append w_xml_out to t_xml_tab.
    Download to XML file
      call function 'GUI_DOWNLOAD'
        exporting
      BIN_FILESIZE                    =
         filename                        = filename
         filetype                        = 'BIN'
        append                        =
      write_field_separator           = sep
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      SHOW_TRANSFER_STATUS            = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
        tables
         data_tab                        = t_xml_tab
      FIELDNAMES                      =
        exceptions
         file_write_error                = 1
         no_batch                        = 2
         gui_refuse_filetransfer         = 3
         invalid_type                    = 4
         no_authority                    = 5
         unknown_error                   = 6
         header_not_allowed              = 7
         separator_not_allowed           = 8
         filesize_not_allowed            = 9
         header_too_long                 = 10
         dp_error_create                 = 11
         dp_error_send                   = 12
         dp_error_write                  = 13
         unknown_dp_error                = 14
         access_denied                   = 15
         dp_out_of_memory                = 16
         disk_full                       = 17
         dp_timeout                      = 18
         file_not_found                  = 19
         dataprovider_exception          = 20
         control_flush_error             = 21
         others                          = 22.
      if sy-subrc <> 0.
        message e016 with 'Error during file download'(002).
      endif.
    Problem here is when intrernal table data/size is large, only part of the data is getting displayed in the file and at the bottom of the file showing an error message
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    End element was missing the character '>'. Error processing resource 'file:///C:/Documents and Settings/sowjanya.suggula/De...
    RECORD
    ^
    >RECORD>
      </item>
    wehn i change data  declaration as
    data: t_xml_tab type table of string with header line.
    when i execute the program, giving me a short dump.please suggest me a soluion for this.
    Regards,
    Sowjanya

    Hi Sowjanya,
    Kindly go through this link below:
    It Uploads XML to internal table and vice versa :
    Upload XML to internal table and vice versa in SAP 4.6C
    Hope it helps
    Regrds
    Mansi

  • JSTL - Problem parsing XML file w/ XML schema declarations

    I'm having trouble parsing an xml document that contains XML schema declarations in the root element. I've included 2 snippets, the XML files they're supposed to parse, and their output below. The first one works and the second one doesn't. Could someone please tell me why? I find it hard to believe that no one's run into this before.
    I'm running Tomcat 5.5 and I'm using JSP 2.0, jakarta standard taglibs jars (1.1.2), jdk 1.5.0_04, and the Xalan 2.7.0 jars.
    Here's the first snippet:
    <c:import url="/WEB-INF/config/schools.xml" var="xml" />
    <x:parse doc="${xml}" var="schoolList"/>
    There are <x:out select="count($schoolList//school)"/> schools in the file:<br/>
    <x:forEach select="$schoolList//school">
         <x:out select="name"/><br/>
    </x:forEach>it parses the following xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <schools>
         <school id="34033">
              <name>Tumwater Middle School</name>
              <district>Tumwater</district>
              <type>middle</type>
              <active>false</active>
         </school>
         <school id="17001">
              <name>Garfield High School</name>
              <district>Seattle</district>
              <type>high</type>
              <active>true</active>
         </school>
         <school id="00023">
              <name>Tigard High School</name>
              <district>Tigard-Tualatin</district>
              <type>high</type>
              <active>true</active>
         </school>
    </schools>and it outputs:
    There are 3 schools in the file:
    Tumwater Middle School
    Garfield High School
    Tigard High School-----------------------------------------
    The second snippet:
    <c:import url="/WEB-INF/config/schools2.xml" var="xml2" />
    <x:parse doc="${xml2}" var="schoolList2"/>
    There are <x:out select="count($schoolList2//school)"/> schools in the file:<br/>
    <x:forEach select="$schoolList2//school">
         <x:out select="name"/><br/>
    </x:forEach>parses this xml file (note the xml schema declarations):
    <?xml version="1.0" encoding="UTF-8"?>
    <schools xmlns="http://www.serenus.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.serenus.com schools.xsd">
         <school id="34033">
              <name>Tumwater Middle School</name>
              <district>Tumwater</district>
              <type>middle</type>
              <active>false</active>
         </school>
         <school id="17001">
              <name>Garfield High School</name>
              <district>Seattle</district>
              <type>high</type>
              <active>true</active>
         </school>
         <school id="00023">
              <name>Tigard High School</name>
              <district>Tigard-Tualatin</district>
              <type>high</type>
              <active>true</active>
         </school>
    </schools>and its output is:
    There are 0 schools in the file:That's it! No errors at all! I'm 100% certain the variable names, filenames, etc. are correct. I've looked everywhere for an existing answer to this problem, but I can't find one. Is this a known issue? Please help.
    -Ben

    Hi Ben,
    I got exactly the same problem and also could not find any solution.
    Did you find a way out for this problem meanwhile?
    Any help is welcome!

  • How to access XML files on public part of an external library DC?

    Hi,
    I would like to put xml and xsd files into a public part of an external library DC, so that I can access these files within other DCs. But I don't know the path which I have to use in the other DCs, e.g. for creating a File object from such xml or xsd files. What do I have to do to get this running?
    I'm using NetWeaver CE 7.2 for Java.
    Thanks in advance for your help!

    An External Library DC is only intended to include jars. Using a Java DC may be a better idea, unless you put your xml files into a jar first (but you'd need a Java DC for that...).

  • How to access XML files inside IDML?

    Hi All,
    How to access the different XML files like designmap, story, masterspread, etc. found inside the IDML files?
    Pl. help.
    Thanks,
    Praveen

    An External Library DC is only intended to include jars. Using a Java DC may be a better idea, unless you put your xml files into a jar first (but you'd need a Java DC for that...).

  • Begging for help with podcast xml file

    Hey All,
    I have a podcast on iTunes.  I am hosting the xml file and podcast mp3s on a friends server so Im not using any service.  Everything is working and Ive sucessfully added 4 podcasts so far, and it shows up correctly in iTunes on my PC.
    However my podcasts do not showup correct in the iTunes store website, or on idevices.  Meaning, I number my shows 001_"NAME" 002_"NAME" etc.  Yet in the iTunes store they show up out of order.  So my last show is not at the top its at the bottom, and they are all mixed up (like 002, 001, 004, 003 instead of  4,3,2,1)  Also the publish date is the same on two of them (and not what i have in the xml file) and doesnt show up at all on the other two.  I assume this is a problem with the xml file, yet I dont see any problems with it.  But it seems odd that it all works correctly in the actual iTunes program.  Ive tried different code, but im very much a noob at it, and everything i find online is from 5 - 10 years ago or wants you to host your podcasts with their site and I dont need that. 
    Here is the link to the show on the iTunes website so you can see what i mean:  http://itunes.apple.com/us/podcast/your-reality-recap/id501295325
    If anybody can, would you mind checking out the code in my xml file and letting me know if you see anything thats causing this issue?
    I zipped the xml file and put it here:  http://www.ericcurto.com/podcast/YRR.zip
    I would be truly greatfuly for any help with this.  Ive been trying to fix this for days and dont know what else to do. 
    Thanks!
    Eric

    Your feed is at http://www.ericcurto.com/podcast/YourRealityRecap.xml (please always post the feed URL, not its contents or a copy).
    I don't see the issues you mention. The order in the Store and when subscribing is what I would expect:
    The order in the Store depends on clicking the header to the column: the default is the first one. Some of the dates are a day out - this is quite commmon and is probably a time zone issue (it may be different where you are - I'm in the UK). I don't know why you are seeing a garbled order unless you've clicked on one of the other columns in the Store.

  • Access XML File in JAR file

    Hi I am trying to access a XML file which is present within a JAR file. The xml file needs to be accessed from class files within the jar. The class files within the jar use the xml file as a config file.
    The jar is used by external programs during their runtime.
    Can someone help me with some info on where I can begin.
    Thanks

    DrClap, Thank you very much. It works. You certainly are a qualified Dr.
    Regards

Maybe you are looking for

  • My mid 2010 macbook pro keeps freezing/crashing every time I try and play a game. Any help?

    Every time I try and play either WoW or The Sims, my mac goes to black screen, or black screen and repeating last second of noise it was playing. I haven't upgraded to Lion and am still using Snow Leopard(??). I am by no means the most tech savvy gir

  • ASP page

    I need help in connection string for ASP. I like to connect ASP page to my oracle 9i database. I am using the following connection string but doesn't work ' Open Connection to the database set conn = Server.CreateObject("ADODB.Connection") conn.Open

  • Scaling Photos in Adobe Acrobat Professional 7.0

    Using Adobe Acrobat Professional 7.0 - Adobe Designer When creating a form: Is it possible to scale a photo within a designated box (Position Content) so that it fills the box without distorting/stretching the photo? If so, can you then move the phot

  • My photoshop quits unexpectedly after I select print

    Can someone please help. When I am on my mac, using cs5 and I select print, my photoshop quits unexpectedly. I upgraded to Yosemite this morning to see if that might help, but it still does this frustrating quit. It doesn't save anything and a very l

  • Moving/rebooting Exchange 2010 server

    So we have 2 Exchange 2010 SP3 servers- 1 east coast and 1 west  coast which are in a 2 member replicated DAG (plus one quorum node). Both are MBX/CAS/HUB servers. We need to physically move the east coast server which will require about 4 hours down