Javax.jnlp.PersistenceService bug: ArrayIndexOutOfBoundsException

com.sun.jnlp.PersistenceServiceImpl, which is Sun standard implementation of PersistenceService interface, only allows for 255 storage entities for a given codebase.
After some decompiling I found out it keeps an internal array, size 255. Very very dumb move IMHO.
If you try to register a 256th entity, it fails horribly with a ArrayIndexOutOfBoundsException. This even if all the entries are 0-length, and the storage if effectively using no space at all.
This effectively hinders any usage of this API as a 'sandbox friendly' filesystem, as I was trying to do, by making the database for my JWS Application save to the PersistentService storage. This is because any 'serious' application creates many files for data and metadata (logs, etc...), and this make PersistenceService completely unfit for the task.
Moreover this limit is unneeded for security reasons, since size limits are already in, and it would be easily fixed by replacing the fixed size array with an ArrayList, with no consequences at all on the performance or features, except giving user a more capable PersistenceService implementation, that works as intended by the API contract, instead of firing unforeseen exceptions.
I've filed a bug with bugs.sun.com, let's see if they can fix this one.
What do you think about this?

I've downloaded official latest JDK6 sources from sun (jdk-6u1-ea-src-b03-jrl-19_jan_2007.jar), and I've had a look at the actual sources.
com.sun.jnlp.PersistenceServiceImpl depends on com.sun.deploy.Cache static methods for operations: it's this latter class that handles the persistence entities creation/removal, etc... (they are named 'muffins' in the implementation).
This is PersistenceServiceImpl.create
    public long create(final URL url, final long maxsize)
     throws MalformedURLException, IOException {
     // compute new limit based on this maxsize + maxsize of all other
     // entries this application has access to.  If this total is
     // >= _limit then ask user if they want to increase the _limit
     checkAccess(url);
     Long l = null;
     long newmaxsize = -1;
     if ((newmaxsize = checkSetMaxSize(url, maxsize)) < 0) return -1;
     final long pass_newmaxsize = newmaxsize;
     try {   
         l = (Long)AccessController.doPrivileged(
          new PrivilegedExceptionAction() {
          public Object run() throws MalformedURLException, IOException {            
                    Cache.createMuffinEntry(url, PersistenceService.CACHED, pass_newmaxsize);
              return new Long(pass_newmaxsize);
     } catch (PrivilegedActionException e) {
         Exception ee = e.getException();
         if (ee instanceof IOException) {
          throw (IOException)ee;
         } else if (ee instanceof MalformedURLException) {
          throw (MalformedURLException)ee;
     return l.longValue();
    }As you can see the method calls "checkSetMaxSize"
    private long checkSetMaxSize(final URL url, final long maxsize)
     throws IOException {
     // algorithm:
     // friendTotalMaxSize = sum of maxsize of all other muffins accessible
     // by the host that made this muffin.  (i.e. muffins with same
     // host as this one)
     // if friendTotalMaxSize + maxsize > application maxsize, ask user if
     // they want to increase application maxsize.
     URL [] friendMuffins = null;
     try {
     friendMuffins = (URL []) AccessController.doPrivileged(
          new PrivilegedExceptionAction() {
            public Object run() throws IOException{
                return (Cache.getAccessibleMuffins(url));
     } catch (PrivilegedActionException e) {
         throw (IOException) e.getException();
     long friendMuffinsTotalMaxSize = 0;
     if (friendMuffins != null) {
         for (int i = 0; i < friendMuffins.length; i++) {
          if (friendMuffins[i] != null) {
              final URL friendMuffin = friendMuffins;
          Long longFriendMuffinsSize = null;
          try {
          longFriendMuffinsSize =
               (Long) AccessController.doPrivileged(
               new PrivilegedExceptionAction() {
               public Object run() throws IOException{
return new Long(Cache.getMuffinSize(
friendMuffin));
          } catch (PrivilegedActionException e) {
               throw (IOException) e.getException();
          friendMuffinsTotalMaxSize +=
               longFriendMuffinsSize.longValue();
Which in turns calls com.sun.deply.Cache.getAccessibleMuffins
    public static URL[] getAccessibleMuffins(URL url) throws IOException {
        URL[] urls = new URL[255];
        // Get the list of files that match this name
        final File[] files = muffinDir.listFiles(new FileFilter() {
            public boolean accept(File pathname) {
                String filename = pathname.getName();
                return filename.endsWith(MUFFIN_FILE_EXT);
        URL u;
        int urlCount = 0;
        for (int i = 0; i < files.length; i++) {
            u = getCachedMuffinURL(files);
if (u.getHost().equals(url.getHost())) {
urls[urlCount] = u;
urlCount += 1;
return urls;
Notice the: URL[] urls = new URL[255];
In this class we can find a fixed size array, size 255, which cause the bug.
You can easily test it with the provided test case in my previous reply. :)

Similar Messages

  • Sharing data stored by javax.jnlp.PersistenceService between users

    Application is deployed by Java Web Start. It runs and allows user to store some settings. It stores these settings using javax.jnlp.PersistenceService. Will these settings be available for another user (win account) if this application is run by windows service even before user logon... and it reads the settings values again from the same URL (the key in javax.jnlp.PersistenceService) and exposes it's GUI after user logon where these settings are presented?
    I tried the senario described above and saw that another user even can not see the application in a cache (Java Conrol Panel - Application Cache Viewer)... but run by win service application exposes the settings for all the users as if they are shared.
    Is it correct behaviour or it should not be like that?

    Application is deployed by Java Web Start. It runs and allows user to store some settings. It stores these settings using javax.jnlp.PersistenceService. Will these settings be available for another user (win account) if this application is run by windows service even before user logon... and it reads the settings values again from the same URL (the key in javax.jnlp.PersistenceService) and exposes it's GUI after user logon where these settings are presented?
    I tried the senario described above and saw that another user even can not see the application in a cache (Java Conrol Panel - Application Cache Viewer)... but run by win service application exposes the settings for all the users as if they are shared.
    Is it correct behaviour or it should not be like that?

  • Lookup failed: javax.jnlp.UnavailableServiceException: uninitialized

    When U deployed *.war file to App Server and I call JNLP to launch program and display its on Java Web Start. But If i call as below
         System.out.println("Before Step1");
         System.out.println(ServiceManager.getServiceNames());
         basicService = (BasicService)
         ServiceManager.lookup("javax.jnlp.BasicService");
    I get message on console
    Lookup failed: javax.jnlp.UnavailableServiceException: uninitialized
    I can check service where is working?
    anyone advice plese?
    Thank

    I had the same problem and to solve it, I do those 3
    steps :
    - I copy the file "jnlp.jar" (you can find with the
    JDK files) in the folder of my application.
    - After you have to put the path of jnlp.jar
    (generally
    "C:\Java\jdk1.5.0_06\sample\jnlp\servlet\jnlp.jar")
    in the CLASSPATH.
    - And finally when you create your .jar, you have to
    add the file "jnlp.jar" to it...
    So I hope it is "quite" clear (if not, don't hesitate
    to ask for it) and I hope it will work.
    Regards.====================
    I had followed the steps defined above.
    Even then i am getting same UnavailableServiceException.
    regards,
    raj

  • Package javax.jnlp does not exist

    I have the following code inmy class file
    public class ExtensionInstallerService implements javax.jnlp.ExtensionInstallerService {
    protected ExtensionInstallerService() {
    But I am getting the error message package javax.jnlp does not exist
    Is this anything to do with the installation of Java Web Start.Should I try re-installing?

    javax.jnlp is in jnlp.jar (see the developers bundle at :
    http://java.sun.com/products/javawebstart/download-jnlp.html)
    you need to include jnlp.jar in your classpath to use the jnlp api's. At runtime when running under Java Web Start these packages are exist in javaws.jar.
    /Dietz

  • Rectifying javax.jnlp.UnavailableServiceException

    Hi,
    while employing and executing an application,I had faced javax.jnlp.UnavailableServiceException eventhough having of jnlp.jar in Eclipse referenced libraries.Indeed,I don't know why the hack is this.Is there any reason for the same and how to rectifying such issue.Its so helpful if you have any idea on it.
    The following exception :
    Thread [Thread-30] (Suspended (exception javax.jnlp.UnavailableServiceException))     
         javax.jnlp.ServiceManager.lookup(java.lang.String) line: 44     
               Thanks
    Stalin.G

    Hi,even the problem hasn't solved while executing the following code.
    BasicService bs=null;
              try{
                   bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");          
                   System.out.println(bs.getCodeBase().toString());
                 }catch(Exception e){
                      System.out.println("BasicService:"+e.getMessage());
                      e.printStackTrace();}//newly added
                           While executing the above code,the following exception is occuring something like
    BasicService:uninitialized
    javax.jnlp.UnavailableServiceException: uninitialized
         at javax.jnlp.ServiceManager.lookup(ServiceManager.java:44)
         at Service.main(Service.java:19)I don't know whether it is a problem of eclipse or source code level.Indeed,running the application via browser is working fine but using eclipse it is not working.Is there any setup to be considered in eclipse to enable web start?If so how to do such things for the same?
    Could anyone clarify my doubts?
    Thanks,
    Stalin.G

  • PersistenceService problem

    Hi This smells like a bug in the PersistenceService class, but I thought I would check with this forum first for thoughts.. I am new to Web Start, using the beta version 1.2, and am in the process of converting some applets I have written to becoming webapps. My applets are in need of cookies, so I am exploring how to use "muffins" instead.
    To start out, I wrote/modified the following method (taken from the Sun example on how to use the PersistenceService class) to simply return the number of muffins stored on a clients system. (webStartUtilities.jnlputilities.numMuffins)The NullPointerException is occurring deep within the call to getNames and the URL I am passing in appears to be valid. The state of the client's system is that initially, at the point I make this call, there has not been any muffins stored on the clients system.
    Is this Exception the expected behaviour? I would have expected either a null value return, or a zero length array. My code and walkback follow.... Thanks for any help...
    Marc...
         * Method numMuffins. This method fetches the number of
         * muffins for a given url. ("muffin" are the web app equivalent of a cookie)
         * Creation date: (6/22/01 9:37:33 PM)
         * @return java.lang.String
         * @param url
         public int numMuffins() throws java.lang.Exception {
              try {
                   ps =
                        (PersistenceService) ServiceManager.lookup(
                             "javax.jnlp.PersistenceService");
                   bs =
                        (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
              } catch (UnavailableServiceException e) {
                   ps = null;
                   bs = null;
              if (ps != null && bs != null) {
                   try {
                        // find all the muffins for our URL
                        URL codebase = bs.getCodeBase();
                        if (codebase == null) throw new Exception("Exception in jnlpUtilities:numMuffins Null Codebase");
                        System.out.println("Codebase = " + codebase.toString());
                        String[] muffins = ps.getNames(codebase);
                        if (muffins == null) return 0;
                        return muffins.length;
                   } catch (Exception e) {
                        System.out.println("Exception in jnlpUtilities:numMuffins" + e.toString());
                        e.printStackTrace();
                        throw new Exception(e.toString());
              return 0;
    java.lang.NullPointerException
         at com.sun.jnlp.PersistenceServiceImpl$8.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.jnlp.PersistenceServiceImpl.getNames(Unknown Source)
         at webStartUtilities.jnlputilities.numMuffins(jnlputilities.java:72)
         at telescopeLogin.TelescopeLogin.loginMuffinExists(TelescopeLogin.java:593)
         at telescopeLogin.TelescopeLogin.<init>(TelescopeLogin.java:64)
         at cameraApplet.Cameracontrol.showLoginDialog(Cameracontrol.java:8601)
         at cameraApplet.Cameracontrol.init(Cameracontrol.java:8263)
         at com.sun.jnlp.AppletContainer$3.run(Unknown Source)

    So, within these guidelines could you please helpme
    get off the NullPointer exception. ...So, could you at least answer the single question I
    aksed you in my last message? Otherwise it feels
    as though you are treating me as if I were some
    sort of help desk. That question was..
    What is your interest in 'hiding' these EXE's?
    pretty much part of requirement / feasibility study. motivation is purely due to having controls within java env.. I don't want the user add/modify things around certain configs that would decide the way the app behaves.
    .. since the user would not venture into ws cache, i thought its safe to keep using the API, and preserve the unpacks along with those eagerly downloaded jars.
    I have no intention to treat you bad.. pardon me if any of my words meant that way.

  • Where do you get jnlp.jar for Mac Leopard 10.5.5

    Hello,
    I am trying to use Persistence in JNLP on a Mac 10.5.5 with either 1.5 or 1.6. I have searched
    my local disk the Mac developer web site and this website for "jnlp java Mac Leopard" no useful results.
    Where can I get a jnlp.jar file that works on a Mac?
    Rinaldo

    I was able to get the question answered on the mailto:[email protected] list.
    My friend http://www.google.com/search?q=jnlp.jar+mac+java&ie=utf-8&oe=utf-8&aq=t answered it.
    Greg also provided some very useful information, especially the mdfind javaws.jar command
    http://lists.apple.com/archives/Java-dev/2008/Nov/msg00052.html
    I see that in JDK 1.5, javaws.jar is included. For now I will assume that the javaws.jar classes have been moved to javaws.jar
    jar tvf ./Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/javaws.jar | grep jnlp
            0 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/
      3147 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/ApiDialog.class
      1626 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletAudioClip$1.class
      3922 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletAudioClip.class
      1377 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletContainer$1.class
       990 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletContainer$2.class
      1329 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletContainer$AppletContainerContext$1$1.class
      1452 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletContainer$AppletContainerContext$1.class
      2942 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletContainer$AppletContainerContext.class
      1551 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletContainer$AppletContainerStub.class
       710 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletContainer$LoadImageAction.class
      4841 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletContainer.class
       234 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/AppletContainerCallback.class
      1362 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/BasicServiceImpl$1.class
      1158 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/BasicServiceImpl$2.class
       992 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/BasicServiceImpl$BasicServiceBrowser.class
      2397 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/BasicServiceImpl.class
      1279 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/CheckServicePermission.class
       868 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/ClipboardServiceImpl$1.class
      1668 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/ClipboardServiceImpl$2.class
      2787 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/ClipboardServiceImpl.class
      1159 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$1.class
      1652 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$10.class
      1318 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$2.class
      1474 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$3.class
      1679 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$4.class
      2519 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$5.class
      1739 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$6.class
      1942 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$7.class
      1517 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$8.class
      1445 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$9.class
      1398 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$DefaultProgressImpl$1.class
      2914 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$DefaultProgressImpl.class
      2254 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl$ProgressHelper.class
      8288 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/DownloadServiceImpl.class
       900 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/ExtendedServiceImpl$1.class
      1051 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/ExtendedServiceImpl$2.class
      3188 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/ExtendedServiceImpl.class
       707 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/ExtensionInstallerServiceImpl$1.class
       961 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/ExtensionInstallerServiceImpl$2.class
       711 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/ExtensionInstallerServiceImpl$3.class
      5918 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/ExtensionInstallerServiceImpl.class
       787 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileContentsImpl$1.class
       820 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileContentsImpl$2.class
       928 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileContentsImpl$3.class
       791 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileContentsImpl$4.class
       792 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileContentsImpl$5.class
      1002 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileContentsImpl$6.class
      4353 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileContentsImpl.class
      2155 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileOpenServiceImpl$1.class
      2323 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileOpenServiceImpl$2.class
      1144 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileOpenServiceImpl$WindowsAltFileSystemView$FileSystemRoot.class
      3017 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileOpenServiceImpl$WindowsAltFileSystemView.class
      2974 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileOpenServiceImpl.class
      2847 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileSaveServiceImpl$1.class
      3257 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/FileSaveServiceImpl.class
      1087 Fri Sep 05 10:32:48 EDT 2008 com/sun/jnlp/ImageCache.class
      1937 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JNLPCachedJarURLConnection$1.class
      5559 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JNLPCachedJarURLConnection.class
       940 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JNLPClassLoader$1.class
       928 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JNLPClassLoader$2.class
      1285 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JNLPClassLoader$3.class
    12413 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JNLPClassLoader.class
      2555 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JNLPFileFilter.class
      6074 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JNLPRandomAccessFileImpl.class
       788 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JnlpLookupStub$1.class
      2918 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/JnlpLookupStub.class
      2044 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/MeteredFileOutputStream.class
       938 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$1.class
      1022 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$10.class
      1805 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$11.class
      1023 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$2.class
       845 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$3.class
       877 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$4.class
       981 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$5.class
       875 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$6.class
       871 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$7.class
       885 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$8.class
       974 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl$9.class
      7991 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PersistenceServiceImpl.class
       809 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PrintServiceImpl$1.class
      1189 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PrintServiceImpl$2.class
       969 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PrintServiceImpl$3$1.class
      1717 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PrintServiceImpl$3.class
      2986 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/PrintServiceImpl.class
      1441 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/SingleInstanceServiceImpl$1.class
      1673 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/SingleInstanceServiceImpl$TransferListener.class
      3938 Fri Sep 05 10:32:50 EDT 2008 com/sun/jnlp/SingleInstanceServiceImpl.class
         0 Fri Sep 05 10:32:48 EDT 2008 javax/jnlp/
       258 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/BasicService.class
       251 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/ClipboardService.class
      1392 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/DownloadService.class
       349 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/DownloadServiceListener.class
       309 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/ExtendedService.class
       659 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/ExtensionInstallerService.class
       598 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/FileContents.class
       370 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/FileOpenService.class
       430 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/FileSaveService.class
      1451 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/JNLPRandomAccessFile.class
       688 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/PersistenceService.class
       350 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/PrintService.class
       994 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/ServiceManager.class
       303 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/ServiceManagerStub.class
       185 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/SingleInstanceListener.class
       250 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/SingleInstanceService.class
       472 Fri Sep 05 10:32:50 EDT 2008 javax/jnlp/UnavailableServiceException.class

  • PROBLEM : JWS & JNLP Used to Load Application To User System

    Please See The Following Page That has my Problem mentioned in Detail Regarding JWS & JNLP Problem.
    http://forum.java.sun.com/thread.jspa?threadID=782060
    Just Let me know the SOLUTION PLZ ! ! ! ITS UTMOST URGENT

    PLZ HELP THIS IS URGENT !1) Please stop SHOUTING at us, and realise that
    something that is URGENT to you is URGENT to
    you, but nobody else!
    2) If this problem is so urgent to you, it might have
    been a better idea to answer zadok's question than
    reply with a message shouting your urgency.
    For example, if you had said something like..
    "Sorry, I made that post on the other forum before
    I knew about this forum. This forum seems better
    for my question."
    You might have got response like ..
    "Sure. Please make sure you add a 'conclcusion'
    to the other thread, like 'message moved to XYZ forum'."
    (you might not get that response, as well, but it is
    always worth a try - also note the hints in the reply!)
    I have created a Download Manager Apllication using Swings.I do not know where the term 'Swings' originated,
    but note that it is the 'Swing' toolkit.
    I have deployed it using Java Web Start & JNLP.
    Now, I am facing the following problem for which I
    am not able to find any solution.
    HOW CAN I SAVE THE APPLICATION STATE ON LOCAL SYSTEM ???(again with the shouting..)
    The PersistenceAPI should be good for that.
    http://java.sun.com/j2se/1.5.0/docs/guide/javaws/jnlp/javax/jnlp/PersistenceService.html
    I have a sandboxed project that uses it to store
    the GUI state on shut-down and restore it at start-up.
    http://www.1point1c.org/spacesim/
    Note that while the applications launched by
    'spacesim.jnlp' uses the PS, it is
    a) not intended as an example of using the
    service, and the code is vastly more complicated
    than what you require for storing/restoring an URL
    and byte count.
    b) not available with 'support'.
    You might be able to find some better example of
    using the PersistenceService by searching either
    here or Sun's site on (something like)
    "PersistenceService example"
    If those search terms don't work for you, drop
    back into the forum and someone might be able to
    suggest better ones, or a direct link.
    But please stop shouting at us.

  • Alternative to "javafx.io.Resource" and "javafx.io.Storage" in JavaFX 2.2?

    Silverlight has a sandboxed file storage location as well as a facility to store key/value pairs.
    It looks like JavaFX had some similar tools in 1.x, but they appear to be gone in 2.2.
    Can anyone point me toward an alternative for both services?
    Thanks,
    Michael

    Here you go.... I think this is almost reusable as is (my method logging methods need to be removed, and the directory for standalone persistence needs to be changed for your implementation).
    PersistenceApi
    public interface PersistenceApi {
        public InputStream getInputStream(String fileName);
        public boolean createNewFile(String fileName);
        public OutputStream getOutputStream(String fileName);
    }PersistenceManager.... its like a factory, responsible for determining whether or not in Webstart mdoe or not and instantiating the correct implementation of PersistenceApi (not thread safe)
    public class PersistenceManager {
        //static variables
        private static PersistenceApi persistence;
        //public functions
        public static PersistenceApi getPersistenceApi() {
            if (persistence == null) {
                String homeDir = null;
                try {
                    homeDir = System.getProperty(game.CONSTANTS.STANDALONE_INSTALL_DIR_SYSTEM_PROPERTY);
                } catch (SecurityException e) {
                    game.Log.debug("in PersistenceManager.getPersistenceApi, got exception");
                if (homeDir != null) {//...in standalone mode
                    game.Log.debug("in PersistenceManager.getPersistenceApi, in standalone mode, homeDir == " + homeDir);
                    persistence = new StandalonePersistence();
                } else {//...in web start mode
                    game.Log.debug("in PersistenceManager.getPersistenceApi, in web start mode");
                    persistence = new JnlpPersistence();
            return persistence;
    }JnlpPersistence
    public class JnlpPersistence implements PersistenceApi {
        //private variables
        private URL codeBase = null;
        private static PersistenceService persistenceService = null;
        //constructors
        JnlpPersistence() {
            setCodeBase();
            makePersistenceService();
        //private functions
        private void makePersistenceService() {
            if (persistenceService == null) {
                try {
                    persistenceService = (PersistenceService) ServiceManager.lookup("javax.jnlp.PersistenceService");
                } catch (UnavailableServiceException e) {
                    game.Log.debug("in JnlpPersistence.makePersistenceService(), got exception while getting instance of PersistenceService.  " + e.getMessage());
            assert persistenceService != null;
        private void setCodeBase() {
            if (codeBase == null) {
                BasicService bs;
                try {
                    bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
                    codeBase = bs.getCodeBase();
                } catch (UnavailableServiceException e) {
                    game.Log.debug("in JnlpPersistence.setCodeBase(), got exception while getting codeBase from.  " + e.getMessage());
            assert codeBase != null;
        //public functions
        @Override
        public InputStream getInputStream(String fileName) {
            String thisMethodsName = "in JnlpPersistence.getInputStream(), ";
            URL newFileUrl;
            FileContents newFc;
            try {
                newFileUrl = new URL(codeBase.toExternalForm() + fileName);
                newFc = persistenceService.get(newFileUrl);
                if (newFc == null) {
                    game.Log.debug(thisMethodsName + "filecontents is null for filename = " + fileName);
                    return null;
                if (!newFc.canRead()) {
                    game.Log.debug(thisMethodsName + "filecontents is not readable for filename = " + fileName);
                    return null;
            } catch (Exception e) {
                game.Log.debug(thisMethodsName + "caught exception while getting filecontents for filename = " + fileName + ".  " + e.getMessage());
                return null;
            InputStream is;
            try {
                is = newFc.getInputStream();
            } catch (Exception e) {
                game.Log.debug(thisMethodsName + "caught exception while getting input stream for filename = " + fileName + ".  " + e.getMessage());
                return null;
            return is;
        @Override
        public boolean createNewFile(String fileName) {
            URL newFileUrl;
            try {
                newFileUrl = new URL(codeBase.toExternalForm() + fileName);
                persistenceService.create(newFileUrl, CONSTANTS.MAX_PROFILE_FILE_SIZE);
            } catch (Exception e) {
                game.Log.debug("in JnlpPersistence.createNewFile, got exception while creating file with name = " + fileName + ".  " + e.getMessage());
                return false;
            return true;
        @Override
        public OutputStream getOutputStream(String fileName) {
            String thisMethodsName = "in JnlpPersistence.getOutputStream, ";
            URL newFileUrl;
            FileContents newFc;
            try {
                newFileUrl = new URL(codeBase.toExternalForm() + fileName);
                newFc = persistenceService.get(newFileUrl);
                if (newFc == null) {
                    game.Log.debug(thisMethodsName + "filecontents is null for filename = " + fileName);
                    return null;
                if (!newFc.canWrite()) {
                    game.Log.debug(thisMethodsName + "filecontents is not writeable for filename = " + fileName);
                    return null;
            } catch (Exception ex) {
                game.Log.debug(thisMethodsName + "caught exception while getting filecontents for filename = " + fileName + ".  " + ex.getMessage());
                return null;
            OutputStream os;
            try {
                os = newFc.getOutputStream(true);
            } catch (Exception e) {
                game.Log.debug(thisMethodsName + "caught exception while getting OutputStream for filename = " + fileName + ".  " + e.getMessage());
                return null;
            return os;
    }StandalonePersistence
    public class StandalonePersistence implements PersistenceApi {
        //private variables
        private final String SAVE_DIR = ".tm" + CONSTANTS.PATH_DELIMITTER;
        private String savePath;
        private File savePathFile;
        //constructor
        StandalonePersistence() {
            savePath = System.getProperty(game.CONSTANTS.STANDALONE_INSTALL_DIR_SYSTEM_PROPERTY) + CONSTANTS.PATH_DELIMITTER + SAVE_DIR;
            savePathFile = new File(this.savePath);
            if (savePathFile.exists() == false) {
                savePathFile.mkdir();
        //public functions
        @Override
        public InputStream getInputStream(String fileName) {
            String thisMethod = "in StandalonePersistence.getInputStream, ";
            File file = new File(savePath + CONSTANTS.PATH_DELIMITTER + fileName);
            if (file.exists() == false) {
                game.Log.debug(thisMethod + "file does not exist");
                return null;
            if (file.canRead() == false) {
                game.Log.error(thisMethod + "file is not readable");
                return null;
            InputStream is = null;
            try {
                is = new FileInputStream(file);
            } catch (FileNotFoundException e) {
                game.Log.error(thisMethod + "got exception while getting inputStream. " + e.getMessage());
            return is;
        @Override
        public boolean createNewFile(String fileName) {
            File file = new File(savePath + CONSTANTS.PATH_DELIMITTER + fileName);
            try {
                return file.createNewFile();
            } catch (IOException ex) {
                game.Log.error("in StandalonePersistence.createNewFile, got exception while creating file " + fileName + ".  " + ex.getMessage());
                return false;
        @Override
        public OutputStream getOutputStream(String fileName) {
            String thisMethod = "in StandalonePersistence.getOutputStream, ";
            File file = new File(savePath + CONSTANTS.PATH_DELIMITTER + fileName);
            if (file.exists() == false) {
                game.Log.debug(thisMethod + "file does not exist");
                if (this.createNewFile(fileName) == false) {
                    return null;
                game.Log.debug(thisMethod + "created new file");
            if (file.canWrite() == false) {
                game.Log.error(thisMethod + "file is not writable");
                return null;
            OutputStream os = null;
            try {
                os = new FileOutputStream(file);
            } catch (FileNotFoundException e) {
                game.Log.error(thisMethod + "got exception while getting outputStream. " + e.getMessage());
            return os;
    }Edited by: jmart on Aug 30, 2012 11:17 AM
    Edited by: jmart on Aug 30, 2012 11:20 AM

  • Persistence Service

    Hi,
    did anyone try to save persistent object-references with an 1:n or n:m relationship?
    I read the ABAP-Objects Book, 1:1 relation is no problem, but poor hints to 1:n.
    There is a blog, that recommends to create a data-model object, that loads the 1-end-Objects first and then use the getItems-Method, to read the n-end objects.
    Is it possible to map 1:n or n:m with object services? And if it is, should we use it in a productive environment? If it is possible, how to do it?
    Thanks very much!
    Ciao Björn Kibbel
    innobis AG

    cits wrote:
    Hi
    I use a persistence service, as in the example in http://java.sun.com/j2se/1.5.0/docs/guide/javaws/jnlp/javax/jnlp/PersistenceService.html
    sorry I meant
    http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/examples.html#PersistenceService

  • Delete ressource

    Hello,
    My application is develop in modules, each module is a jar.
    I have a big module which I separate in 3 modules, so in jnlp file I replace old ressource by 3 news.
    On some pc when I download app, I have got this message:
    com.sun.deploy.net.FailedDownloadException: Impossible de charger la ressource : http://www.xxx.fr/rcp/dist/modules/module_old_signed.jar
    at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
    at com.sun.javaws.LaunchDownload.downloadJarFiles(Unknown Source)
    at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
    at com.sun.javaws.Launcher.downloadResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
    at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
    at com.sun.javaws.Launcher.launch(Unknown Source)
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    On some pc I just have to relaunch app (jnlp) and it work, on some others I don't have message, on some others I need to clear cache to can launch app.
    Does I need, to use delete method of javax.jnlp.PersistenceService to delete old jar on client pc?
    How dos it work when client never download app, and so don't have this ressource?
    Thanks for your help.
    Laurent

    Sorry for my poor english.
    I try to explain with sample, I hope to be more understandable.
    Before
    Directories
    /dist/rcp_container_signed.jar
    /dist/modules/rcp_modules_signed.jar (very big)
    /dist/libs.jar
    My Jnlp:
    <resources>
        <jar href="dist/rcp_container_signed.jar" main="true"/>
      </resources>
      <resources>
        <jar href="dist/modules/rcp_modules_signed.jar"/>
      </resources>
    Now
    Directories
    /dist/rcp_container_signed.jar
    /dist/modules/rcp_common_signed.jar
    /dist/modules/rcp_billing_signed.jar
    /dist/modules/rcp_planning_signed.jar
    /dist/libs.jar
    My Jnlp:
    <resources>
        <jar href="dist/rcp_container_signed.jar" main="true"/>
      </resources>
      <resources>
        <jar href="dist/modules/rcp_common_signed.jar"/>
      </resources>
      <resources>
        <jar href="dist/modules/rcp_billing_signed.jar"/>
      </resources>
      <resources>
        <jar href="dist/modules/rcp_planning_signed.jar"/>
      </resources>

  • Architecture for saving configuration data between runs

    I have configuration state to maintain between runs of my application. Currently, I am using a combination of XMLEncoder/ XMLDecoder for object serialization and XMLEventReaders with custom XML files, no DTD or Schemas.
    These two will be used to maintain the state of windows, configuration options etc etc. The files are written to and read from an offset of the current working directory. During deployment, the end user will install where they see fit.
    Basically, I am looking for advice from anyone who's done this before and perhaps been bitten. Is there anything in this that's an anti-pattern?
    Alternatively, is there anyone who has arrived at this same approach, perhaps after trying other approaches and been bitten?
    TIA

    Within a Java Web Start application it might work better to use the jnlp PersistanceService API, since a sandboxed jnlp app may not have permission to use the prefs API.
    see:
    http://java.sun.com/javase/6/docs/jre/api/javaws/jnlp/javax/jnlp/PersistenceService.html
    /Andy

  • Problems with cursor and shortcuts when using JNLP services on MAC OS X

    After invoking the JNLP services on a MAC I loose the ability to set the cursor and invoke keyboard shortcuts. On Windows this is not a problem, so I believe it is a bug and I have reported it to Apple. Meanwhile, I would appreciate if someone could help me with finding a work-around. To identify the problem run the following code with Java Web Start (i.e., you need to add the program to a jar and launch it using a JNLP script). You also need to include the javax.jnlp package.
    Observe that the cursor changes to cross-hairs when entering the circle. After invoking the Open file menu item, the cursor does not change any longer. Shortcut key do not work either, but if you open the menu and close it again without selecting any of the menu items, the shortcuts are OK again.
    package bugreport;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.IOException;
    import javax.swing.*;
    import javax.jnlp.*;
    public class Demo2 extends JPanel implements Runnable, MouseMotionListener {
        private int centerX = 100;
        private int centerY = 100;
        private int radius = 50;
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Demo2());
        public void run() {
            int menuMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
            final JFrame frame = new JFrame("Bug Demo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setPreferredSize(new Dimension(200, 200));
            addMouseMotionListener(this);
            JMenuBar menuBar = new JMenuBar();
            frame.setJMenuBar(menuBar);
            //File menu
            JMenu fileMenu = new JMenu("File");
            fileMenu.setMnemonic('F');
            menuBar.add(fileMenu);
            //openMenuItem
            JMenuItem openMenuItem = new JMenuItem("Open...");
            openMenuItem.setMnemonic('O');
            openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, menuMask));
            openMenuItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    openFile();
            fileMenu.add(openMenuItem);
            frame.add(this);
            frame.pack();
            frame.setResizable(false);
            frame.setVisible(true);
        @Override
        public void paintComponent(Graphics g) {
            g.clearRect(0, 0, getWidth(), getHeight());
            g.setColor(Color.BLUE);
            g.fillOval(centerX - radius, centerY - radius, 2 * radius, 2 * radius);
        public void mouseDragged(MouseEvent e) {
        public void mouseMoved(MouseEvent e) {
            int dx = e.getX() - centerX;
            int dy = e.getY() - centerY;
            if (dx * dx + dy * dy < radius * radius) {
                setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
            } else {
                setCursor(Cursor.getDefaultCursor());
        private void openFile() {
            FileOpenService fos = null;
            try {
                fos = (FileOpenService) ServiceManager.lookup("javax.jnlp.FileOpenService");
            } catch (UnavailableServiceException ex) {
                JOptionPane.showMessageDialog(this, "Service unavailable", "Open", JOptionPane.ERROR_MESSAGE);
            if (fos != null) {
                try {
                    FileContents fc = fos.openFileDialog(null, null);
                } catch (IOException ex) {
                    JOptionPane.showMessageDialog(this, "Service unavailable", "Open", JOptionPane.ERROR_MESSAGE);
    }Edited by: James_Vagabond on Oct 29, 2009 9:35 AM

    Barbara, Thanks very much taking the time to respond to my posting. Your input and directions were just what I needed.I accessed the print settings in the pull down menu, setup the print options including the color profile for Elements and the Printer to sRGB, and printed my picture. This resolved all the invalid color problems I was having, but I did notice that there was a hint of magenta overall in the picture. I had read an article that said to use Canon Color Matching instead of Color Sync to prevent that but I couldn't make that change in the pull down menu. I tried in the Presets dialog box but that didn't appear to be possible. Should I make that change as well?
    Also, in my travels through Elements 13 I notice under Edit->Color Settings that there were options for No Color Mgmt, Optimize for Screen, for Printing, or ability to chose one or the other (real time I assume). How do those options fit into this scenario?
    Thanks again

  • How to relaunch a jnlp appli ?

    Hi,
    I have a JNLP application and, from inside it, I should want to stop it (easy), and then lauch automaticaly this appli.
    But how to know where is the jnlp file, from java code ?
    Thanks.

    Coralien wrote:
    ..I don't see "BasicFile" That is BasicService, if you are referring to the class of the JNLP API that Luca-Sanna mentioned.
    ..in the JRE Javadoc. I see it in a package "javax.jnlp". How I link this package with a desktop appli ?The javaws.jar, which contains the JNLP API classes, is automatically on the run-time class-path of applications launched using Java Web Start. To add it to the compile-time classpath, you simply add ${java.home}/lib/javaws.jar to the compilation class-path.
    I have a [demo of the BasicService|http://pscode.org/jws/api.html#bs] that includes downloadable source/build file/JNLP files. The build file demonstrates how to compile JNLP API code.
    .."This appli"... "JNLP appli"... and so on are desktop swing applications. All launched by jnlp.
    I should want to write some sort of javaws'compagnon, to reload an already javaws launched "application".
    So I write a little repository with the list of my jnlp applications. A JNLP application register in this registery, with its parameters. Later, I want to relauch them, so to say to javaws : "javaws jnlp-file"... but how I know "jnlp-file" ?Forget assembling javaws commands, use the BasicService, as suggested.
    That 'registry' can use the JNLP API PersistenceService. I also have a [demo. of the PersistenceService|http://pscode.org/jws/api.html#ps]. The idea would be that each app. registers its JNLP URL when it first installs. To do that, you might create an HashMap with app. title as keys for the JNLP URL (as the map value). On start-up of your 'controller/launcher app.', it checks the map and iterates an enumeration of the keys to discover what apps. are installed, and what the URL of their JNLP is. Once that is known, assemble them into the controller app. GUI as appropriate, and you are in business to provide a launcher app.
    As to stopping and restarting particular applications, that is much harder. After launching the apps., the controller has no automatic reference to them, and might, unless they use the SingleInstanceService, launch multiple versions of them.
    If you want the controller app. to be aware of, and to communicate with, the controlled applications, you would need to do something like have them communicate via sockets.
    For ensuring application update, the only actual reason I can think of to stop and restart an app, it makes much more sense to either use the automatic update options offered by the web start clients, or take programmatic control of updates within each app. To do the latter, see the DownloadService.
    I do not have a (good) demo. of the DownloadService.
    Oh, and as an aside. Your questions are not very clear to me, but if I guess right, part of what you are asking is "How go I get a reference to the version of the JNLP stored on the local file system?". You don't need to. Use the original URL that the application JNLP came from. If it is cached locally, the web start client should automatically use the cached copy (after checking for updates, of course!).

  • How do I protect my JNLP, my JARs etc. (with Basic Authentication)???

    hi all,
    i know that there is a FAQ ( [see here|http://lopica.sourceforge.net/faq.html#obfuscate] ) answering a related question with "You can use an obfuscator...". ok, but is there really no other solution?
    this is the simplified folder structure of my application on the server:
    [application]
      [etc]
        xyz.xml
      [jars]
        myapp.jar
      launch.jnlp
    website.jsp
    initial start and basic authentication:*
    my first idea was to secure everything underneath "application" with basic authentication via my web.xml (yes, i'm aware of the security concerns). this means everybody can access my website (here: website.jsp) which contains a start button that links to "launch.jnlp". as soon as the user clicks on it, the browser opens its standard authentication dialog since launch.jsp is in a protected area. after entering the correct credentials the jnlp-file is downloaded and java web start takes over control. first of all it seems as it tries to access the same jnlp-file again (??? --> probably in order to check for changes in the jnlp file --> this is certainly not the case for the initial startup) and then wants to download the relevant jar (myapp.jar). because both resources are protected jws opens its own basic authentication dialog where i have to enter the same credentials the second time. as far as i know, there is no solution to pass the credentials between the browser and the jvm.
    second start and basic authentication:*
    if the user starts my application for the 2nd, 3rd, ... time via desktop-link (set in jnlp-file) there is no need for accessing my website with a browser. therefore only the authentication dialog of jws gets displayed. so far, so good!
    and now the actual problem:*
    during runtime my application (signed with verisign certificate and having all permissions) uses commons-vfs and commons-httpclient to access resources on the same server (e.g. etc/xyz.xml). since they're underneath the protected "application" directory as well, my application needs the same credentials the user already entered in the authentication dialog of jws. now i could retrieve these credentials by calling Authenticator.requestPasswordAuthentication() within my application and passing them to vfs and httpclient. however, doing so opens up jws' authentication dialog again. grrr!!! is there a way to prevent this?
    related thougts:*
    i know i could disable jws' default Authenticatior and set my own Authenticator which might be able to return already entered credentials without opening the dialog a second time. however, it seems that even with <property name="javaws.cfg.jauthenticator" value="none" /> jws still opens its own dialog when acessing the JNLP file and the relevant JARs during the startup/download phase. of course, who else if not jws could handle that phase? my application might not even be downloaded at this point. so i guess setting my own Authenticator would not be a solution either (at least not if i want to secure my jnlp and my jars, too). quite the contrary, it would have to open another dialog... :-(
    my current solution:*
    for the moment i use jws' default Authenticatior which allows me to easily protect all my stuff on the server side (jnlp, jar, etc). i can live with the two login dialogs at the initial startup. and instead of querying the credentials from jws' default Authenticatior at runtime, i set two system properties for username and password in the (protected) jnlp-file, query them at runtime and hand it to vfs and httpclient. this prevents the 2nd (or 3rd) dialog but is definitely not a great solution. most of all i'm not happy with the fact that this somehow "destroys" the container-based security advantage of easily configuring authorized users via a separate mechanism e.g. tomcat-users.xml. now there has to be one master-password that has to be set in the jnlp-file! grrr!
    a possible alternative:*
    i'm not sure but would it be better to secure everything with form-based authentication on the website, and dynamically generate username and password into the jnlp-file? but what happens when the admin changes the password on the server and the user starts its application via desktop-link??? in case of basic authentication i think jws would popup the login dialog again. however, if i use the old username and password generated into the jnlp it won't work. i think the user then has to access the website again. this is not good at all! :-(
    the only real solution:*
    should i write a small application which can be downloaded by everybody and on startup queries the user's credentials, validates them with the help of our server, and uses the javax.jnlp-api to download the secured JARs of my real application? this seems so much overkill! does anybody have experiences with this approach? how difficult is it to implement the whole download/update stuff with javax.jnlp?
    WHAT HAVE I MISSED???
    AM I COMPLETELY WRONG???
    WHAT IS THE EASIEST WAY???
    AND WHAT IS THE BEST WAY???
    thank you so much,
    stephan

    Not sure, whether I understood correctly, what you wanna do - but up to now I can't see any problem.
    if you have a structure like this:
    /ctxroot/
           launch.jnlp
           /app/
               *.jar
               *.whateveryou may use in your web.xml:
         <servlet>
              <servlet-name>JnlpDownloadServlet</servlet-name>
              <servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>JnlpDownloadServlet</servlet-name>
              <url-pattern>*.jnlp</url-pattern>
              <url-pattern>/app/*</url-pattern>
         </servlet-mapping>
         <security-constraint>
              <web-resource-collection>
                   <web-resource-name>Application</web-resource-name>
                   <url-pattern>/app/*</url-pattern>
                   <http-method>GET</http-method>
                   <http-method>POST</http-method>
              </web-resource-collection>
              <auth-constraint>
                   <role-name>bla</role-name>
                   <role-name>fahsel</role-name>
              </auth-constraint>
              <user-data-constraint>
                   <transport-guarantee>CONFIDENTIAL</transport-guarantee>
              </user-data-constraint>
         </security-constraint>
         <security-constraint>
              <web-resource-collection>
                   <web-resource-name>Subscription</web-resource-name>
                   <url-pattern>*.jnlp</url-pattern>
              </web-resource-collection>
              <user-data-constraint>
                   <transport-guarantee>CONFIDENTIAL</transport-guarantee>
              </user-data-constraint>
         </security-constraint>
         <login-config>
              <auth-method>BASIC</auth-method>
              <realm-name>whatever-realm</realm-name>
         </login-config>
         <security-role><role-name>bla</role-name></security-role>
         <security-role><role-name>fahsel</role-name></security-role>
    ...Than you may use the Service stuff like:
         BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
         URL codeBase = bs.getCodeBase();
         URL pu = new URL(codeBase.toString() + "whatever.bla");
         HttpURLConnection res = (HttpURLConnection) pu.openConnection();
         res.setInstanceFollowRedirects(true);
         res.setRequestMethod("GET");
         res.setConnectTimeout(10 * 60 * 1000);
         res.connect();
         String enc = res.getContentType();
    ...Where is the problem? If you wanna intercept certain "calls" to an app resource, just use a filter, which decides, whether to answer the request directly by itself or to pass it to the JnlpDownloadServlet ...

Maybe you are looking for

  • Blue desktop screen, no screensavers or desktop pix after 10.5.8 update

    Immediately after updating to 10.5.8 - using the Combo updater and yes, fixing permissions before and after the update - I was brought to my familiar desktop with the standard issue blue background. I tried accessing the Desktop/Screensaver preferenc

  • Linux guy wants to install solaris 10 via nfs using centos as nfs server

    well in linux when installing this way I simply copy the dvd install image to an nfs share (or do mount -o loop "isoimage" /nfsmountdir), copy the boot.iso so a cdrom and do a "linux askmethod" during install and then specify the nfs server and dir.

  • Creating a logo

    Hello, I have read on this forum that using Indesign CS3 to create a logo is not as effective as using Illustrator. However, to purchase Illustrator and to go through a learning curve would be a significant effort on my part. Therefore as I am now fa

  • 2.6.38 has broken lirc (or is it me?)

    Hi, I tried for a few hours to get Lirc to work and everything seems to be just fine. No errors in any logging (dmesg, lircd and lircd.1) and lircd starts just fine (restarts just fine as well). Yet when i run irw and press some remote controls i see

  • How to outline a sponsors logo in white, for a dark background

    I need to add a white outline to a sponsors eps logo and I am using Illustrator CS2 V 12 can anyone give detailed instructions please. Thank You*