Question

I am using java JDK 7 in my attempt to build cocoon 2.1.10 on Windows 2008 R2 for eventual deployment in Tomcat 7. I have downloaded the cocoon source files, unzipped them, set my JAVA_HOME variable and then tried to run the build.bat file provided. I get 11 different compilation errors.



    D:\cocoon-2.1.10-src\cocoon-2.1.10>build.bat
    Buildfile: build.xml

    prepare:
    ====================================================================
                     Apache Cocoon 2.1.10 [1999-2006]
    ====================================================================
     Building with Apache Ant version 1.6.5 compiled on June 2 2005
    --------------------------------------------------------------------
     Using build file D:\cocoon-2.1.10-src\cocoon-2.1.10\build.xml
    --------------------------------------------------------------------
     Compiler options:
       - debug ......... [on]
       - optimize ...... [on]
       - deprecation ... [off]
    ====================================================================

    compile-core:
    Compiling 594 source files to D:\cocoon-2.1.10-src\cocoon-2.1.10\build\cocoon\classes
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:39: error: package com.
    sun.image.codec.jpeg does not exist
    import com.sun.image.codec.jpeg.ImageFormatException;
                                   ^
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:40: error: package com.
    sun.image.codec.jpeg does not exist
    import com.sun.image.codec.jpeg.JPEGCodec;
                                   ^
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:41: error: package com.
    sun.image.codec.jpeg does not exist
    import com.sun.image.codec.jpeg.JPEGEncodeParam;
                                   ^
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:42: error: package com.
    sun.image.codec.jpeg does not exist
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
                                   ^
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:326: error: cannot find
     symbol
                        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
                        ^
      symbol:   class JPEGImageEncoder
      location: class ImageReader
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:326: error: cannot find
     symbol
                        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
                                                   ^
      symbol:   variable JPEGCodec
      location: class ImageReader
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:327: error: cannot find
     symbol
                        JPEGEncodeParam p = encoder.getDefaultJPEGEncodeParam(currentImage);
                        ^
      symbol:   class JPEGEncodeParam
      location: class ImageReader
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:333: error: cannot find
     symbol
                        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bstream);
                        ^
      symbol:   class JPEGImageEncoder
      location: class ImageReader
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:333: error: cannot find
     symbol
                        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bstream);
                                                   ^
      symbol:   variable JPEGCodec
      location: class ImageReader
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:334: error: cannot find
     symbol
                        JPEGEncodeParam p = encoder.getDefaultJPEGEncodeParam(currentImage);
                        ^
      symbol:   class JPEGEncodeParam
      location: class ImageReader
    D:\cocoon-2.1.10-src\cocoon-2.1.10\src\java\org\apache\cocoon\reading\ImageReader.java:342: error: cannot find
     symbol
                } catch (ImageFormatException e) {
                         ^
      symbol:   class ImageFormatException
      location: class ImageReader
    11 errors

    BUILD FAILED
    D:\cocoon-2.1.10-src\cocoon-2.1.10\tools\targets\compile-build.xml:68: The following error occurred while exec
    uting this line:
    D:\cocoon-2.1.10-src\cocoon-2.1.10\tools\targets\compile-build.xml:51: Compile failed; see the compiler error
    output for details.


I also tried using "build war" on my command line and this yielded the same result.

Is this an issue with the JDK I am using or is there something else that I need to be looking at? This is my first attempt at building and deploying cocoon, I could be missing something obvious.

Regards, Tony

Était-ce utile?

La solution

The deprecated, proprietary com.sun.image.jpeg.codec package has been removed from JDK 7 (see this official official JDK7 compatibility note). Hence your compilation problem.

Since patching the Cocoon source may not be an option in your situation, the shortest path for you might be to compile using JDK 6 (or earlier, the Cocoon 2.1 series require "Java 1.3 or later").

(But if it is, as you seem to require specific Cocoon and JDK versions, you may want to have a look at the SO Q&A on How to replace com.sun.image.codec.jpeg.JPEGImageEncoder with calls to the standard Java Image I/O API)


Another option might be to look at a separate distribution of the com.sun.image.jpeg.codec package to include in you build (and possibly runtime) classpath. I'm unsure about the availability (and the ease of use) of this option. Anyhow I wouldn't recommend digging into it unless all other path have proven to be dead-ends...

Autres conseils

In my case the solution for this error was: search for folder endorsed, it should be in path : cocoon-2.1.11-src\cocoon-2.1.11\lib\endorsed copy this folder in your curren JAVA_HOME/jre/lib And try to build again. i hope than this solve your problem

I know this is old but in case anyone's interested I was able to build cocoon 2.1 recently without errors

I had to get the latest source from their current dev branch however (2_1_X) since I found that they'd fixed this bug but it still wasn't in their latest release (2.1.12) yet

I was actually able to build it with JDK 8 and also run it with Tomcat 8. Had to do some tweaks to get that working properly tho

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top