Referencing files from classpath

Hi,
I'm running a web application and need a way to reference a file from the classpath. I think I have to put a <resource-ref> in my web.xml file but I'm not positive.
Does anybody have any suggestions?

I wouldn't think you'd need anything. Just Classloader.getResource(). I certainly don't use anything else.

Similar Messages

  • Is there an API to get a fila from classpath

    hi,
    is there an API to get a fila from classpath ?

    Class.getResourceAsStream() will load a file from the CLASSPATH and return the InputStream.

  • Loading XML file from classpath...

    Hello all.
    Can anyone help me with loading an XML file from the classpath?
    The XML I need to load looks like this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <QueueDispatcher>
      <QueueConfigEntry>
        <DataSource>
          <TableName><![CDATA[WPOrder]]></TableName>
        </DataSource>
        <DataSink>
          <JMSQueueName><![CDATA[OTL_WPORDER]]></JMSQueueName>
        </DataSink>
      </QueueConfigEntry>
    </QueueDispatcher>I'm trying to load the file with the following code:
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    InputStream  input = this.getClass().getResourceAsStream("/QueueDispatcherConfig.xml");
    StreamSource streamSource = new StreamSource(input);
    Transformer  transformer  = transformerFactory.newTransformer(streamSource);
    ....All I get at the moment is an exception:
    javax.xml.transform.TransformerException: stylesheet requires attribute: version
    Any ideas what I'm doing wrong?
    Thanks in advance

    What are you doing wrong? You're using a Transformer, which expects to be given an XSLT document. If you want to make a DOM from that then you should use a DocumentBuilder, or you could use a SAXParser if you just want to extract the data from the XML file as you read it.

  • Is it possible to set up a new library that accesses referenced files from an old library AND retains all my Aperture adjustments

    I am moving files from one external hard drive to another, using the 'relocate originals' file command. This is very slow & tedious. Is there away to shortcut this? I was hoping to just set up a new library that would access the same files & folders on the new hard drive but this only results in preserving my original files, not all the Aperture data, the adjustments and metadata.
    Is there no better way than the 'relocate originals' file command?

    Just copy the library over to the new drive?

  • Referencing files from classes

    Hi All,
    could someone help me out with the correct procedure to reference a file (not a java class) from a class? In my situation I have a directory structure for a web app of the form:
    /WEB-INF/my-config.xml
    /WEB-INF/classes/datautils/AppConfig.class
    (the two WEB-INFs being the same directory obviously)
    This structure could end up in any directory, depending on the arrangement of the webserver, or in a jar file for instance. AppConfig.class and my-config.xml will always have the same relative relationship.
    I want something like:
    File file = new File(***PathToFile***);
    In the AppConfig class, the problem is that ***PathToFile*** changes depending on where the app is installed and where its run from in the server.
    Is there a way of say finding out the path of the class AppConfig.class and then using that to construct the path to my-config.xml?
    Cheers
    Matt

    Thanks guys,
    a couple of issues though - first baddar:
    There are methods in the File API to tell me where a File is once I have located a reference to it. In my case I need to know where AppConfig.class is located before I can even find the file my-config.xml and set up a File object that wraps it. So those methods don't help me.
    akalex:
    That method works fine in if I am using these classes in a web app and have a Servlet context to use. I want a technique that doesn't rely on the Servlet api preferably. That way I can use the AppConfig.class in other situations. The name AppConfig.class doesn't sound like a class that would be used elsewhere I know, but in another situation I may have a general class I would like to set its behaviour with a file and use in other applications.
    So the question remains - is there anyway I can find out the path that a class is in when running any kind of Java app - not necessarily in a container, perhaps just on a JVM as a standalone app.
    thanks chaps
    matt

  • How to move referenced files from 1 EHD to another EHD

    I have an ap lib of 100,000 images/videos stored on a gdrive 2 TB. I want to move them to a Drobo 5d and don't know how. I have my aperture library set up exactly the way i have it set up on my gdrive. Do I use 2 finder windows to drag all of my projects from the gdrive to the Drobo? If so, do I also drag the aperture library folder?     If I do this how will aperture know to look for the files on the new Drobo 5d and not the gdrive?     Or do I have to go into each individual project in aperture and relocate the originals to the new Drobo 5d? This seems like it would take forever.  What I want to accomplish is to have all of my images and the metadata, geotags, edits etc associated with these images on the new Drobo 5d.  I greatly appreciate any help on how to do this.  Thank you

    A BIG thank you for all to respond. As I am not techie at all I find this process intimdating bc I have worked so long to create large ap lib i currently have. I have spent the last week reading and re-reading many posts and tips from this site and the ap manual. I am curently running a repair of library permissions and whenever that finishes i am going to relocate my originals to the new EHD (drobo 5d).
    So, there is one thing I am confused about. I will go to photos ( 115,000)   select all    go to file, relocate masters.  Now, the scary part for me: How do I ensure that the same project structure I currently have in aperture gets "relocated" to the new EHd?  For example, in my library I have 1660 projects of which 90 percent are organized as 2013_06_07 , 2013_06_06, etc  the remaining 10 precent are by names, ex Vacation Ireland 2012. i also have various albums.  In the relocate origianls menu how do I ensure that they relocate in the same structure? I dont know which options to choose
    ? Subfolder? Custom subfolder? Name format? Custom name?
    I just want all the images to move over with all their keywords, geotages, ratings, etc and staye in the same projects they are currently in.
    I fear that you have already answered this for me and i have failed to fully understand....thank you

  • Aperture 3 doesn't see Network Drive that holds masters of referenced files

    Hi
    I created a new referenced library with about 35000 images and for the few days it worked fine. The Referenced files are located on a Drobo that is connected to My Mac OS X server. I connect to it Via AFP.
    About 2 days ago, I opened the library and the library does not see the referenced files. When I choose a file and select 'Locate referenced Files from the File menu, the locate window pops up and it shows the Drobo as being offline, even though I have mounted it, and outside of Aperture, I can access it and use it - it is definitely mounted. the "Mount" button is greyed out in the Locate referenced files window, and when I select the file using the file browser in this window, which I am able to do even though Aperture Shows the Drobo as Offline Volume Status section above, the "reconnect button remains greyed out.
    I have rebuilt the library, rebooted the server, unmounted and remounted the Drobo, and no matter what I do, it does not see the referenced files.
    Can anyone help me recoonect these files?

    I am having the exact same problem in Aperture 3.0.2. Aperture says that 529 files in a particular library are "offline" when they are on a mounted volume. The external volume on which they reside is very much ONLINE despite the fact that Aperture says it is offline.
    In fact that same volume shows up in the bottom half of the window that pops up when you select the files in Aperture and choose "Locate referenced files". I was able to successfully reconnect several thousand files by simply navigating to the files that Aperture identified as "offline" in the bottom window. But these 529 (out of a total of 4266) won't reconnect and in the bottom window the pixel dimensions for the file I'm trying to reconnect are missing. If I navigate to the files in the Finder the pixel dimensions are shown. I was able to reimport some of the so-called "offline" files on the "offline" volume. There were originally 572 that would not reconnect, and I reimported 43 of them, leaving me with 529 that should be connected, but aren't.
    Last week I spent several hours on the phone with the tech support team at Apple, but they so far have been unable to help me solve this problem. I could just reimport the files, but then would have to lift and stamp adjustments for all 529 files and get rid of the "offline" masters. One of the tech support people was going to research whether it might be possible to somehow do a "force reconnect", but hasn't gotten back to me about this.
    The external volume on which these files reside is an OWC Qx2 which is a 4.5 GB Raid 5 connected via firewire 800. In addition to being completely accessible outside of Aperture, I have run Disk Utility on it, and it verifies.
    I am hoping that Apple will come up with a fix for this problem soon.

  • How to delete referenced file on network storage

    When I try to use the "delete master image and all versions" and check the "move referenced files to trash" I get an error saying that aperture doesn't have permission to move the file to the trash. I don't understand as I am opening the network volume with read/write permissions. I can delete from the finder so I don't understand why aperture can't do the same. I need to be able to delete referenced files from Aperture. I guess I "just don't get it".

    You could relocate the master, within Aperture, to a local disk. And then delete >>it.
    Yes, but that's where it becomes a real issue. When I decide to delete an item I have to do each one manually. That's a real pain.
    What I am doing is moving new projects local until I sort them out and then move the masters to the network drive.
    It would be great if Aperture really fully supported all functions on the network store. Especially since finder can do it without difficulty.
    Thanks for your time and input.
    Fred

  • Locate referenced files for whole library?

    Hello,
    I have a referenced library (internal drive, iMac) with Masters (on an external drive). I made a back-up duplicate (finder copy) of that Masters volume, on another drive. Now I'm working from that duplicate copy of "Masters" (same name, spelling, as original "Masters", on a separate external drive).
    How do I reconnect all 60,000 referenced files (from the duplicate "Masters" drive) with my library (on the iMac). I know how to do them one file at a time from the Aperture library (File > Locate Referenced Files) but can not figure out how to reconnect everything in one or two easy clicks.
    Help!
    Thanks!
    Patrick

    Select a batch of images, and go into +Locate Referenced Files+ - just the same as doing one at a time. Match up one image from your batch with the file and then, instead of hitting the <Reconnect> button, hit the <Reconnect All> button.
    Do a small batch initial until you get the hang of it, and then make a bigger selection and go and have a cup of tea...
    Here's an [earlier description|http://discussions.apple.com/message.jspa?messageID=11334896#113348 96] I gave of this process with some background details of how I handled it first time around.
    Hope this helps.
    Regards,
    Gary

  • Aperture, Droboshare, and referenced files

    Hi, I just bought Aperture 3.0.2 as an upgrade from using iPhoto. My iPhoto setup is such that I have all my files stored on a Drobo and connected to my network via a Droboshare. I am attempting to have my Aperture Library file stored on my macbook, while creating reference files of the same photos on the Drobo.
    Now, I have no problems accessing the photo using iPhoto, but when I tried to import the same photos as referenced files in Aperture and leaving the files stored on the Drobo, it initially finds the files in the Import tool, creates thumbnails, and then proceeds to display blurry thumbnails of the pictures.
    When I double-click into the picture, it shows the image enlarged and blurry. If I select Show File in Finder, it proceeds to tell me the file cannot be found and has possibly moved, even though the file remains in the Drobo unmoved. Outside of Aperture, I can still access the file and iPhoto still has no problems seeing the image.
    In Aperture, if I select Locate Referenced Files, the bottom half of the window I can traverse the tree and I can see the file, but clicking Reconnect does not do anything.
    Does anyone have any luck setting up Aperture to use referenced files stored on a Drobo connected to the network via a Droboshare?
    Any help is appreciated.
    Thanks,
    Tim

    hmm, well i did try using referenced files directly off my machine and that seemed to work. Thing is, iPhoto is working fine with the Drobo via the Droboshare, as is my iTunes, which I also store on the Drobo as well, so I assume the problem must be Aperture which doesn't seem to like the Drobo?
    After importing a referenced file from Drobo into Aperture, I did notice a peculiarity: when I click Show in Finder in Aperture, it says the file cannot be found, and it displays the following path:
    /Volumes/DroboShare/0db090320629/LUN0/Drobo/0db090320629/LUN0/Drobo/flowers.jpg
    so I copied the following path into the Finder's Go To Folder:
    /Volumes/DroboShare/0db090320629/LUN0/Drobo/0db090320629/LUN0/Drobo
    and the Finder says the folder can't be found.
    However, I noticed the path is repeating itself after the first Drobo, so then I tried copying the following path into the Finder's Go To Folder:
    /Volumes/DroboShare/0db090320629/LUN0/Drobo
    and this works and Finder can find the folder where the image is stored. This leads me to believe there is a bug in the way Aperture is creating the referenced image path?
    Shortly after I originally posted, Apple released 3.0.3. I was really hoping this would fix the error, but I can confirm I still have the same problem after upgrading to 3.0.3.
    I'm just curious if anyone else out there is successfully using a workflow which incorporates a network attached storage for their referenced files?
    Regards,
    Tim

  • Cannot Retrieve referenced URL in wscript file from Local System Account, but not other accounts on the computer.

    Hello,
    I have a WScript File that includes an external resource (js file).
    It works on one computer and it does not work on another computer.
    If I run this file from a normal admin command prompt everything runs fine on both computers.
    If I run this file from the Local System account using PsExec it runs fine on one of the computers and throws an error "Cannot Retrieve referenced URL" on the other computer.
    The reason I want it to run from the Local System account is that it is executed from a Windows Service.
    Is there some setting or some way for the IE cache to get corrupt on the Local System account or something like that?

    JRV,
    You are by far the worst 'support' person I've ever seen. If you aren't going to be thoughtful in providing support, don't pretend. If you're going to pretend, leave your condescension on the shelf. You have provided no thoughtfulness whatsoever to his issue,
    and have in no way improved the discourse. You are arrogant and condescending without exhibiting any intelligence whatsoever. I'm impressed Matt kept calm through your demeaning, counterproductive diatribes.
    Matt,
    First I'd check UAC settings, because I believe that can change how elevation works substantially.
    Second, I would check the versions of wscript.exe on both machines, both in System32 and SysWow, and I'd check for updates bypassing WSUS to make sure there's not something silly going on there (totally a shot in the dark, catch-all theory).
    Have you made any headway in the last few weeks?
    -John
    This is not a support forum and it is not for assistance in fixing broken configurations.  It is a scripting forum. The OP proved that the issue is not the script but the environment it is running in.  You should not get mad just because you are
    not getting satisfaction.
    ¯\_(ツ)_/¯

  • Aperture referencing files to time machine HD instead of from 'working' HD

    Every once in a while I will go into a project see the "broken link" icon on my previews. In Finder I check the location I have all my images stored (and initially referenced) on an external HD. They are there.
    I go to File>>Locate Referenced Files and see the referenced images have been changed to a location on my separate Time Machine external HD. I locate them and everything is fine but it's annoying.
    I don't not have Time Machine on automatic because I have a laptop and like to choose when it backs up. I've looked through other Time Machine/Aperture problems and couldn't find anything. Does any one know of a setting, advice, or have experienced this at all?
    Thanks.

    Thanks. Sorry, for the delay to answer your questions:
    I'm the only one managing the files, and it has happened quite a few times now. The files are in multiple projects ranging from recent imports to projects from a few years ago.
    I didn't need to use "File→Relocate Master ..." just the "File→Locate Referenced Files" because my masters are still intact on my working HD. It says that my previous location was on "Volumes/Time Machine/photography/...etc." when I always import masters to "Volumes/My book/photography/...etc"
    Does Aperture notice if I move master files because my thought is that Aperture is noticing my TM copying files to another HD and then referencing those instead of my original working HD I import to. Then, the next time I open Aperture it cannot reference the Time Machine files.
    Is it because I have TM (USB) backing up my internal HD and my external working HD (FW800)?

  • Importing into Aperture 3 from iPhoto as referenced files

    Apologies if this has been asked before, but I can't find anything this topic...
    I've just upgraded to Aperture 3. In Aperture 2, my way of working was to store RAW images in iPhoto and import as referenced files into Aperture. This was very straightforward. Now, I have 2 problems:
    1 - I can't see how to import referenced images from iPhoto. If I use the import command, my iPhoto images don't show up in the list of locations to import from; if I use the iPhoto browser in Aperture and drag from that, it imports the file into the Aperture library rather than importing as a referenced file...
    2 - If I import using the iPhoto browser, not only does it import into the Aperture library, it imports the jpeg preview rather than the RAW file.
    The only way I can see to get the RAW file into Aperture is to find it in the Finder then import into the Aperture library. This seems excessively long-winded and also duplicates the file, using up extra disk space.
    I'm using Aperture 3.0.1 and iPhoto 7.1.5
    Thanks in advance for your input

    I have not imported an iPhoto library because my workflow is to to use Aperture for storing and archiving Raw files and iPhoto for exported jpegs.
    However the instruction in the Aperture 3 PDF Manual are as follows:-
    To import your iPhoto library
    Choose File > Import > iPhoto Library.
    Select the iPhoto library in the dialog that appears.
    Choose a location for the imported images by doing one of the following:
    • To store imported masters in the Aperture library: Choose “In the Aperture Library” from the Store Files pop-up menu.
    • To import the files as referenced images stored in their current location on your hard disk: Choose “In their current location” from the Store Files pop-up menu.
    Tip: Choosing“Intheircurrentlocation”isrecommended.Whenyouchoosethisoption, Aperture refers to the original files in their current location and does not have to duplicate the files, which doubles the disk space needed to store the files. For more information about referenced images, see What Are Managed Images and Referenced Images?
    • To store imported masters as referenced images in the Pictures folder on your hard disk: Choose Pictures from the Store Files pop-up menu.
    • To store imported masters as referenced images in a location other than the Pictures folder: Choose “Choose” from the Store Files pop-up menu and select a folder. Choose “No folder” from the Subfolders pop-up menu to specify that the files be stored as separate, individual files in the selected folder. You can also specify that Aperture create a hierarchy of subfolders with specific folder names to hold your files.
    =====
    This extract is from page 169. Perhaps it clarifies and identifies a step you have omitted.
    AW.

  • Importing masters from iPhoto to Aperture 3 and saving as referenced files on external drive

    I'm making the move from iPhoto to Aperture 3.I'm new to Aperture 3 and want o make sure I am importing and saving correctly. So far, I have imported my library of events from iphoto to Aperture 3. I understand that for the most part, it makes sense to house this library on an external drive as "referenced files" vs within Apeture as "managed files." I'm not clear on exactly how to accomplish this set-up. Is this something I should have set-up when doing the initial import or can I move the files now? Once this is done, when importing new files, how do I import to Aperture 3 but save on external drive?
    Thanks in advance for your help!

    A fabulous answer:
    In the olden days ( ) when hobbyists made their own telescopes from kits, everyone wanted a six-inch lens, and the kit makers shipped six-inch lens blanks.  Which the hobbyists used to learn lens grinding.  Which is arduous and requires skill.  Which the hobbyists didn't have until they'd ground that six-inch blank -- an expensive piece of high-quality material at the time -- into a lumpen flawed approximation of a good lens.  Then the hobbyists would contact the kit makers and ask for another lens-blank, so they could build their telescope.  At which point they would drop the project because the six-inch lens blank cost so much.  And much calumny was rained on the kit manufacturers.
    Now the kit manufacturers wanted to promote a hobby, and make, in addition to telescope kits, money (not calumny), so they together and separately hit upon the idea of supplying the hobbyist with _two_ lens blanks: a four-inch blank, and a six inch blank.  Nobody wanted a four-inch telescope -- but that's not what the blank was for.  The instructions read (I've shortened this part) "Grind the four-inch blank into the most perfect lens you can.  Check it and re-check it.  Now throw it out.  You likely now have the skill to grind the six-inch blank into a useable lens."
    Thus endeth our fable.
    The point, of course, is:  start small and gain skill before committing time and material to a task.  Port just a small sub-set of you photos into Aperture.  Experiment with it.  Try different workflows.  Think about how to best use the containers and organization tools Aperture provides.  Develop a long-term naming convention for files and Projects.  Work out a back-up strategy that is scalable and that you will stick with.  My specific recommendation for beginners is: don't worry about Referenced v. Managed at first.  Make all your Masters Managed.  When you have your four-inch Aperture Library all smooth and even, put the entire thing in the system trash -- and then you can start working on an Aperture Library fit for your photos -- one that will allow you to see far, and clear, for years.
    Good luck.

  • Problems "locating" referenced files after importing from iPhoto.

    I recently began importing old iPhoto libraries to Aperture, mostly successfully, but have run into a couple problems locating referenced files. While the locate referenced files function worked for most of the photos, there are a handful of photos that, when I located the original file,  the time stamp was different (by 2 hours in most cases) and it was about 15% smaller than the file Aperture was looking for. As a result, even though it was clear from the thumbnails that they were the same images, Aperture doesn't even give me the option to Reconnect them.
    Aperture 3.4.5
    OS X 10.7.5

    . I use the Reconnect All button, but it only finds the one file, even when there are hundreds more in the same folder that are unlinked.
    Reconnect all works best, if you select all files that need reconnecting at once, and then select the first file in the list to reconnect. If the other files are in the same folder and are correctly named and match, then "reconnect all" should do it. But if the filenames differ, you will have to do it one by one.
    Also,  the files are all still correctly linked in iPhoto, but every single link is broken once I import it to Aperture.
    You are importing with "File > Import > Library", correct?
    That is supposed to work. Have you tried to repair your iPhoto Library before importing to Aperture?
    Use iPhotos First Aid Tools to repair:
    Try to repair the permissions, followed by repairing the library.
    To launch the First Aid Tools,  hold down the Command and Option keys ⌥⌘ while double-clicking the iPhoto library or the iPhoto icon in the Dock.
    The iPhoto Library First Aid dialog appears.  Select the Repair option you want to use - first "permissions", then "database".
    Léonie

Maybe you are looking for

  • Browser didn't re-open last session and the drop down option is greyed out!

    I had a lot of tabs open on Firefox, I wanted to open it up and restore from last session so I could make a bookmark folder for them all and then do an update on my computer. However when I opened Firefox I didn't get the option to restore my previou

  • Need exit/badi to carry out new pricing(b) for SO coming from CRM...

    Hello Experts, We are transferring internet sales orders from CRM to R/3. Now, what I need to do is to trigger the 'carry out new pricing' for all the line items. Just like when we click the update button in the conditions tab and click on the 'carry

  • Transfer data to MacBook Pro

    Hello, So my G5 broke (3 months to repair) and I currently only have the hard drive from it. Is there anyway to transfer the data from that hard drive to my MacBook Pro? Could a Genius at the Apple store help with this? Thankful for any advice - it's

  • Loading icc profiles for printing

    HI, I am very new to Macs. I have now overcome the problems with the new printer drivers and using them with Leopard. I am using an Epson R1800 printer and want to load specific paper profiles. I have downloaded several icc files and wanted to know h

  • Oracle 9i download a full version or just trial

    Is the Oracle 9i Server software that you can download off of OTN a full or trial version? We are in the process of updating our Oracle license but need to upgrade to 9i right now. We have been told that we can not get the cd's until our license is u