Error getting of canonical path of a file on the Glassfish Server

Hello

I'm on jdev 11.1.2.4 and glassfish server 3.1.2.

I want to get the CanonicalPath of an image file in ViewController/public_html/images/company_logo.png

I use method below to get the path.


 public static String getCompanyLogoFilePath(){
        String filePath="C:\\company_logo.png"; // default value
        URL url;
        try {
            url = FacesContext.getCurrentInstance().getExternalContext().getResource("/images/company_logo.png");
            File file = new File(url.toURI());
            //System.out.println("getCanonicalPath:"+file.getCanonicalPath());
            filePath = file.getCanonicalPath(); 
            System.out.println("filePath: "+filePath);
                
            
        } catch (MalformedURLException e) {
        } catch (URISyntaxException e) {
        } catch (IOException e) {
        }
        return filePath;
    }

This method works very well on the integrated weblogic server. However, when I deploy my application on a glassfish server, it throws the following error

State of the TTP 500-


type of Exception report

Message

Description The server encountered an internal error () that prevents to satisfy this demand.

exception

javax.servlet.ServletException: /reportPages/Letter.jsf @91,109 action="#{backingBeanScope.LetterBean.cbRun_action}": java.lang.IllegalArgumentException: URI scheme is not "file"

first cause

javax.faces.el.EvaluationException: /reportPages/Letter.jsf @91,109 action="#{backingBeanScope.LetterBean.cbRun_action}": java.lang.IllegalArgumentException: URI scheme is not "file"

first cause

java.lang.IllegalArgumentException: URI scheme is not "file"

Note The complete exception stack traces and its root causes are available in GlassFish Server Open Source Edition newspapers 3.1.2.2


GlassFish Server Open Source Edition 3.1.2.2

any ideas?

Thank you

When you want to get real (absolute) path to a file within the context of the web, you pass 'virtual' path of this resource (from the root of context) to ServletContext.getRealPath () method.

("Something like: FacesContext.getCurrentInstance().getExternalContext().getRealPath("/images/company_logo.png ");

Note this virtual path always use ' / ' separator (irrespective of the platform)

In addition, on some servers, getRealPath() does not by default if you need to activate this: java - getServletContext ().getRealPath("") returns null in WebLogic - Stack Overflow

Dario

Tags: Java

Similar Questions

  • reading a file from the ftp server

    Hello
    I am able to put the file on the ftp server using the ftp adapter. But the same settings only work not then vote file on ftp.
    Do I have to do some settings for the get operation?

    Hello

    Check the file permissions and to test give all reading/writing/execution permissions to the file to read of FTP. Also, check the file modification date.

    Check the logs at 2 places for error messages:
    -Diagnostics of SOA server logs
    -The FTP Server Logs

    You can also activate the level the END of newspapers of the adapter for the cards and see the errors in the diagnostic logs.
    FMW Console > right-click soa-infra > newspapers > Journal Configuration > expand oracle.soa > define Trace32: BEST for oracle.soa.adapter

    Kind regards
    Neeraj Sehgal

  • Layout error while deploying the application on the glassfish server. Any body can help?

    Mr President.

    Layout error while deploying the application on the glassfish server. Any body can help?

    The server log is

    [2015-06-05T12:05:15.646+0500] [glassfish 4.1] [WARNING] [NCLS-DEPLOYMENT-00023] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487915646] [levelValue: 900] [[
      Ignoring AshCMS_ViewController_webapp_war/ because the containing archive C:\glassfish4\glassfish\domains\domain1\applications\AshCMS_Project1_AshCMS recorded it as a pre-existing stale file]]
    
    
    [2015-06-05T12:05:15.646+0500] [glassfish 4.1] [WARNING] [] [javax.enterprise.system.tools.deployment.javaeefull] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487915646] [levelValue: 900] [[
      Exception while locating sub archive: AshCMS_ViewController_webapp.war]]
    
    
    [2015-06-05T12:05:15.706+0500] [glassfish 4.1] [WARNING] [NCLS-DEPLOYMENT-00023] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=88 _ThreadName=deployment-jar-scanner] [timeMillis: 1433487915706] [levelValue: 900] [[
      Ignoring AshCMS_ViewController_webapp_war/ because the containing archive C:\glassfish4\glassfish\domains\domain1\applications\AshCMS_Project1_AshCMS recorded it as a pre-existing stale file]]
    
    
    [2015-06-05T12:05:17.484+0500] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487917484] [levelValue: 800] [[
      visiting unvisited references]]
    
    
    [2015-06-05T12:05:23.074+0500] [glassfish 4.1] [WARNING] [NCLS-DEPLOYMENT-00023] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487923074] [levelValue: 900] [[
      Ignoring AshCMS_ViewController_webapp_war/ because the containing archive C:\glassfish4\glassfish\domains\domain1\applications\AshCMS_Project1_AshCMS recorded it as a pre-existing stale file]]
    
    
    [2015-06-05T12:05:23.074+0500] [glassfish 4.1] [WARNING] [NCLS-DEPLOYMENT-00023] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487923074] [levelValue: 900] [[
      Ignoring AshCMS_ViewController_webapp_war/ because the containing archive C:\glassfish4\glassfish\domains\domain1\applications\AshCMS_Project1_AshCMS recorded it as a pre-existing stale file]]
    
    
    [2015-06-05T12:05:23.784+0500] [glassfish 4.1] [WARNING] [NCLS-DEPLOYMENT-00023] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487923784] [levelValue: 900] [[
      Ignoring AshCMS_ViewController_webapp_war/ because the containing archive C:\glassfish4\glassfish\domains\domain1\applications\AshCMS_Project1_AshCMS recorded it as a pre-existing stale file]]
    
    
    [2015-06-05T12:05:23.804+0500] [glassfish 4.1] [WARNING] [NCLS-DEPLOYMENT-00023] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487923804] [levelValue: 900] [[
      Ignoring AshCMS_ViewController_webapp_war/ because the containing archive C:\glassfish4\glassfish\domains\domain1\applications\AshCMS_Project1_AshCMS recorded it as a pre-existing stale file]]
    
    
    [2015-06-05T12:05:23.804+0500] [glassfish 4.1] [WARNING] [NCLS-DEPLOYMENT-00023] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487923804] [levelValue: 900] [[
      Ignoring AshCMS_ViewController_webapp_war/ because the containing archive C:\glassfish4\glassfish\domains\domain1\applications\AshCMS_Project1_AshCMS recorded it as a pre-existing stale file]]
    
    
    [2015-06-05T12:05:23.804+0500] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487923804] [levelValue: 1000] [[
      Exception while deploying the app [AshCMS_Project1_AshCMS]]]
    
    
    [2015-06-05T12:05:23.804+0500] [glassfish 4.1] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487923804] [levelValue: 1000] [[
      Exception during lifecycle processing
    java.lang.IllegalArgumentException: Could not find sub module [AshCMS_ViewController_webapp.war] as defined in application.xml
      at com.sun.enterprise.deployment.archivist.ApplicationArchivist.readModulesDescriptors(ApplicationArchivist.java:560)
      at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:229)
      at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:232)
      at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:193)
      at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:227)
      at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:881)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:821)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:377)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
      at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Unknown Source)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Unknown Source)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
      at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:253)
      at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:231)
      at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:275)
      at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:328)
      at org.glassfish.admin.rest.resources.TemplateListOfResource.post(TemplateListOfResource.java:163)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
      at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103)
      at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:271)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028)
      at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:365)
      at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:316)
      at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
      at java.lang.Thread.run(Unknown Source)
    ]]
    
    
    [2015-06-05T12:05:23.814+0500] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487923814] [levelValue: 1000] [[
      Exception while deploying the app [AshCMS_Project1_AshCMS] : Could not find sub module [AshCMS_ViewController_webapp.war] as defined in application.xml]]
    
    
    [2015-06-05T12:05:30.224+0500] [glassfish 4.1] [INFO] [] [org.jvnet.mimepull.WeakDataFile] [tid: _ThreadID=42 _ThreadName=admin-listener(2)] [timeMillis: 1433487930224] [levelValue: 800] [[
      File C:\Users\TANVIR\AppData\Local\Temp\MIME4440540335098498486.tmp was not delet
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ed]]
    
    

    Any body can help to find the error.

    Because I'm not able to find the error.

    Concerning

    As indicated in the supported link you must use Glassfish 3.1 NOT Glassfish 4

  • Put the files on the remote server?

    I am connected to the remote server and tried repeatedly to put files on the remote server. It is said either successful or not transferred, and the new page never gets in place. What I am doing wrong? I put files on my remote server before, but all of a sudden it does not work for me.

    Could you please delete the _notes/dwsync.xml file in the Website\images\ folder under the root of your site and try to put the files again?

  • FTP adapter: Not picking not the file on the remote server

    Hello

    I use the FTP adapter to read the file from the remote server and file ra.xml - oc4j configured with good host, port, username and password.

    Once I have deployed my process, no instance of this process is created and remote directory entry file is not picked up.

    Please help on this issue. Thanks in advance.

    Just checking that you can send via ftp manually from the BPEL server.

    Looks like you can use the ra.xml - oc4j wrong file.

    Also in your BPEL project, take a look on the link partner FTP and see the JNDI location, it will look something like eis/Ftp/sample.

    This may be what you want to rename, generally good naming practices puts the server, for example Ftp/ist/FtpAdapter

    To make sure that you have configured the file ra.xml - correct oc4j we can check through the Manager of the company, even though Marc has specified the correct location.

    EM-> oc4j_soa-> Applications-> Drop down choice list autonomous resource adapters-> FtpAdapter-> connection Pools

    Select the JNDI name, you indicated in your BPEL process, if there is no create a.

    Create connections as needed.

    Also a hint is to start with the base directory, for example when you connect by ftp manually, it will be where you load the files. In your configuration / (oc4j - RA.Xml) is the place of departure and / is the physical or logical path. Download this work so that you know that you have the right connection. Then start working on the location of the directory.

    see you soon
    James

  • Webutil - deleting files from the application server

    Is there a Webutil function that will erase the files from the application server?

    I tried Webutil_file. Delete_File but it doesn't seem to work. Not quite sure if it's for customer files?

    Thank you
    Paul

    Hello
    Why don't you use HOST or WEBUTIL_HOST command to delete files of APPLICATION SERVER for example...

    HOST('DEL FILEPATH\FILENAME.EXT');
    or
    HOST('CMD /C DEL FILEPATH\FILENAME.EXT');
    
    or 
    
    WEBUTIL_HOST('DEL FILEPATH\FILENAME.EXT');
    or
    WEBUTIL_HOST('CMD /C DEL FILEPATH\FILENAME.EXT');
    

    Function Webutil_File works on the client side. See the documentation for webutil.
    http://www.Oracle.com/webapps/online-help/forms/10G/State?navSetId=_&Navid=3&vtTopicFile=web_util/functions.htm&vtTopicId=

    -Clément

    Published by: Graham on April 20, 2010 20:07
    Link added

  • I can't get email responded and open a file of the adobe reader software because it says it's corrupt.

    Original title: I can't open a file of the adobe reader software because it says it's corrupt can help you April

    I can't get email answered because he has been blocked for some reason any

    and I can not open a file with adobe reader, because sometimes corrupt
    can you help me
    April

    Hello

    Question by E-mail:

    1. What is the full error message when you try to open the emails?

    2. using a webmail or an email client?

    3. when a webmail, what webmail?

    4. If an e-mail client which e-mail client?

    Response to help you further.

    Problem with Adobe Reader:

    1 does happen with a file in particular?

    2. If it works well before?

    3 did you changes to the computer before the show?

    Uninstall and reinstall Adobe Reader.

    Step 1: UN-install Adobe Reader.

    Reference:

    Uninstall or change a program: http://windows.microsoft.com/en-US/windows-vista/Uninstall-or-change-a-program

    Step 2: Re-install Adobe Reader.

    Download and install the latest player here Adobe: http://get.adobe.com/reader/

  • How can I get my mask path to show instead of the mask shape dialog box?

    Hello

    I've recently updated to AE CS6 and to see why can't get my mask path to show. I want to create a simple mask that drives from point A to point B, thus revealing an object in my composition slowly. In CS5, all I had to do was click on the mask path Stop Watch and the yellow mask with spikes of pen and Bezier handles appear around my object. I could then create another keyframe and change the shape of the mask with my pen/selection tool that will create the desired effect. However, in CS6 when I add a mask to my object and click on the stopwatch for mask path mask yellow appears.

    You probably have the visibility of the mask off in the comp window.  Turn it back on again.

  • When you try to activate Windows I get an error: Code 45123 could not establish a connection with the activation server.

    the error number is 45123 and said "we could not establish a connection with the activation server." Please give me an answer to this error and try to solve it! If you want I can send you my product key to activate it, but I think it's better on email not here because there are a lot of... the pirates who have access to this site! provide me with an email address and I'll send you my product key and try to activate it and then give me the id I need to enter the activation window! Thank you!

    I solved this problem! Thanks for the help!

  • Error: failed to create or save new files in the folder where it was downloaded during the upgrade from Windows Vista to Windows 7

    Original title:

    Attempt to upgrade Windows Vista to Windows 7

    I try to update my Windows Vista to Windows 7. I bought to download the rom update the Microsoft store and downloaded, but when I try to start the upgrade I have a stateing message that it is impossible to create or save new files in the folder where it was downloaded. I checked the security permissions in the file and made sure that no programs are 'read only', but it won't always go beyond this point!

    Hello

    What is the edition of Windows Vista installed on the computer?
    Make sure that you upgrade to the correct version, some versions of Windows cannot be upgraded with the installation disc you are trying to use. For example, you cannot upgrade a 32-bit version of Windows to a 64-bit version, or upgrade a higher edition of Windows like Windows Vista Ultimate Edition, to a lower edition, such as Windows 7 Edition Home Premium. If this is the case, you will need to use the custom during installation option.
    Before you attempt to upgrade, please run the Windows 7 upgrade Advisor:
    http://Windows.Microsoft.com/en-us/Windows/downloads/Upgrade-Advisor
    Also, check if your computer is compatible for Windows 7, using the Compatibility Center:
    http://www.Microsoft.com/Windows/compatibility/Windows-7/en-us/default.aspx
    To learn more about the upgrade process, please visit the link below:
    http://Windows.Microsoft.com/en-us/Windows7/help/upgrading-from-Windows-Vista-to-Windows-7
    I hope that helps!
  • Cannot delete the file on the remote server (Business Catalyst)

    Hi, I am trying to delete a file on my remote server (Business Catalyst), but I get an error message (log of the errors below).  I can delete the other files in the same folder.  In addition, the permissions are the same on the files I can delete and one that I can't.  I can not remove this file with FileZilla, either - get a similar error message.  Any help will be greatly appreciated.  This is a template file and I really need to be able to delete or modify it.  Thank you.

    Started the: 09/01/2016-15:39

    Path is: /Templates/index_desktop.dwt.LCK

    Path is: /Templates/index_desktop.dwt

    /Templates/index_desktop.dwt - error - year FTP error - can't delete the file remote index_desktop.dwt.  Access denied.  The file exists may not, or there could be a permission problem.

    Hi Nancy,.

    The model was the one that I uploaded myself and I need to be able to make changes or delete it.  I have to go check out my Business Catalyst site and figured out I could delete templates through the Site Manager > Page Templates dialog box.  Thank you.

  • Download the file of the sftp server: 0 bytes. Why?

    I have a function to download a file from the server international:

    ' Public Sub downloadFileListener (FacesContext facesContext, OutputStream outputStream) throws IOException,.

    JSchException,

    {SftpException}

    AdfFacesContext context = AdfFacesContext.getCurrentInstance ();

    Card vScope = context.getViewScope ();

    FacesCtrlHierNodeBinding viewScopeRow = (FacesCtrlHierNodeBinding) vScope.get ("qcDocSelectedRow");

    System.out.println ("selected line:" + viewScopeRow);

    If (viewScopeRow! = null & & viewScopeRow.getAttribute ("DocAddr")! = null) {}

    String pathBind = viewScopeRow.getAttribute("DocName").toString ();

    String addr = viewScopeRow.getAttribute("DocAddr").toString ();

    System.out.println ("addr:" + addr);

    Filed file = new File (addr);

    FileInputStream fis;

    Byte [] b.

    try {}

    String SFTPHOST = "10.197.50.234";

    int SFTPPORT = 22;

    String SFTPUSER = "wrrw;

    String SFTPPASS = "rwwrwr";

    String SFTPWORKINGDIR = "/ var/www/html/QC/QC01000243/100039287 /";

    A session = null;

    Channel = null;

    ChannelSftp channelSftp = null;

    System.out.println ("AGAIN!");

    JSch jsch = new JSch();

    session = jsch.getSession (SFTPUSER, SFTPHOST, SFTPPORT);

    session.setPassword (SFTPPASS);

    java.util.Properties config = new java.util.Properties ();

    config.put ("StrictHostKeyChecking", "no");

    session.setConfig (config);

    session. Connect();

    Channel = session.openChannel("sftp");

    Channel.Connect ();

    System.out.println ("conectou");

    channelSftp = channel (ChannelSftp);

    System.out.println ("SFTPWORKINGDIR:" + SFTPWORKINGDIR);

    channelSftp.cd (SFTPWORKINGDIR);

    System.out.println ("estas aqui!");

    ubyte [] buffer = new byte [1024];

    FIS = new FileInputStream (SFTPWORKINGDIR);

    Buffer fis = new buffer (channelSftp.get ("macaco.gif"));

    int n;

    While ((n = fis.available ()) > 0) {}

    System.out.println ("here is");

    b = new ubyte [n];

    result int = fis.read (b);

    outputStream.write (b, 0, b.length);

    If (result == - 1).

    break;

    }

    } catch (IOException e) {}

    e.printStackTrace ();

    System.out.println ("exception:" + try ());

    }

    outputStream.flush ();

    }

    }

    The file exist in the server. However, when I try to get the file have 0 bytes.

    What's wrong?

    Pls help me, my version jdev is 11.2.4.0

    Hello

    Just check your code again. Here are a few references. Just hardcode the path and try to debug the java method.

    SFTP for Java examples

    JSch - Java secure channel - examples

    Thank you
    Amey

  • Download file from the database server, through application server.

    Nice day

    I use Jdeveloper 11.1.2.3.0.

    I have a requirement to download a file that already exists on the database server Directory. Now my current scenario is that user is connected to the application server, and the user has no direct access to the database server.  I drew a diagram of my requirement as:


    DownloadFile.png


    I get a way to do this. Please suggest.


    Best regards,

    Julien

    The session does not expire if you are streaming data from the application to the client. However, you will need to manage the data sent over the network, because it can make the very slow network if you send this amount of data at high speeds on the network and then to the customer. This connection between client and server is the biggest problem, because bandwidth is usually small. Think about downloading software by one side oracle (for example 1 GB), this takes time and is prone to errors.

    We did something similar by transferring the data from the database (in our case, it has been stored in a BLOB) on a dedicated server with a server web apache on it. Then, we send a link to the client, which then uses the link to get the special file server data.

    The advantage is that you don't have to code the transfer of huge files in the application of the adf but can already use ready to use of software (balancing bandwidth and the recovery of a broken download).

    Timo

  • webutil read file function finds the file on the application server

    Hello

    I want to select and read a file (possibly .pdf) and save it to the database.

    To achieve this, I:

    1) created a table, deltia (key primary aa, varchar2, blob, other columns... image_blob, filename)

    (2) created a block form of database based on the deltia table. The element of the "image_blob" column type is image

    and the image format is "tiff".

    (3) wrote the following piece of code to perform the selection of local file (successfully)

    Select the FUNCTION (i_FileFiltre IN Varchar2 default vDefFileExt)

    RETURN VARCHAR2

    IS

    vPath Varchar2 (128);

    vFileName Varchar2 (256);

    vFileFiltre Varchar2 (200): = i_FileFiltre;

    Begin

    vPath: = CLIENT_WIN_API_ENVIRONMENT. Get_Temp_Directory;

    vFileName: = WEBUTIL_FILE. FILE_OPEN_DIALOG

    (

    vPath,

    '',

    vFileFiltre,

    "Select the file to download.

    ) ;

    Return vFileName;

    END selection;

    The form above function call is:

    Declare

    vFileName Varchar2 (200);

    Begin

    vFileName: = PKG_File_Ops.Selection;

    If vFileName is not null then

    : eq_deltia_metakinhshs. Filename: = vFileName;

    End if;

    End;

    (4) wrote the piece of code to the game/place the file selected in the form element "image_blob", as following:

    client_image.read_image_file (: eq_deltia_metakinhshs.filename,)

    substr (: eq_deltia_metakinhshs.filename, instr (: eq_deltia_metakinhshs.filename,-1)).

    "eq_deltia_metakinhshs.deltio_image");

    The call to the packaged procedure client_image.read_image_file does not work. It returns error

    "47109 - cannot locate the/u01/oracle/temp /... image file"

    In other words, the system will search to read the selected file locally on the server App.

    What can be the cause of this?

    With regard to the content of the webutil.cfg of the App Server. :

    # ---------------------------------------------------------------------------

    # webutil.cfg - WebUtil default configuration file

    # ---------------------------------------------------------------------------

    # This file contains all the configuration settings for webutil. These are some

    # divided according to the following sections:

    # 1. Logging options

    # 2. Installation options

    # 3. Upload a file and download Options

    # 1. Logging options side server for recording the log messages and errors

    # You must set logging.enabled to true to allow registration of mid-range. Without this

    logging of mid-range # will not be any PL/SQL or URL options

    # are provided to turn it on. Once recording is activated the other settings are

    # in-game.

    #

    # Details

    # -------

    # logging.file: sets the file name and location of the log file.

    # Note that WebUtil does no management of the log file. You can

    # need to manually clean this file at any time.

    # logging.enabled: can be TRUE or FALSE

    # logging.errorsonly: can be TRUE or FALSE. Parameter True will ensure that

    # only errors and the normal information log messages

    # are written to the log file. It would be for the use of the product,

    # normally be set to TRUE

    # logging.connections: can be TRUE or FALSE. Setting to true causes each

    connection from a client using WebUtil for write in #.

    # the log that it puts in place.

    Logging.file =

    Logging.Enabled = False

    Logging.ErrorsOnly = false

    Logging.Connections = false

    # 2. Installation options

    # WebUtil needs to download files on the client to perform

    # some operations such as OLE integration or access to the registry. These files

    # are downloaded on the client when webutil is run for the first time.

    # Subsequent executions will use the dll in the cache. Define the location of the

    # These files on the server and the location on the client.

    #

    # Here's a chart that shows numeric constants and their meanings. They

    # are used in configurations of installation options. These constants are defined

    # in WEBUTIL_CORE package spec. Note that the Processor Architecture of the Client operating system

    # is generally the architecture of the JAVA virtual machine that runs on the client,

    # not necessarily even the real client architecture of BONE.

    #

    # < Os - > Client OS family < arch - > processor for the Client operating system Architecture

    # 0-0 - 32-bit Windows

    # 1 Linux 1-64-bit architecture

    # 2 SOLARIS

    # 3 HP

    # 4 AIX

    # 5 mac

    # 9 unknown

    #

    # < Package > - package name

    # 7 WEBUTIL_OLE2

    # 9 WEBUTIL_C_API

    # We do not yet have downloads for other packages. If you need, refer

    # Spec package WEBUTIL_CORE for constants of other packages

    #

    # Details

    # -------

    # NOTE: For all < arch > parameters field is optional. Without this field, the

    # setting will apply to the client 32-bit and 64-bit OS (FMV)

    architectures of #.

    #

    # install.syslib.location. < os >. < arch >:

    # The virtual path of the directory containing the webutil library files the

    server-side of #. This must be an absolute URL or a relative URL

    # for the documentbase.

    # NOTE: < os > field is optional for this parameter. In the absence of a framework

    # which has the client OS and ARCH, it will use

    # install.syslib.location. < arch > cannot be specified if < os > is omitted.

    #

    # install.syslib.location.client. < os >. < arch >:

    # The path to the directory on the client machine where the webutil library

    # files will be downloaded. This must be an absolute path or a path

    # which is the profile of the client user or at HOME. Directory will be created

    # If necessary as well as other parent directories. If the path is

    # do not set, it will be treated as a special case where the libraries will be

    # downloaded to the client JRE\bin (windows) or JRE/lib (unix). If this

    # Directory is changed, all libraries will be redownloaded again.

    #

    # Please keep in mind that other forms server may also have a similar

    the location of # and so libraries could be overwritten even when

    # client running webutil server of different forms. It is therefore

    # advised that the location has a subdirectory that may be unique to your

    # Server, such as the name of the host server. You could use $(SERVERHOST) in the

    # location. This string will be replaced with the actual hostname of the server

    #

    # install.syslib. < os >. < arch >. < package >. < n >:

    # The names of the libraries required for the particular webutil beans. The

    # format of it's name. size | version | showDownloadDialog. Several libraries

    # can be downloaded per package. But make sure the values < n >

    # row and start at 1 for a given operating system, arch and package together.

    install.syslib.Location=/webutil

    install.syslib.Location.0.0=/webutil/Win32

    install.syslib.Location.0.1=/webutil/Win64

    # Add/Edit the following if you want to specify a different location client

    # where syslib libraries.

    # Format:

    # install.syslib.location.client. < os >. < arch > = < location >

    \win32 install.syslib.Location.client.0.0=webutil\syslib\$ (SERVERHOST)

    \win64 install.syslib.Location.client.0.1=webutil\syslib\$ (SERVERHOST)

    # Change the size and the version if necessary, such as when the upgrade of the library.

    # Normally this is not necessary since most of these libraries are equipped

    # settle. Jacob does not however come with installation

    # Format:

    # install.syslib. < os >. < arch >. < package >. < n > = name | size | version | showDownloadDialog

    1.14.3 - install.syslib.0.0.7.1 = Jacob - x 86 DLL | 102400 | 1.14.3 | true

    1.14.3 - install.syslib.0.1.7.1 = Jacob - x 64 .dll | 117760 | 1.14.3 | true

    install.syslib.0.0.9.1 = JNIsharedstubs.dll | 45056 | 1.0: true

    install.syslib.0.1.9.1 = JNIsharedstubs.dll | 58368 | 1.0: true

    install.syslib.0.0.9.2 = d2kwut60.dll | 81920 | 1.0: true

    install.syslib.0.1.9.2 = d2kwut60.dll | 102400 | 1.0: true

    # You can also add your own libraries here, for example

    #install.syslib.0.0.user.1 = testwebutil.dll | 204872 | 1.0: true

    #install.syslib.0.0.user.1 = ffisamp.dll | 40960 | 1.0: true

    #install.syslib.0.1.user.1 = ffisamp.dll | 35328 | 1.0: true

    # 3. Download / upload options

    # For file upload and download options, you can set the default locations

    # on the server that webutil can use as a work space. Optionally, you can pass

    off # upload and download

    #

    # Details

    # -------

    # transfer.database.enabled: can be TRUE or FALSE - allows you to activate or

    # disable upload and download of data

    #                                server.

    # transfer.appsrv.enabled: can be TRUE or FALSE - allows you to activate or

    # disable the upload and download from the

    application server #.

    # transfer.appsrv.workAreaRoot: the root of the location in which can WebUtil

    # store temporary files uploaded by the client.

    # If no location is specified, application server

    # user_home/temp will be assumed.

    # This place is always readable and accessible writable

    # No matter the parameters of

    # transfer.appsrv. * are. This parameter is

    # If you need side customer

    # READ/WRITE_IMAGE_FILE procedures.

    # transfer.appsrv.accessControl:Can be TRUE or FALSE - allows you to specify

    # that loads and downloads can occur

    # the directories named in the

    # transfer.appsrv.read.n and

    entries transfer.appsrv.write.n # and their

    subdirectories #. If this parameter is set to FALSE,

    # transfers can happen anywhere.

    # transfer.appsrv.read. < n >: list of directory names that downloads can read

    #                                from.

    # transfer.appsrv.write. < n >: list of directory names that mail can write

    #                                to.

    #NOTE: by default, the file transfer is disabled by security measure

    Transfer.Database.Enabled = True

    Transfer.appsrv.Enabled = True

    transfer.appsrv.workAreaRoot =

    transfer.appsrv.accessControl = FALSE

    #List transfer.appsrv.read. < n > directories

    Transfer.appsrv.Read.1=c:\temp

    #List transfer.appsrv.write. < n > directories

    Transfer.appsrv.Write.1=c:\temp

    # 4. Others

    # Details

    # -------

    # BlockAllowHeartBeat: Continue the heart beat communication with the

    # Server when set to TRUE. By default, the value is

    # the value False. If set to False, there is no heart

    # fight mode blocking communication.

    BlockAllowHeartBeat = False

    Notes:

    The database version is 11g v.2

    Forms services version is 11g v.2

    The webutil has been installed and configured (I have done a project that requires reading a

    saved locally excel file - using webutil_ole2.)

    I didn't notice an error in the Java console.

    Thank you

    SIM

    This error indicates that your server is a unix platform: 47109-cannot locate image file/u01/oracle/temp /


    If it is correct, then your webutil.cfg is not been set correctly.  Entries for transfer.appsrv are in reference to the appsrv and not the client.  So you currently C:\temp which is a directory of Windows and not Unix.

    (2) Transfer.appsrv.Read.1 =c:\temp. It is already set.

    3) Transfer.appsrv.Write.1=c:\temp. It is already set.

  • Help associate .html files with the CF Server

    Hi people.

    Summary:
    I am looking for help with this error:
    "The Macromedia application server is inaccessible or it has no mapping to process this request."

    Details:
    I'm installing CF 7 on a Server 2003 with IIS 6 and I try to get the .html files to be treated as. CFM files.

    The CF Admin works very well, and when I call one. CFM page in my web directory, which also works fine to start.

    When I call a .html file, I get the error message:
    The Macromedia application server is inaccessible or there is no mapping to process this request.

    I have entered in IIS to the properties of the Web Site and the associated with the CF server .html files and restarting the server, and I still get the same error.

    I consulted my JRUN. INI files are entered:
    ignoresuffixmap = false

    But that no longer works.

    Any help is appreciated.

    Thank you

    Doug

    Assuming that you have correctly configured IIS (using Apache or be hacked), you need to make another change.

    1. Stop your web server and the CF.
    2. In C:\CFusionMX7\wwwroot\WEB-INF\web.xml , add:


      CfmServlet
      *.html


      CfmServlet
      * .html / *.

    3. Start your web server, then see

Maybe you are looking for