JDOM "IllegalStateException: Root element not set" when reading file

Hello, I am relatively new to XML. I am trying to read an xml document to parse some information out of it. I basically have a large amount of data I want to load into my program. I could program it all in as static arrays, but I thought xml would be easier, and make changes easier.
I am trying to use JDOM, and have the project set up. My problem is when I read the document, it always gives a root element not set exception. Here is my xml file:
<?xml version="1.0" encoding="UTF-8"?>
<root>
    Contents
</root>Very basic, I'm using this to get things started. Here is my code for reading it:
        SAXBuilder sb = new SAXBuilder();
        Document d = new Document();
        try {
            sb.build(new File("test1.xml"));
        catch (JDOMException jdome) {
            System.err.println(jdome);
        catch (IOException ioe) {
            System.err.println(ioe);
        d.getContent();Whenever I try to do anything with the contents of the Document, like d.getContent(), it always throws a java.lang.IllegalStateException: Root element not set. It reads the file successfully (as far as I can tell), but it's like the xml file is empty. I can't find anything on the web about this problem, and every tutorial says to do exactly what I've done, but never mention any possible problem. It can find the file, and I can write to an xml file as in other tutorials, but reading one in is a problem.
I chose JDOM because it seemed simplest for just reading in a large amount of data and parsing it out into variables. This is a very simple project, so I don't want to spend a lot of time writing xml parsing code, I'm only using xml because it will probably be easier than hard coding the data. Would a different xml api be easier to use for my purposes?
Message was edited by:
hunter9000

You must always give the browser an either an absolute URL from the top of
          the web server (not the
          web application) or a relative path from the current page.
          Sam
          "Vijay Kumar" <[email protected]> wrote in message
          news:[email protected]..
          > Hi
          >
          > I get the 'getResource is called when document root is not set.' error
          > when I access any files in the webapp with their absolute path.
          >
          > Environment: WIN/NT SP3, WL5.1 SP5 as the webserver and app server.
          >
          > My webapp located in d:\temp is deployed as foo
          > weblogic.httpd.webApp.foo=d:/temp
          >
          > For example:
          > I can access a file in d:\temp\secured\home.html using
          > test
          >
          > However if with in an html I try to access the file using the abs path
          > from doc root
          > test I get an error
          >
          > and I guess the default servlet looks for the servlet-context named
          > 'secured'
          >
          > Can someone tell me if I can set the documentRoot in the web.xml or
          > weblogic.xml
          > file OR if there is any other way to access to the file using the abs path
          > of /secured/test/test.html
          >
          >
          > Thanks in advance
          >
          > Vijay
          >
          >
          >
          >
          

Similar Messages

  • GetResource is called when document root is not set

    hi,
    During redeploy of a small application i get the following error
    [runjava] <Oct 17, 2005 12:40:26 AM PDT> <Alert> <HTTP> <BEA-101043> <[ServletContext(id=616697,name=rsbservice,context-pat
    h=/rsbservice)] getResource is called when document root is not set.>
    [runjava] <Oct 17, 2005 12:40:26 AM PDT> <Alert> <HTTP> <BEA-101043> <[ServletContext(id=616697,name=rsbservice,context-pat
    h=/rsbservice)] getResource is called when document root is not set.>
    Can someone help me find what would have gone wrong in my application?
    NOTE: this error does not occur when i try to start my application for the first time.

    You must always give the browser an either an absolute URL from the top of
              the web server (not the
              web application) or a relative path from the current page.
              Sam
              "Vijay Kumar" <[email protected]> wrote in message
              news:[email protected]..
              > Hi
              >
              > I get the 'getResource is called when document root is not set.' error
              > when I access any files in the webapp with their absolute path.
              >
              > Environment: WIN/NT SP3, WL5.1 SP5 as the webserver and app server.
              >
              > My webapp located in d:\temp is deployed as foo
              > weblogic.httpd.webApp.foo=d:/temp
              >
              > For example:
              > I can access a file in d:\temp\secured\home.html using
              > test
              >
              > However if with in an html I try to access the file using the abs path
              > from doc root
              > test I get an error
              >
              > and I guess the default servlet looks for the servlet-context named
              > 'secured'
              >
              > Can someone tell me if I can set the documentRoot in the web.xml or
              > weblogic.xml
              > file OR if there is any other way to access to the file using the abs path
              > of /secured/test/test.html
              >
              >
              > Thanks in advance
              >
              > Vijay
              >
              >
              >
              >
              

  • Getting error "Object variable or with block variable not set" when trying to open a FR report in studio

    Problem Description
    We are on FR 11.1.2.2.305 installed on AIX. a user is getting this error: "Object variable or with block variable not set" when trying to open a FR report from FR studio client installed on windows xp . Initialy, we thought it may be a FR client installion issue. We uninstalled and cleaned up registry and did a fresh installation of the client but the issue still persists. The FR server and the client are on the same version.
    The user is a LDAP user who is facing the issue. We have confirmed with other users and they dont have any issue accessing FR report from their own client but when they try to connect from the users machine who is having issues, the others users also see the above error. All the users are ldap users and all belong to same shared services groups so the provisiong is the same.
    Any input will be appreciated.
    Thanks

    OK, in this case of one single computer, please make sure that settings as per below KB document as in place and then validate the issue:
    Internet Explorer (IE7, IE8, IE9 and IE10) Recommended Settings for Oracle Hyperion Products (Doc ID 820892.1)
    The information in this document applies to the following Enterprise Performance Management products:
        Calculation Manager
        Data Relationship Management (DRM)
        Enterprise Performance Management Architect (EPMA)
        EPM Workspace
        Essbase Administration Services (EAS)
        Financial Data Quality Management (FDM)
        Financial Management (HFM)
        Financial Reporting
        Foundation Services
        Interactive Reporting
        Planning
        Shared Services
        Web Analysis
    Thanks!

  • ExternalInterface not working when swf file is embed inside a dynamically cloned DIV element.

    ExternalInterface not working when swf file is embed inside a dynamically cloned DIV element.
    It seems that flash movie is identifed as 'undefined' inside document.
    //a statically placed div
    var staticdiv=document.getElementById('PropDiv');
    //dynamically placed div with object tag
    var dynDiv =staticdiv.cloneNode( true );
    var xD=50;
    var yD=50;
    if(dynDiv)
    dynDiv.style.display  = "block";
    dynDiv.innerHTML="<object classid=" + "\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"" + "codebase=" +
    "\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"" + "width=" + xD + "height=" + yD +
    "id=" + "\"external\"" + "align=" + "\"middle\"" + ">" +
                    "<param name=" + "\"allowScriptAccess\"" + "value=" + "\"sameDomain\"" + "/>" +
                    "<param name=" + "\"movie\"" + "value=" + "\"external.swf\"" + "/>" +
                    "<param name=" + "\"quality\"" + "value=" + "\"high\"" + "/>" +
                    "<param name=" + "\"wmode\"" + "value=" + "\"transparent\"" + "/>" +
                    "<param name=" + "\"bgcolor\"" + "value=" + "\"#ffffff\"" + "/>" +
                    "<embed src=" + "\"external.swf\"" + "quality=" + "\"high\"" + "wmode=" + "\"transparent\"" +"bgcolor=" + "\"#ffffff\""
    + "width=" + xD + "height=" + yD + "name=" + "\"external\"" + "align=" + "\"middle\"" + "allowScriptAccess=" + "\"sameDomain\"" +
    "type=" + "\"application/x-shockwave-flash\"" + "pluginspage=" + "\"http://www.macromedia.com/go/getflashplayer\"" + "/>" +
                    "</object>";
       dynDiv.style.top=50;
       dynDiv.style.left=100;
    document.body.appendChild(dynDiv);
    In above situation communication is not establised when a  funtion which is retruning boolean is called from flash using
    ExternalInterfcae.call.The return value of this function is getting as false inside flash.But the value is true in javascript.
    if (navigator.appName.indexOf("Microsoft") != -1) {
       return window[movieName];
      } else {
       return document[movieName];
    window["external"] is returning as 'undefined'.
    Please give a  solution to solve this.

    Note that you have different file names for the object (images/banner.swf) and the embed (images/banner1.swf)
    You also placed the embed in the middle of a param tag and nested all param tags.
    Because you didn't include a MIME type and the object doesn't have a classid for an ActiveX control for IE, I'm not sure what Firefox will be using.<br />
    The object doesn't have a data attribute to specify the file.<br />
    A separate embed is only needed when you specify a classid in the object.
    <pre><nowiki><div class="bannercontainer">
    <object width="940" height="445" type="application/x-shockwave-flash" data="images/banner.swf" >
    <param name="wmode" value="transparent" />
    <param name="movie" value="images/banner.swf" />
    </object>
    </div></nowiki></pre>

  • Finder does not open when a file passes over (mac os X 10.8.3)

    Just installed mac os 10.8.3 mountain lion. As such, it seems with this OS X version the "finder" does not open when a file passes over (in order to move it from desktop).
    The screen dims a little and nothing else happens.
    How can I recover the "finder" functionality that apparently doesn not exist anymore?
    Is it something wrong that I am doing?
    Regards
    José

    Back up all data. Don't continue unless you're sure you can restore from a backup, even if you're unable to log in.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Enter the following command in the Terminal window in the same way as before (triple-click, copy, and paste):
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    This time you'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1 or if it doesn't solve the problem.
    Boot into Recovery. When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not  going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • Element not found when trying to change url for httpstunnel

    We use DirectAccess 2012 and Windows 7 is able connect via DirectAccess
    Netsh dns show state
    shows me that I have httpstunnel adapter with a url 
    According to the following article I should be able to change that url of the httpstunnel which we use for DirectAccess
    https://technet.microsoft.com/en-us/library/dd941590%28v=ws.10%29.aspx#BKMK_4
    However, when I use the following command 
    netsh interface httpstunnel set interface https://something.com:443/IPHTTPS none
    I get the error "Element not found"
    What am I doing wrong here?

    Hi Mister lks,
    Regarding to your question, I’d suggest that we post at Direct Access, UAG and IAG forum. There you can get more effective suggestion by other experts who familiar with Direct Access. Your understanding is highly appreciated.
    https://social.technet.microsoft.com/Forums/forefront/en-US/home?forum=forefrontedgeiag
    Regards,
    D. Wu
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • JAVA_HOME not set when running a task via CRON

    On my Solaris 11 server I have created an entry in the root user CRON tab to launch a groovy based application every weekend. The application runs fine under a non-root user. When run by CRON however, the following error message gets emited:
    groovy: JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME
    Which is weird, as I have the following lines at the end of my /etc/profile file:
    JAVA_HOME=/usr/jdk/instances/jdk1.7.0
    export JAVA_HOME
    GROOVY_HOME=/usr/local/bin/groovy-2.1.3
    export GROOVY_HOME
    PATH=${PATH}:${GROOVY_HOME}/bin:${JAVA_HOME}/bin
    export PATH
    Please advice me where to look for the cause of this problem.
    Thank you in advance,
    Dusan

    I have the following command
          /usr/local/bin/groovy-2.1.3/bin/groovy /usr/local/bin/backup/prune_old_backups.groovy
    How do I add the JAVA_HOME variable into it?
    Thank you,
    Dusan

  • Error: object variable or with block variable not set when creating journal

    Hello
    When I try to create a new journal, I get an error "object variable or with block variable not set"
    This is happening with some computers but not all of them, the same user can create a journal in some computers.
    I tried uninstalling and reinstalling BPC office client but that did not work.
    Do you have any other ideas ?
    Thank you in advance.

    Hi,
       You have to check first  if you are able to access the reporting service frm that speific client machine typing:
    http://<reporting server name>/reports. If all is woking well , you have to check also the number of default sheets for an empty excel sheet (should be 3) - I ma not sure what version are you using.
        If still not work, please let me know when exactly the error appear, when you try to open the template (clicking on journal option) or after when you fill the report, save it, so on.
    Best regards,
    Mihaela

  • How to set ascential status "not aborted" when no file is present

    Hi gurus,
    Can anyone advise how can i set up the job in ascential to by pass the abort status whenever i have no file in place.  Normally what happened is, the job is triggered everyday and when a file has missed to maintain in the defined directory, it gets aborted.  What the requirement is to set to not aborted status so that when the next run in BW is triggered, we dont need to go to admin to reset the job every so often..
    Thansk..

    Hi there,
    why don't you just add the following lines into your coding, at the stage where the file is selected?
    IF.
    sy-subrc <> 0.
    EXIT.
    ENDIF.
    In case you don't have developing authorization just get anybody who can do this for you.
    Kind regards
    Klaus

  • Photoshop Elements 11 - Video format not supported when importing files

    I'm trying to make a gif using Photoshop Elements 11, but I can't seem to be able to find a video format to import that's supported. I go to File > Import > Frame from Video... then choose Browse and select the video I want, but it always tells me that video format is not supported - I've tried AVI, MPEG, MP4 and some others, and none seem to work. Any idea why?

    umaniak
    Do you have Premiere Elements 11 as well as Photoshop Elements 11?
    How are you importing your video into Premiere Elements 11 (assumed Windows)? Add Media/Files and Folders/Project Assets? Or are you moving it from the Elements Organizer into the Premiere Elements 11 Expert workspace? Does the video play back OK on any of your computer players (Premiere Elements not involved)?
    Bottom line may very well be a problem with the availability of the MotionJPEG video codec to Premiere Elements.
    The 3 remedies that one frequently sees:
    a. file conversion
    b. download, install of MotionJPEG codec
    c. grabbing appropriate codec from a camera utility if the camera has such a utility.
    Please review and let us know if you have any further questions.
    Thanks.
    ATR
    Add On...I did not see SG post in your thread until after I had posted this reply. Please respond in to his questions and troubleshooting first.

  • Element not found when duplicating "Basic EFS" template

    I've been trying to duplicate the Basic EFS template as either a Windows 2003 or 2008
    template and everytime I use the new template via GPO to encrypt (EFS) any files/folder, I keep getting the "Element Not Found" error.  I've looked all over event logs and can not find any errors that will point me in the right direction to
    troubleshoot this issue.  I noticed it will only work if I use the Basic EFS template.  I've Google and have found several forum posts that states to duplicate the Basic EFS template as a Windows 2003 template to fix this problem, but I'm still getting
    the same error.  Any help is appreciated.  
    Thank you.

    Does it also fail if you start from a fresh user profile (no previous attempts to encrypt or enrol for certificates using any template)? This is to rule out any effects of caching anything, such thumbprints of EFS certificates used before
    in the registry.
    I would in particular repeat a test with a fresh profile and a W2K3 template after AD replication and GPO refresh has been done - I still think the most likely explanation is still that the client actually tried to use a W2K8 template which
    was still cached.
    After you created the W2K3 template - did you make any changes to the CSP / cryptography after you had copied Basic EFS? Which provider do you use - I guess it should be Enhanced or Strong provider?
    Otherwise, I would probably compare all Object Access events for Basic EFS and for the other templates, and look for things like failed attempts to access key files. If there is nothing promising there, rather use
    Process Monitor (Sysinternals) to compare "good" and "bad" encryption.
    I admit that these tools are quite overwhelming and require some practice but I think I have exhausted all other ideas.
    Elke

  • Size Property of OracleParameter is not set when used in constructor

    Hi
    I have an issue in using OracleParameter in my .net windows app(vb.net) . If I create a OracleParameter like this, ths size property is not set
    Dim opParam As New OracleParameter("v_Test", OracleDbType.Char, 120, ParameterDirection.Output)
    'Here 120 is the size I have set, but it is not getting assigned to the Size property
    MsgBox(opParam.Size) 'This will return 0
    'I have to assign like this explicitly to have the size property set.
    opParam .Size=120
    Is it a problem in ODP.Net or I am doing something stupid ?.
    Any answers would be greatly appreciated
    Cheers
    John

    Hi John,
    In looking at the constructor call you have this "format":
    string, OracleDbType, int, ParameterDirection
    This does not match to a constructor that does what you want. What it matches to is:
    string, OracleDbType, object, ParameterDirection (i.e. the value (object) is being set where it looks like you want to set the size).
    The closest matching constructor for what you want would be:
    string, OracleDbType, int, object, ParameterDirection
    i.e.
    Dim opParam As New OracleParameter("v_Test", OracleDbType.Char, 120, null, ParameterDirection.Output)Hope that helps a bit (assuming I have not misread, etc...)
    - Mark

  • Some CGM graphics do not appear when FrameMaker files are converted to PDF

    CGM files are exported from ISO (Arbortext Isodraw 7.0 CadProcess) files. Then they are imported into Adobe FrameMaker 7.2, where all elements of the illustration are visible and can be printed. The FrameMaker FM file is converted to a PDF file using the Adobe PDF converter function of Frame. When the PDF file is opened by Adobe Acrobat 8,0 Professional, some, but not all of the illustrations in the file exhibit this problem (The callouts and other text may appear, but the lines, curves, etc. do not). The illustration prints the same way it appears on the screen. When exporting the ISO file as a CGM, the following selections are made.
    When importing file into Frame, "Import by Reference" is selected.
    When creating PDF in Frame, the following selections are made.
    Any Suggestions would be greatly appreciated. Thanks very much.

    Thanks, Michael.
    I will give it a try.
    Avox Systems Web Site: http://www.avoxsys.com
    AVOX SYSTEMS
    AIRCRAFT SYSTEMS
    Rick Barusic
    Senior Technical Writer
    225 Erie Street - Lancaster, NY 14086 - USA
    Tel: 716-686-1706
    [email protected]
    http://www.zodiacaerospace.com
    The information transmitted is intended only for the person or entity to
    which it is addressed and may contain confidential and/or privileged
    material. Any review, retransmission, dissemination, or other use of or
    taking any action in reliance upon this information by persons or entities
    other than the intended recipient is prohibited. If you received this in
    error, please contact the sender and delete the material from any
    computer.
    From:   MichaelKazlow <[email protected]>
    To:     rick barusic <[email protected]>
    Date:   11/24/2010 10:32 PM
    Subject:        Some CGM graphics do not appear when
    FrameMakerfiles are converted to PDF
    First you should update to the latest version of Acrobat 8, since you say
    you are running Acrobat 8, you should update to 8.2.5. Update your
    FrameMaker to 7.2p158. Those two steps might do the trick. If that fails
    try using a different settings file. Perhaps High Quality or Press
    Quality. I would never use Standard for anything where fidelity is
    important.

  • I really need to go back to the save I made a day ago, my time machine is not set up and files haven't been automatically uploading to cc is there anyway I can go back a day in saves?

    Hi, I just had an issue with a photoshop document, my mac book temporarily crashed the screen glitches and deleted some vital layers I had constructed (took half a day) I thought I could correct it and saved it a few times in a panic and now i really need to go back to the save I made a day ago, my time machine is not set up and I just realised my files haven't been automatically uploading to cc is there anyway I can go back a day in saves?

    Trevor.Dennis wrote:
    So you don't have anything like Shadow Protect running in the background?
    Video editing software only needs to save the steps taken to achieve the edit, and references the actual video files from the hard drive.  So the saved files are only tiny, and it takes very little drive space to auto save to incrementing file names.  Obviously, Photoshop files can be huge by comparison, so the only way to save with a different file name is to do it manually.
    I think most regular posters to this forum make a point of updating the file name of a large project every hour or so, and as a direct response to reading so many horror stories like your own.  The worst story I remember was from a poster whose computer had crashed half way through saving a large PSD file.  After several response, questions and answers, it turned out he was using a laptop with a failing battery.  He told us that he could see the battery was getting low, but left it and left it before finally hitting Ctrl s and running off to find the laptop's power lead. When he got back the laptop had run out of power and shut down, and his PSD file was lost forever.  He may have been a prime candidate to a computing Darwin Award, but his stupidity still did the rest of us a service so we could learn from his mistake.
    Ouch. 
    My digital audio workstation works on the same principle; it creates a backup save just in case things go wrong (which--knock on wood--hasn't happened to me) and only references audio/MIDI files that are related to the project.
    My advice is to always, always back up sensitive documents. There are lots of ways of doing this, from manually to automatically. (e.g., A lot of higher-end routers let you connect external storage via USB so you can run backup software that detects any changes to a monitored folder over a network and then backs up any changed/updated documents to the connected storage. I prefer to do it myself manually, though.)

  • Why is the label color not changing when my file is updated?

    I would like the label color to change to white when a file has been updated/changed. Since upgrading to 10.7.2 the file color stays the same. Is there a setting I am missing that will allow the file to go back to white when updated?
    Thanks for any input...

    As far as I know, this is not standard functionality in the Mac OS.  Granted this, some third party application, or a script of something, was making this happen for you. Somehow the system update broke it. If you can figure out what software was giving you this feature, maybe you can update it or re-install it.
    charlie

Maybe you are looking for