1 2 Previous Next 24 Replies Latest reply on Feb 21, 2012 11:21 AM by jaikiran Go to original post
      • 15. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
        jlavezzo

        Yeah, sorry, man.  I wasn't trying to belittle your documentation.  Documentation is awesome. Documentation is a hassle. It's a lot of work. I appreciate actively maintained documentation. But for the problem described in this forum post, "RTFM" isn't an answer. Especially when someone already pointed out that what we're trying to do is prevented by a bug in JBoss.  And, you have to admit, that page you linked to is really far from fully baked. This classloader stuff is all about context. From where, to where.  And, I'm still not really liking this term, "Deployment". Just doesn't parse well in English.  Sounds like, "Shelving."

         

        Part of what's going on is a misunderstanding.  On the one hand, if all you want to do is get geoserver running, it's possible that you can modify the module.xml in modules/sun/jdk/main and be good to go. However, if you have some responsibilty for maintaining and distributing the GeoServer.war and want to make it run without modification, it's possible that a jboss-deployment-structure.xml packaged in there will do the trick, once the bug in JBoss that prevents references to classes in rt.jar is resolved.

         

        So, again, sorry for putting you down.  To make it up, once I get geoserver running correctly alongside the rest of my app I'll come back and try to spiff up the class loading page and anything else I can help with.

        • 16. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
          jaikiran

          Jeff Lavezzo wrote:

           

          Yeah, sorry, man.  I wasn't trying to belittle your documentation.  Documentation is awesome. Documentation is a hassle. It's a lot of work. I appreciate actively maintained documentation. But for the problem described in this forum post, "RTFM" isn't an answer.

          Okay, then I admit I misunderstood your previous post then. I thought you were talking about the documentation in general. I'm sorry about that.

           

           

          Jeff Lavezzo wrote:

           

           

          Part of what's going on is a misunderstanding.  On the one hand, if all you want to do is get geoserver running, it's possible that you can modify the module.xml in modules/sun/jdk/main and be good to go. However, if you have some responsibilty for maintaining and distributing the GeoServer.war and want to make it run without modification, it's possible that a jboss-deployment-structure.xml packaged in there will do the trick, once the bug in JBoss that prevents references to classes in rt.jar is resolved.

           

          I haven't looked at the geoserver.war but I'll add a section on adding system dependencies via jboss-deployment-structure.xml in that chapter. You are right about the bug - it's present in 7.1.0.CR1b but fixed in latest nightly builds (which will soon be 7.1.0.Final).

           

           

          Jeff Lavezzo wrote:

           

          So, again, sorry for putting you down.  To make it up, once I get geoserver running correctly alongside the rest of my app I'll come back and try to spiff up the class loading page and anything else I can help with.

          Thank you! And yeah apologies again - I just woke up and saw that post and got a bit cranky

          • 17. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
            andilog

            David Robinson.

            Did you try to put your .jar into WEB-INF/lib directory?

            You also could try to add dependecy in MANIFEST.MF, example:

            Manifest-Version: 1.0

            Class-Path:

            Dependencies: org.jboss.security.negotiation

             

             

            (Two blank lines at the end.)

            • 18. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
              mr-l

              Andreas Martin wrote:

               

              Did you try to put your .jar into WEB-INF/lib directory?

              This was very helpful, thanks Andreas!

              • 19. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
                guinotphil

                I don't know if this is going to help, but to use imageio on my application server, I added the following modules to my AS 7.1.0.Final:

                 

                javax.media.jai

                <module xmlns="urn:jboss:module:1.1" name="javax.media.jai">

                    <dependencies>

                        <module name="com.sun.media.jai" export="true">

                            <exports>

                                <include-set>

                                    <path name="javax/media/jai"/>

                                    <path name="javax/media/jai/**"/>

                                </include-set>

                            </exports>

                        </module>

                    </dependencies>

                </module>

                 

                 

                javax.imageio.api

                <module xmlns="urn:jboss:module:1.1" name="javax.imageio.api">

                    <dependencies>

                        <system export="true">

                            <paths>

                                <path name="javax/imageio"/>

                                <path name="javax/imageio/event"/>

                                <path name="javax/imageio/metadata"/>

                                <path name="javax/imageio/plugins/bmp"/>

                                <path name="javax/imageio/plugins/jpeg"/>

                                <path name="javax/imageio/spi"/>

                                <path name="javax/imageio/stream"/>

                            </paths>

                        </system>

                        <module name="com.sun.media.jai.imageio" services="import"/>

                    </dependencies>

                </module>

                 

                 

                com.sun.media.jai

                <module xmlns="urn:jboss:module:1.1" name="com.sun.media.jai">

                    <dependencies>

                        <module name="javax.api"/>

                    </dependencies>

                 

                    <resources>

                        <resource-root path="mlibwrapper-jai-1.1.3.jar"/>

                        <resource-root path="jai-core-1.1.3.jar"/>

                        <resource-root path="jai-codec-1.1.3.jar"/>

                        <!-- Insert resources here -->

                    </resources>

                </module>

                 

                with native libmlib_jai in lib/linux-i686, lib/linux-x86_64, lib/win-i686 subdirectories of the module.

                 

                 

                 

                com.sun.media.jai.imageio

                <module xmlns="urn:jboss:module:1.1" name="com.sun.media.jai.imageio">

                    <dependencies>

                        <module name="javax.api"/>

                        <module name="javax.imageio.api"/>

                        <module name="com.sun.media.jai"/>

                    </dependencies>

                 

                    <resources>

                        <resource-root path="clibwrapper-jiio-1.1.jar"/>

                        <resource-root path="jai-imageio-1.1-evenium.jar"/>

                        <!-- Insert resources here -->

                    </resources>

                </module>

                 

                with native libclib_jiio in lib/linux-i686, lib/linux-x86_64, lib/win-i686 subdirectories of the module.

                 

                 

                 

                In jboss-deployement-struture, add dependency to

                <module name="javax.media.jai" />

                 

                And in the javax.api module, I removed

                                <path name="javax/imageio"/>

                                <path name="javax/imageio/event"/>

                                <path name="javax/imageio/metadata"/>

                                <path name="javax/imageio/plugins/bmp"/>

                                <path name="javax/imageio/plugins/jpeg"/>

                                <path name="javax/imageio/spi"/>

                                <path name="javax/imageio/stream"/>

                 

                But added a dependency to

                <module name="javax.imageio.api" export=true />

                 

                 

                Finally, you need to add manually at statup the imageIO implementations to the IIORegistry, because the ImageIO classes won't be find in the system's classloader.

                To do so, simply run this code at startup:

                                    final Class<?> pluginClass;

                                    try {

                                              pluginClass = Class.forName("com.sun.media.imageioimpl.common.PackageUtil");

                                    } catch (ExceptionInInitializerError e) {

                                              log.error("Could not register JAI ImageIO plugins", e);

                                              return;

                                    } catch (ClassNotFoundException e){

                                              log.info("No JAI ImageIO plugins to register", e);

                                              return;

                                    }

                                    final ClassLoader loader = pluginClass.getClassLoader(); // We use impl class loader, as we load from the JAR

                 

                                    final IIORegistry serviceRegistery = IIORegistry.getDefaultInstance();

                                    final Iterator<Class<?>> categories = serviceRegistery.getCategories();

                 

                                    while (categories.hasNext()) {

                                              final Class<?> c = categories.next();

                                              final Iterator<IIOServiceProvider> riter = (Iterator<IIOServiceProvider>) Service.providers(c, loader);

                 

                                              while (riter.hasNext()) {

                                                        serviceRegistery.registerServiceProvider(riter.next());

                                              }

                             }

                • 20. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
                  jaikiran

                  I just downloaded the geoserver.war and all I did was add a jboss-deployment-structure.xml in the .war/WEB-INF folder with the following contents:

                   

                  <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
                      <deployment>
                          <dependencies>
                              <system>
                                  <paths>
                                      <path name="com/sun/imageio/spi"/>
                                  </paths>
                              </system>
                          </dependencies>
                      </deployment>
                  </jboss-deployment-structure>
                  

                   

                  That's it, the deployment succeeded:

                   

                  14:19:18,061 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "geoserver.war"
                  

                   

                  This is against AS 7.1.0.Final.

                  • 21. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
                    brandondash

                    jaikiran pai wrote:

                     

                    I just downloaded the geoserver.war and all I did was add a jboss-deployment-structure.xml in the .war/WEB-INF folder with the following contents:

                    That's it, the deployment succeeded:

                    This is against AS 7.1.0.Final.

                    Verified works using this process in 7.1.0

                     

                    Does NOT work in 7.0.2 following this process.

                    • 22. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
                      jaikiran

                      Brandon Biondo wrote:

                       

                       

                      Does NOT work in 7.0.2 following this process.

                      That wasn't supported in 7.0.2.

                      • 23. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
                        brandondash

                        jboss-deployment-structure.xml isn't supported in 7.0.2? What is the proper method then?

                        • 24. Re: ClassNotFoundException com.sun.imageio.spi.FileImageInputStreamSpi
                          jaikiran

                          Brandon Biondo wrote:

                           

                          jboss-deployment-structure.xml isn't supported in 7.0.2? What is the proper method then?

                          I meant the ability to specify "system" dependency paths via the jboss-deployment-structure.xml wasn't supported in AS 7.0.2. The 1.1 xsd of that xml has support for this and is introduced only in 7.1.0.Final. IIRC, the only way to fix this in 7.0.2 was to update the sun.jdk module.

                          1 2 Previous Next