Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adobe Acrobat intercepting every URL from call to BasicService.showDocument() in java

Our In-House Java application launches various http URLs at various times, including URLs to web-pages, MS Word documents, MS Excel documents, PDF files etc.

On over 50+ machines the URL launching works fine and the correct application opens the given page/document correctly. However, on one pesky machine Adobe Acrobat is attempting to open every URL (regardless of whether the target is a pdf or not), and failing (even on pdf documents) with:

There was an error opening this document. The filename, directory name, or volume label syntax is incorrect.

The code to launch the URLs is:

URL url = new URL("http://www.example.com");
BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
boolean worked = bs.showDocument(url);

The worked variable is true after the call.

Other points that may be helpful:

  • The application runs within Java Web-Start.
  • An applet running on the same machine is able to open URLs correctly using AppletContext.showDocument()
  • Entering a URL into the Windows "Run..." dialog launches the URL correctly.
  • We've reinstalled both the JRE and Adobe Acrobat.

Thanks in advance for any advice/help you can offer.

Update:

The following debug code produces the following output:

    String[] services = ServiceManager.getServiceNames();
    if(services!=null) {
      for(int i=0;i<services.length;i++) {
        System.out.println("Available Service: "+services[i]);
      }
    }

    BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
    System.out.println(url);
    System.out.println(bs);
    System.out.println("bs.getCodeBase():"+bs.getCodeBase());
    System.out.println("bs.isOffline():"+bs.isOffline());
    System.out.println("bs.isWebBrowserSupported():"+bs.isWebBrowserSupported());
    boolean worked = bs.showDocument(url);
    System.out.println("bs.showDocument:"+worked);
  } catch(UnavailableServiceException ue) {
    System.out.println("UnavailableServiceException thrown");
    ue.printStackTrace();
  }


Available Service: javax.jnlp.BasicService
Available Service: javax.jnlp.FileOpenService
Available Service: javax.jnlp.FileSaveService
Available Service: javax.jnlp.DownloadService
Available Service: javax.jnlp.ClipboardService
Available Service: javax.jnlp.PersistenceService
Available Service: javax.jnlp.PrintService
Available Service: javax.jnlp.ExtendedService
Available Service: javax.jnlp.SingleInstanceService
http://<snip>
com.sun.jnlp.BasicServiceImpl@bbb8b5
bs.getCodeBase():http://xxx.xxxxxx.com:8080/
bs.isOffline():false
bs.isWebBrowserSupported():true
bs.showDocument:true
like image 722
cagcowboy Avatar asked Nov 15 '22 03:11

cagcowboy


1 Answers

Have you solved this problem yet? If not, could you try the following?

FileOpenService fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService"); 
like image 85
Bernd Elkemann Avatar answered Nov 16 '22 16:11

Bernd Elkemann