1 2 Previous Next 27 Replies Latest reply on May 21, 2004 5:36 PM by 800382

    Applets and Plug-ins

    807595
      I am new to using applets and plug-ins, can anyone tell me why I am getting this error?

      Using 1.4 Plug-in and IE.
      It works when I use JBuilder as my client contacting the same Server, but when
      I use a Browser with the same source I get these exceptions. One other difference
      is that I combine the Jar contents of the JDom and my applet when using JBuilder,
      but the Server has them separated and named in the HTML.

      java.util.zip.ZipException: duplicate entry: META-INF/
           at java.util.zip.ZipOutputStream.putNextEntry(Unknown Source)
           at sun.plugin.cache.CachedJarLoader.decompress(Unknown Source)
           at sun.plugin.cache.CachedJarLoader.access$500(Unknown Source)
           at sun.plugin.cache.CachedJarLoader$5.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at sun.plugin.cache.Cache.privileged(Unknown Source)
           at sun.plugin.cache.CachedJarLoader.download(Unknown Source)
           at sun.plugin.cache.CachedJarLoader.load(Unknown Source)
           at sun.plugin.cache.JarCache.get(Unknown Source)
           at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
           at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
           at sun.misc.URLClassPath$JarLoader.getJarFile(Unknown Source)
           at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
           at sun.misc.URLClassPath$2.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at sun.misc.URLClassPath.getLoader(Unknown Source)
           at sun.misc.URLClassPath.getLoader(Unknown Source)
           at sun.misc.URLClassPath.getResource(Unknown Source)
           at java.net.URLClassLoader$2.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at java.net.URLClassLoader.findResource(Unknown Source)
           at sun.applet.AppletClassLoader.findResource(Unknown Source)
           at sun.plugin.security.PluginClassLoader.findResource(Unknown Source)
           at java.lang.ClassLoader.getResource(Unknown Source)
           at java.lang.ClassLoader.getResourceAsStream(Unknown Source)
           at sun.applet.AppletClassLoader.getResourceAsStream(Unknown Source)
           at javax.xml.parsers.FactoryFinder.find(Unknown Source)
           at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
           at org.jdom.input.JAXPParserFactory.createParser(JAXPParserFactory.java:112)
           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.jdom.input.SAXBuilder.createParser(SAXBuilder.java:462)
           at org.jdom.input.SAXBuilder.build(SAXBuilder.java:341)
           at org.jdom.input.SAXBuilder.build(SAXBuilder.java:745)
           at st.Parser.parseConfigXML(Parser.java:52)
           at st.Applet1.parseInputFile(Applet1.java:326)
           at st.Applet1.init(Applet1.java:226)
           at sun.applet.AppletPanel.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)
      java.util.zip.ZipException: duplicate entry: META-INF/
           at java.util.zip.ZipOutputStream.putNextEntry(Unknown Source)
           at sun.plugin.cache.CachedJarLoader.decompress(Unknown Source)
           at sun.plugin.cache.CachedJarLoader.access$500(Unknown Source)
           at sun.plugin.cache.CachedJarLoader$5.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at sun.plugin.cache.Cache.privileged(Unknown Source)
           at sun.plugin.cache.CachedJarLoader.download(Unknown Source)
           at sun.plugin.cache.CachedJarLoader.load(Unknown Source)
           at sun.plugin.cache.JarCache.get(Unknown Source)
           at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
           at sun.plugin.net.protocol.jar.CachedJarURLConnection.getInputStream(Unknown Source)
           at java.net.URL.openStream(Unknown Source)
           at java.lang.ClassLoader.getResourceAsStream(Unknown Source)
           at sun.applet.AppletClassLoader.getResourceAsStream(Unknown Source)
           at javax.xml.parsers.FactoryFinder.find(Unknown Source)
           at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
           at org.jdom.input.JAXPParserFactory.createParser(JAXPParserFactory.java:112)
           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.jdom.input.SAXBuilder.createParser(SAXBuilder.java:462)
           at org.jdom.input.SAXBuilder.build(SAXBuilder.java:341)
           at org.jdom.input.SAXBuilder.build(SAXBuilder.java:745)
           at st.Parser.parseConfigXML(Parser.java:52)
           at st.Applet1.parseInputFile(Applet1.java:326)
           at st.Applet1.init(Applet1.java:226)
           at sun.applet.AppletPanel.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)
        • 1. Re: Applets and Plug-ins
          800387
          Don't use applets. This will sound snotty and nonsensical. But the only people, period, who write applets are college students and project managers who are five years late on jargon.

          There are a few cases where you do need applets (peer to peer architectures, advanced cryptography, etc.) However, I very rarely see anyone posting writing those applications. Normally, it is in a book somewhere or in a professor's head. How often do you truly need a rich client in a web architecture?

          If you insist on writing an applet, it really should be compatible with JDK 1.1. Otherwise, your users will have to download and install the appropriate JRE or plug-in. If you get frustrated writing a user interface with AWT, welcome to the club. There are very few members of that club still writing applets.

          - Saish

          "My karma ran over your dogma." - Anon
          • 2. Re: Applets and Plug-ins
            807595
            Well I am certainly no expert on the topic but Applets are rampant throughout this
            organization and growing. Needing to load a client for a java application is sometimes
            annoying so often the functionality is deployed using Applets.

            It's academic anyway, because this Applet needs to work. Can anyone help here?
            • 3. Re: Applets and Plug-ins
              807595
              Does this mean that you cannot use Swing from within an Applet? AWT is sucky, but eventually I want to write an Applet because......well.......I find Applets fun :)
              • 4. Re: Applets and Plug-ins
                800387
                I'll let it lie after this. They have a nifty piece of client software on their PC already, a browser. That's the beauty of servlets. A lot of organizations went down the fat-client path with applets. .NET is making another stab at as we speak. If AWT wasn't so broken, applets might have taken off.

                BTW, you still need them to download the plugin if you want an applet later than 1.1. I don't see the difference between this and installing Java to run an application.

                The above is, I realize, not helpful. I just try and warn people whenever I can about the pitfalls of applets. Best of luck!

                - Saish

                "My karma ran over your dogma." - Anon

                PS: Have you manually inspected the ZIP file to see if there are, in fact, duplicate entries somehow in there?
                • 5. Re: Applets and Plug-ins
                  800382
                  Sounds like a bad zip file.
                  If AWT wasn't so broken, applets might have taken off.
                  AWT has nothing to do with it. You can make a crappy AWT desktop app just as easily as a crappy AWT applet. The reason there were problems with applets is because the JVMs used before Sun put out the plugin were all written by the browser makers, and those JVMs were buggy and lagged behind Sun's JDK developments.
                  If you insist on writing an applet, it really should be compatible with JDK 1.1.
                  I disagree. The plugin is a requirement for almost all cases anyway. IE6 still has a Java 1.1.4 JVM built in, but the next version of IE is supposed to have that removed. Netscape 7 and any others need the plugin. (Netscape 4 is just as bad for HTML as applets anyway, so...). Might as well use JDK 1.4 and Swing and force installation of the 1.4 plugin.
                  I don't see the difference between this and installing Java to run an application.
                  The difference between applets and application is just that: installation (of the application). Both need the JRE, of course, so that's really irrelevant. WebStart is an alternative to applets, although it's about 99% the same as an applet anyway. Just that it runs outside of the browser.

                  There are some things that HTML, CSS and Javascript (aka DHTML) can't do. I'm not saying you should just use applets anyway. You need to understand the issues that using applets can have, especially for generally public sites. If there is a driving need to use an applet (or WebStart), then by all means, feel free to use it. But know the limitations and/or benefits. If you can find a way to do the application as a web-based (HTML, maybe some Javascript, which has it's own issues) then I would lean in that direction only because it will be simpler for people to use.
                  • 6. Re: Applets and Plug-ins
                    807595
                    I do understand your Applet warnings, but as I said they are Academic.
                    I need to solve the problem and am already stuck with it.

                    As for the Jar, I can solve the problem when I Jar all of the jar files together.
                    Maybe the problem is in my html. If I refer to the one combined Jar it is fine,
                    but if I separate the jars and refer as shown below it throws that exception.

                    I am using open source Jars and I don't want to run into licensing problems.
                    So I cannot combine the Jars.

                    <OBJECT
                    classid = "clsid:CAFEEFAC-0014-0000-0000-ABCDEFFEDCBA"
                    codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_0-win.cab#Version=1,4,0,0"
                    WIDTH = 600 HEIGHT = 500 HSPACE=0 VSPACE=0 ALIGN=bottom>
                    <PARAM NAME = "CODE" VALUE = "st.Applet1.class">
                    <PARAM NAME = "CODEBASE" VALUE= ".">
                    <PARAM NAME = "ARCHIVE"
                    VALUE = "web/Applet1.jar,web/jdom.jar,web/graphics.jar">
                    <PARAM NAME = "Menu" VALUE = /mr/web/D.xml>
                    <<PARAM NAME = "type" VALUE = "application/x-java-applet;version=1.4">
                    <PARAM NAME = "scriptable" VALUE = "false">
                    <COMMENT>
                    <EMBED type = "application/x-java-applet;version=1.4"
                    CODE = "st.Applet1.class"
                    ARCHIVE = "web/Applet1.jar,web/jdom.jar,web/graphics.jar"
                    WIDTH = 600 HEIGHT = 500 scriptable = false
                    pluginspage = "http://java.sun.com/products/plugin/index.html#download">
                    <PARAM NAME ="Menu" VALUE = /mr/web/D.xml>
                    <NOEMBED>
                    Support for JDK 1.4 could not be found.
                    </NOEMBED>
                    </EMBED>
                    </COMMENT>
                    </OBJECT>
                    • 7. Re: Applets and Plug-ins
                      800382
                      So if you define the jars separately in the archive attribute, it's a problem, but if you jar those jars in a single jar (in the archive) attribute, it's fine?

                      Does "Jar all of the jar files together" mean you have a jar that contains several jar files, or do you mean you extract all the jars and create 1 common jar? If it's the former, then I don't see how that would work at all unless you have a custom classloader.

                      There should only be one META-INF directory and only one manifest file. And they should be in the root of the jar's directory structure. Maybe it's a problem with your JBuilder configuration?
                      • 8. Re: Applets and Plug-ins
                        807595
                        So if you define the jars separately in the archive
                        attribute, it's a problem, but if you jar those jars
                        in a single jar (in the archive) attribute, it's fine?
                        correct.
                        Does "Jar all of the jar files together" mean you have
                        a jar that contains several jar files, or do you mean
                        you extract all the jars and create 1 common jar? If
                        no, it is the latter. All of the Jar contents in one jar.

                        >
                        There should only be one META-INF directory and only
                        one manifest file. And they should be in the root of
                        the jar's directory structure. Maybe it's a problem
                        with your JBuilder configuration?
                        JBuilder works fine. When I deploy the Jar it creates it works because it
                        is one jar. But when I build only my jar and then deploy the other jars and
                        modify the html to look for multiples, it does not work. Clients cannot
                        seem to find the other jars.

                        • 9. Re: Applets and Plug-ins
                          807595
                          Don't use applets.
                          Oh.
                          This will sound snotty and
                          nonsensical.
                          Insightful of you.

                          But the only people, period, who write
                          applets are college students and project managers who
                          are five years late on jargon.
                          Oh? I see.
                          "My karma ran over your dogma." - Anon
                          Ah. And this ..This is a warning against dogmatism ??

                          • 10. Re: Applets and Plug-ins
                            807595
                            Don't use applets.
                            Is there another way to maintain a persistent connection between a browser and a server? E.g. you can use an applet on the client side and a servlet on the server side.

                            As for the AWT comment, I slightly agree with you. Basically, both AWT and Swing require a large amount of understanding to do well. If you are using an applet, then if possible it is a good idea to do the GUI using HTML. Although, IE keeps crashing when I use DHTML, bloody mshtml.dll.

                            I think applets have a place, although my place for them is in the back :)
                            • 11. Re: Applets and Plug-ins
                              807595
                              When I deploy the Jar it creates
                              it works because it
                              is one jar. But when I build only my jar and then
                              deploy the other jars and
                              modify the html to look for multiples, it does not
                              work. Clients cannot
                              seem to find the other jars.
                              Did you extract the jars.. If so did you notice multiple META-INF directories.. I agree with what has already been suggested, it sounds like the problem may be with one of these jar files. It may have an extra META-INF directory. This issue you have eliminated by recombining them into a single jar which may explain why it is able to run that way.

                              This may not help, but you could try a change to the html tag. I notice in your archive value for your jar files you are including the name of the directory "web" where they reside. I suggest changing the value of Codebase, which is the base url of the applet, to be "web" which is interpreted to be relative to the location of the html file, rather than pointing to the same location as the html if that isn't where the applet is.

                              <param name="codebase" value="web">

                              Then, assuming that all of the jars are within this directory, use only the jar names for the archive values.

                              <param name="archive" value="Applet1.jar,jdom.jar,graphics.jar">


                              • 12. Re: Applets and Plug-ins
                                800387
                                Sigh.

                                Yes, there are cases where you need to write an applet (I alluded to a few of them). And I take the criticism that I myself was being dogmatic, however there is also a general thrust in academia to force students to learn applets. They would be much better served with additional design work or learning anti-patterns (probably too early to learn actual patterns).

                                I'll probably get it again for this, but if you had a choice between AWT and Swing, why would you ever opt for the former? Yet, everyone that wants to write an applet compatible with the vast majority of browsers is stuck with AWT. Can a user download a plug-in? Of course. But the vast majority of users would have no idea what they were installing. A certain number would not even bother. So, if you are going to have a publicly-accessible web site, why would you choose a technology that is hobbled from the get-go?

                                I agree 100% that you cannot do everything with Javascript, HTML and servlets. But people are comfortable with a browser interface. Even though that model has serious limitations, most developers nowadays go through the exercise of circumventing HTTP's limitations.

                                Why do all of this when applets exist? Project managers, designers and programmers have been voting their choice for years. Applets did not make the cut.

                                That having been said, as this applet appears to be for internal, corporate use, their users can be forced to download the plug-in. But for a public site, one that presumably is attempting to make money, would you use one?

                                - Saish

                                "My karma ran over your dogma." - Anon
                                • 13. Re: Applets and Plug-ins
                                  800382
                                  JBuilder works fine. When I deploy the Jar it creates
                                  it works because it
                                  is one jar. But when I build only my jar and then
                                  deploy the other jars and
                                  modify the html to look for multiples, it does not
                                  work. Clients cannot
                                  seem to find the other jars.
                                  I don't know how it can mistake 2 separate jar files' META-INF directories or whatever it's really saying. What version of the plugin is it? Have you tried searching the bug database on this site for that error?
                                  • 14. Re: Applets and Plug-ins
                                    807595
                                    This may not help, but you could try a change to the html tag. I notice in your archive value for your jar files >you are including the name of the directory "web" where they reside. I suggest changing the value of >Codebase, which is the base url of the applet, to be "web" which is interpreted to be relative to the >location of the html file, rather than pointing to the same location as the html if that isn't where the applet >is.
                                    Maybe I don't understand the meaning here. I thought that codebase in this case is what forces
                                    users to load the plug-in. Without it, there would be no place to find it.
                                    I don't know how it can mistake 2 separate jar files'
                                    META-INF directories or whatever it's really saying.
                                    What version of the plugin is it? Have you tried
                                    searching the bug database on this site for that
                                    error?
                                    The Plug-in is 1.4. Yes, believe me I did quite a bit of digging on it.
                                    I am confused by some of the other postings suggesting that META-INFs in each Jar
                                    would confuse the loader. Isn;t it expected that each Jar would have their own. It should
                                    be easy to resolve. Am I right?
                                    1 2 Previous Next