The resource cannot be found in the classpath

Hi All,
I have a Java class and a PDF file in the same folder
But the PDF file is not accessible by ClassLoader.getResource(), it returns null.
What should I change to access the PDF file from within the Java class by ClassLoader#getResource() ?
Any help is really appreciated.
ReadPDF rPDF = new ReadPDF();
Class myClass = rPDF.getClass();
ClassLoader loader = myClass.getClassLoader();
URL myURL = loader.getResource("PreviewForm1210.pdf");
String path = myURL.getPath();
path = path.replaceAll("%20", " ");
// Create a PdfReader instance
PdfReader r = PdfReader.fileReader(path);
// Create a PdfDocument instance with the reader
PdfDocument d = new PdfDocument(r);
// Get page count and display on console
System.out.println("Number of pages in PreviewForm1210.pdf is " + d.getPageCount());

ReadPDF rPDF = new ReadPDF();
Class myClass = rPDF.getClass();
ClassLoader loader = myClass.getClassLoader();
URL myURL = loader.getResource("PreviewForm1210.pdf");
String path = myURL.getPath();
path = path.replaceAll("%20", " ");
// Create a PdfReader instance
PdfReader r = PdfReader.fileReader(path);
// Create a PdfDocument instance with the reader
PdfDocument d = new PdfDocument(r);
// Get page count and display on console
System.out.println("Number of pages in PreviewForm1210.pdf is " + d.getPageCount());

Similar Messages

  • Server Error in '/' Application - The resource cannot be found

    Using VS 2008 with Framework 3.5, I built a web-service that runs perfectly on the development PC.  When I build and run the web service, it runs in a virtual port as "ASP.Net Development Server Port 49259".  All the methods will
    invoke no problem.  However, if I try bring up this web-service asmx page on another PC or the mobile app that is cradled to the development PC via USB, I get: Server Error in '/' Application. The resource cannot be found.  HTTP 404... 
    This app ran just fine back in October13 but I opened for further development over the weekend and I cannot work because of this.  I have updated PC and VS with latest updates (problem before & after updates).  Using 3.5 because I am using
    Windows Mobile 5.0 Clients.  I have searched the forum universe for the solution and have found many people with this error but with other platforms.
    I am using the DefaultApplicationPool and I made sure that the local security has READ access on the web service file folders. I hope this is something simple that I am missing.
    And help - grateful!

    Hello,
    Thank you for your post.
    I am afraid that the issue is out of support range of VS General Question forum which mainly discusses
    the usage of Visual Studio IDE such as WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    If you are working with ASP.NET Web Application, I suggest that you can consult your issue on ASP.NET
    WCF, ASMX and other Web Services forum for better solution and support.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • When I try to log in to my BC account I get a message that says this"Server Error in '/' Application.  The resource cannot be found.  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its nam

    When I try to log in to my BC account I get a message that says this"Server Error in '/' Application.  The resource cannot be found.  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.   Requested URL: /Admin/Index2.aspx"
    Any ideas???

    From the Safari menu bar, select
    Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
    and confirm. Test.

  • The Resource Cannot Be Found

    feeling pretty foolish and frustrated at the moment. In CF Builder 2 I started a new project and placed it in a new directory under wwwroot.
    A very simple hello world html file will run in Builder's preview but not in a browser. Another very simple cfm file will not run in either the Builder preview or in a browser. In any case where the page doesn't load I get "The resource cannot be found" error.
    Other directories I have created off the webroot folder work fine but I don't know what is different here.
    Using IIS in Windows 7, CF 9.
    Any ideas?

    ReadPDF rPDF = new ReadPDF();
    Class myClass = rPDF.getClass();
    ClassLoader loader = myClass.getClassLoader();
    URL myURL = loader.getResource("PreviewForm1210.pdf");
    String path = myURL.getPath();
    path = path.replaceAll("%20", " ");
    // Create a PdfReader instance
    PdfReader r = PdfReader.fileReader(path);
    // Create a PdfDocument instance with the reader
    PdfDocument d = new PdfDocument(r);
    // Get page count and display on console
    System.out.println("Number of pages in PreviewForm1210.pdf is " + d.getPageCount());

  • HT201210 When I try to restore my ipod, I get a dialogue box that pops up that says the restore has failed because the requested resource cannot be found. What is the problem, and how can I fix it?

    When I try to restore my ipod, I get a dialogue box that pops up that says the restore has failed because the requested resource cannot be found. What is the problem, and how can I fix it?

    Hi IG viper,
    Placing your iPod into recovery mode should allow you to successfully restore the device.
    You might see these error messages if any of these are true:
    Your device has a beta version of iOS.
    You're trying to install an earlier version of iOS (downgrading).
    Your device has unauthorized modifications to iOS, also called "jailbreaking."
    Use recovery mode to restore your device to the latest version of iOS.
    Resolve iOS update and restore errors
    http://support.apple.com/en-us/TS3694
    Sincerely,
    Allen

  • ALSB XQuery resource cannot be found

    Hi!
    I have a problem, that for no apparent reason, my ALSB environment "crash".
    All of a sudden the Xquery resource cannot be found. You cannot export jar from resource and
    you cant do a XT transformation, because of the resources cannot be found. The typed show empty.
    This have occurred before, and I solved it by deleting my workspace and starting a new from scratch. But
    i feel that this is not the right way to solve it every time it appears. I have tried doing a clean, build and everything.
    Have some one ever got this problem, or have I missed something?
    Using Eclipse based BEA Workshop Studio version: 1.1 (build: 1090602)
    Edited by: user12665375 on 2010-feb-23 13:21

    Hi!
    Thanks for the fast reply.
    We are using the Eclipse based BEA Workshop Studio , version 1.1 (build: 10900602)
    Regards
    Afram
    Edited by: user12665375 on 2010-feb-23 13:18

  • Aqualogic WebLogic Workshop: XQuery resource cannot be found

    Hi
    I created a Proxy Service with WebLogic Workshop. I tested it without problems. After I shutdown the laptop and restarted it the references between the Proxy Service and the XQuery resources are lost. If I try to reference them WebLogic Workshop cannot find the resource even if they appear on the project.
    Any ideas?
    Regards,
    Néstor Boscán

    Hi Nestor,
    In Workshop, try to clean all the projects (Projects -> Clean all)
    Regards,
    Fabio Douek

  • The mapping: XML_NV you are trying to load cannot be found in the classpath

    Hi Experts,
    We have a EDI to JDBC scenario wherein the incoming EDI files (ANSI X12) will picked up by XI and sends to Backend system and it was working fine. Today when i check the file folder, the EDI files are not picking up by XI system and when I check the Communication channel the below is the error message. Can anybody let me know how to workaround for this issue?
    Error: javax.resource.ResourceException: --- Conversion of synchronous request from module chain ended with errors ---[Error:ID=1010;LEVEL=1] BICMapping runMapping() The mapping: XML_NV you are trying to load cannot be found in the classpath! Maybe you forgot to compile or to activate the mapping! DESCRIPTION: BICMapping Error: The mapping [not specified] you are trying to load cannot be found in the right path! Maybe you forgot to compile or to activate the mapping!
    Your help is highly appreciated.
    Regards
    Faisal

    Dear Abdul
    If the mapping is there and the PI system is throwing an error that "Mapping not Found" then please try refreshing the cache.
    First try Partial and if it does'nt work then go for Full Cache Refresh.
    Alternatively if yours is a Java mapping, try relading the code (zip file) and activate the channel.
    Sourabh

  • In ColdFusion 10 Java integration, app-context.xml cannot be found in the classpath

    I have jars and dependencies from a vendor Java library that I wanted to use in my new CF10 environment, however the Hibernate/Spring dependencies of the library conflict with those within CF10 itself.  To work around that, I had hoped to use javasettings in an Application.cfc to prioritize the library with the classloader, but the Spring classpath resolver seems to be unable to find a META-INF/spring/app-context.xml in the classpath even though it is within the jar.
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [META-INF/spring/app-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [META-INF/spring/app-context.xml] cannot be opened because it does not exist
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBean DefinitionReader.java:341)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBean DefinitionReader.java:302)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinition s(AbstractBeanDefinitionReader.java:143)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinition s(AbstractBeanDefinitionReader.java:178)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinition s(AbstractBeanDefinitionReader.java:149)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinition s(AbstractBeanDefinitionReader.java:212)
            at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(Abs tractXmlApplicationContext.java:126)
            at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(Abs tractXmlApplicationContext.java:92)
            at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFact ory(AbstractRefreshableApplicationContext.java:130)
            at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(Abs tractApplicationContext.java:467)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicatio nContext.java:397)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApp licationContext.java:139)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApp licationContext.java:83)
    Can anyone shed some light on why CF can't find this resource?
    Thanks,
    Dave

    ReadPDF rPDF = new ReadPDF();
    Class myClass = rPDF.getClass();
    ClassLoader loader = myClass.getClassLoader();
    URL myURL = loader.getResource("PreviewForm1210.pdf");
    String path = myURL.getPath();
    path = path.replaceAll("%20", " ");
    // Create a PdfReader instance
    PdfReader r = PdfReader.fileReader(path);
    // Create a PdfDocument instance with the reader
    PdfDocument d = new PdfDocument(r);
    // Get page count and display on console
    System.out.println("Number of pages in PreviewForm1210.pdf is " + d.getPageCount());

  • SBO Mailer Error - The specified resource type cannot be found in the image file

    Hi Experts,
    I have created an alert in SBO and selected email and internal option for same. I get internal message however email is not getting delivered, I checked the Event Viewer of Windows and below error is shown for SBOMail.
    The description for Event ID 62 from source SBOMail cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
    If the event originated on another computer, the display information had to be saved with the event.
    The following information was included with the event:
    Failed to mark records error [-1]
    The specified resource type cannot be found in the image file
    I can send email from sbo for other documents but the alert is not delivering email.
    Please advise.
    Thanks
    Deepak

    Hi Deepak..
    Check with these threads...
    http://scn.sap.com/thread/966957
    http://scn.sap.com/thread/1295818
    SBOMail Application log error
    SBOMail error in event log
    Hope Helpful
    Regards
    Kennedy

  • The specified resource name cannot be found in the image file.

    Dear Experts,
    I have developed an import too and it imports many of the Business Objects from a temporary data base to SAP B1. It was running fine for more than 6 months now.
    Currently when the Tool is importing Credit Notes in to SAP B1, the following error is thrown.
    The specified resource name cannot be found in the image file.
    And I have no Clue about the error. Any one had any experience regarding the above error???
    Thanks in Advance,
    Vasu Natari.

    Hello VAsu,
    Somethimes this unexpected, ununderstandable eroor messages caused by corrupted observer dll.
    Do a clean up (delete %TEMP%SM_OBS_DLL) folder, and see the result ! (i had several issues in the past with some strange messages...)
    Regards
    János

  • All website went "Not Found HTTP Error 404. The requested resource is not found." and the "Firefox cannot load websites but other programs can" page is not help

    ''dupe of https://support.mozilla.org/en-US/questions/928117''
    all website went "Not Found HTTP Error 404. The requested resource is not found." and the "Firefox cannot load websites but other programs can" page is not helping in any ways

    A possible cause is security software (firewall,anti-virus) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox and the plugin-container from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.org/kb/Server+not+found
    *https://support.mozilla.org/kb/Firewalls
    *http://kb.mozillazine.org/Error_loading_websites
    You can try to reset (power off/on) the router.

  • Cannot Connect to the iTunes Store. Request Resource was not found

    I hope you can help me.
    I get the following error when trying to connect to the iTunes store.
    iTunes could not connect to the iTunes store, the requested resource was not found.
    I am running Norton Internet security and have allowed all permissions for iTunes.
    Following is the diagnostics log:
    Thanks,
    Microsoft Windows XP Professional Service Pack 2 (Build 2600)
    Dell Inc. Latitude D820
    iTunes 7.1.1.5
    Current user is an administrator.
    Network Adapter Information
    Adapter Name: {21F2991F-5976-4BE0-8031-064BC7AC9AF0}
    Description: Intel(R) PRO/Wireless 3945ABG Network Connection - Minipuerto del administrador de paquetes
    IP Address: 192.168.2.26
    Subnet Mask: 255.255.255.0
    Default Gateway: 192.168.2.200
    DHCP Enabled: No
    DNS Servers: 192.168.2.25
    168.243.165.225
    Adapter Name: {CB99A2BD-1A04-482A-BC5C-53E5597BA70B}
    Description: Broadcom NetXtreme 57xx Gigabit Controller - Minipuerto del administrador de paquetes
    IP Address: 0.0.0.0
    Subnet Mask: 0.0.0.0
    Default Gateway:
    DHCP Enabled: Yes
    DHCP Server: 192.168.0.1
    Lease Obtained: Mon Feb 12 11:09:06 2007
    Lease Expires: Tue Feb 13 11:09:06 2007
    DNS Servers: 192.168.2.25
    168.243.165.225
    Network Connection Information
    Active Connection: Conexión LAN
    Connected: Yes
    Online: Yes
    Using Modem: No
    Using LAN: Yes
    Using Proxy: No
    SSL 3.0 Support: Enabled
    TLS 1.0 Support: Enabled
    Firewall Information
    Windows Firewall is off.
    Connection attempt to Apple web site was successful.
    Connection attempt to iTunes Store was successful.
    Secure connection attempt to iTunes Store was unsuccessful.
    A secure network connection could not be established.

    Has anyone actually tried this suggestion posted by jeffporfiro's. He seems to be posting in any topic related to iTunes Store connection probs.
    Is there any credibility to his suggestion? (below)
    <<jeffporfirio wrote:
    Solution is as follows:
    Goto your C:\WINDOWS\system32\drivers
    find a file named “hosts”, mine was located in a directory named “etc” under the “drivers” directory, rename the file, to something other than its name (eg. rem-old.host) and done ! >>

  • The description for Event ID 0 from source VSTTExecution cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

    Hi,
    Can any one help me on the below issue ?
    while executing automated test case in test center it is showing as test case is in progress, then i navigated to virtual machine (where the test agent is online), there Internet
    explore has opened automatically and my test case execution started, but with in a seconds IE has closed . However, in test center, test case status is showing as in
    progress, after  2 or 3 min  some of  test cases getting passed and some are failed.
    Here my question is in lab center-->virtual machine, IE has opened automatically and navigated the 2 or 3  links and with in seconds IE has getting closed. Why IE is getting closed without completing execution?
    Error Message :
    The description for Event ID 0 from source VSTTExecution cannot be found. Either the component that raises this event is not installed on your local computer or the
    installation is corrupted. You can install or repair the component on the local computer.
    If the event originated on another computer, the display information had to be saved with the event.
    The following information was included with the event: 
    (mtm.exe, PID 5240, Thread 4) FileAggregatorSessionInfo: Error occurred while deleting temporary directoryException: System.IO.DirectoryNotFoundException: Could not find a part of the path 
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
       at Microsoft.VisualStudio.TestTools.Execution.Aggregation.FileAggregator.FileAggregatorSessionInfo.DeleteTemporaryDirectory(String temporaryDirectory)
    the message resource is present but the message is not found in the string/message table
    Thanks
    Suresh
    Suresh

    Hi,
    Can any one help me on the below issue ?
    while executing automated test case in test center it is showing as test case is in progress, then i navigated to virtual machine (where the test agent is online), there Internet
    explore has opened automatically and my test case execution started, but with in a seconds IE has closed . However, in test center, test case status is showing as in
    progress, after  2 or 3 min  some of  test cases getting passed and some are failed.
    Here my question is in lab center-->virtual machine, IE has opened automatically and navigated the 2 or 3  links and with in seconds IE has getting closed. Why IE is getting closed without completing execution?
    Error Message :
    The description for Event ID 0
    from source VSTTExecution cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
    If the event originated on another computer, the display information had to be saved with the event.
    The following information was included with the event: 
    (mtm.exe, PID 5240, Thread 4) FileAggregatorSessionInfo: Error occurred while deleting temporary directoryException: System.IO.DirectoryNotFoundException:
    Could not find a part of the path 
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
       at Microsoft.VisualStudio.TestTools.Execution.Aggregation.FileAggregator.FileAggregatorSessionInfo.DeleteTemporaryDirectory(String
    temporaryDirectory)
    the message resource is present but the message is not found in the string/message table
    We are using VS 2013 (premium) and IE 10.0,  scripts have been created on the same versions. It is working fine  on
    developers command prompt but the same tests are getting failed in lab center test agent machine
    test agent log:
    QTAgentService.exe, AgentService: calling AgentObject.RunEndFileCopyComplete
    QTAgentService.exe, AgentProcessManager.WaitForDataCollectionAgentProcessToStart: waiting for agents to start.
    QTAgentService.exe, AgentProcessManager.WaitForDataCollectionAgentProcessToStart: Agents started.
    QTAgentService.exe, AgentProcessManager.PerformActionIgnoringExceptions: Successfully called 'Cleanup' on the test agent
    QTAgentService.exe, AgentProcessManager.PerformActionIgnoringExceptions: Calling 'StopDataCollection(int)' on the data collection agent
    QTAgentService.exe, AgentProcessManager.IsDataCollectionAgentNeeded: IsExecutedOutOfProc? True
    QTAgentService.exe, AgentPro
    QTAgentService.exe, AgentProcessManager.WaitForDataCollectionAgentProcessToStart: Agents started.
    QTAgentService.exe, AgentService: Connection to controller is up.
    Thanks
    Suresh

  • The description for Event ID 8306 from source Microsoft-SharePoint Products-SharePoint Foundation cannot be found

    hi,
    can anyone please help me with the following:
    The description for Event ID 8306 from source Microsoft-SharePoint Products-SharePoint Foundation cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair
    the component on the local computer.
    If the event originated on another computer, the display information had to be saved with the event.
    The following information was included with the event:
    The HTTP service located at http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc/actas is too busy.
    The publisher has been disabled and its resource is not avaiable. This usually occurs when the publisher is in the process of being uninstalled or upgraded
    _________________________________________________________ Fahad Khan

    Hi,
    Please try the following steps to troubleshoot your issue:
    1.      
    You can try to re-run SharePoint 2010 products configuration wizard to see any problems that still exist.
    2.      
    Go to IIS and see the status of SecurityTokenServiceApplicationPool service, whether it is stopped or not, restart the pool.
    3.      
    Go to manage web application services, review the status of Security Token Service application , try to restart.
    4.      
    In Central Administration>Security>Configure Service Account>Change the service account for the Security Token Service application to some other managed account.
    5.      
    If the issue persists, try the resolution in this blog:
    http://blogs.msdn.com/b/sowmyancs/archive/2010/07/16/sharepoint-2010-service-applications-bcs-metadata-access-service-are-not-working.aspx
    Let me know the result.
    Xue-Mei Chang

Maybe you are looking for

  • Blank black screen with just mouse pointer after logging in windows 8.1

    First of all On starting the system, it was taking much longer time than usual.. Then after logging in it showed only a blank black screen with white mouse pointer.. had to force shut down (shut down also took longer time).. on starting went to safe

  • Can you mainpulate excel graphs in Indesign?

    We are transitioning our reports from excel to INdeisgn. We have some simple line graphs created from a series of numbers in Excel. What I'd like to be able to do is place them in Indesign, then apply similar font and colours so it matches the rest o

  • Iphone 4 and new music

    I have an iPhone 4. A lot of the new music I recently purchased that fades in and out in volume. I have push turned off. Notifications off. All apps off. music fades, brand new earbuds, apple earbuds, plugged all the way in. Hard restart. What else. 

  • Configration of personnel adminstration

    Hi gurus, i want to know how to configure personnel administration and how to do integration between oragnisational management and personal administration. preeti chopra.

  • Problem Using Recovery Disks!

    Hi, I have a Hp Pavilion m6-1045dx machine. It came with windows 7 pre installed. the first thing i did was to create the set of recovery disks, so it created a set of 5 dvds recovery disks. the system was going good. I cleaned out my harddrive and i