Re: Download-Link on Website wrong
And the links on that download_imaging.cgi page are broken. :( FWIW, I recently had to replace *a lot* of old JAI code. I wound up using https://github.com/jai-imageio/jai-imageio-core. It was not a one-for-one swap, but it wasn't too painful. On Fri, Apr 26, 2019 at 7:06 AM Wolff Bock von Wülfingen wrote: > Hey, > > currently your download link in the sidebar is still pointing to sanselan: > https://commons.apache.org/proper/commons-imaging/download_sanselan.cgi > > Pretty sure it's supposed to be: > https://commons.apache.org/proper/commons-imaging/download_imaging.cgi > > :) > -- "Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be" --Christopher Marlowe, *Doctor Faustus* (v. 111-13)
Re: [imaging] Changing compile baseline of library to JDK7
On Wed, Oct 12, 2016 at 4:33 AM, sebb <seb...@gmail.com> wrote: > May I ask why a minium of Java 7 is a problem for some people? > > It would be useful to know this when considering other updates. > In my case, one of our oldest and largest customers--a Fortune 100 company--is running Oracle WebLogic 10.3, which they purchase with Extended Support for Java SE 6. Oracle states that Extended Support for Java SE 6 will be available December 2018 ( http://www.oracle.com/technetwork/java/eol-135779.html). We have no indication that they will upgrade before then. Most of my development is with GWT using Gradle as my build tool. In addition to having to back out Commons Imaging, I am for now sticking with an older Gradle plugin for GWT because the alternative plugin also requires Java 7. I've found out the best way to avoid the accidental introduction of a Java 7 binary is to stick with Java 6 for the build environment, too. > > On 11 October 2016 at 17:10, Thad Humphries <thad.humphr...@gmail.com> > wrote: > > Yes. I've had to pull commons-imaging from my apps and replace it with > > JAI-IMAGEIO. JAI is old and unsupported, but its jar files still work > with > > Java 6. (There are also older versions of Twelve Monkeys that work with > > Java 6. https://github.com/haraldk/TwelveMonkeys) > > > > On Tue, Oct 11, 2016 at 11:38 AM, Sergio Matone <ser...@cedeo.net> > wrote: > > > >> I would like to express my disappoint since the library, which was > working > >> perfectly, is now compiled using Java 7 without issuing a version. > >> > >> I understand that the library is in SNAPSHOT, but why it wasn't issued > at > >> least a 1.0.0 version, tagging the Java 6 version. > >> You broke builds of several of my programs in production. That's not the > >> way Apache usually behaves. > >> > >> Sergio > >> > > > > > > -- > > "Hell hath no limits, nor is circumscrib'd In one self-place; but where > we > > are is hell, And where hell is, there must we ever be" --Christopher > > Marlowe, *Doctor Faustus* (v. 121-24) > > - > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > > -- "Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be" --Christopher Marlowe, *Doctor Faustus* (v. 121-24)
Re: [imaging] Changing compile baseline of library to JDK7
Yes. I've had to pull commons-imaging from my apps and replace it with JAI-IMAGEIO. JAI is old and unsupported, but its jar files still work with Java 6. (There are also older versions of Twelve Monkeys that work with Java 6. https://github.com/haraldk/TwelveMonkeys) On Tue, Oct 11, 2016 at 11:38 AM, Sergio Matonewrote: > I would like to express my disappoint since the library, which was working > perfectly, is now compiled using Java 7 without issuing a version. > > I understand that the library is in SNAPSHOT, but why it wasn't issued at > least a 1.0.0 version, tagging the Java 6 version. > You broke builds of several of my programs in production. That's not the > way Apache usually behaves. > > Sergio > -- "Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be" --Christopher Marlowe, *Doctor Faustus* (v. 121-24)
Re: [Imaging] a quick resize sample needed
Do you necessarily need to use this library? There are other solutions (Google java resize image). For example http://www.codejava.net/java-se/graphics/how-to-resize-images-in-java -- or -- http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/ On Tue, Jun 16, 2015 at 5:32 AM, javalishixml javalishi...@163.com wrote: Hi Gurus, Quite a silly question this is. But I really worked for one whole day but still could not get any result. I have below codes. I just want to finish a a simple function to resize the original picture. But I don't know how to set its param.. I tried to read the doc API and read the test code. But I still could not figure it out how to do.. Can you plz do me a favor? Looking forward to your early reply... -- public class ApacheCommonImaging { public static void main(String[] args) { // TODO Auto-generated method stub try { //!! File someFile = new File(E:\\deleteMe\\image\\original.jpg); File file = someFile; BufferedImage image_3 = Sanselan.getBufferedImage(file); File destination = new File(E:\\deleteMe\\image\\commonImaging\\destination.jpg); ImageFormat format1 = ImageFormat.IMAGE_FORMAT_JPEG; Map params = new HashMap(Object, Object); // Map params = new HashMap(JpegImageParser.TIFF_TAG_IMAGE_LENGTH, new TagInfo()); // Sanselan.writeImage(image_3, destination, format1, params); } catch (Exception e) { } } } -- -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v. 121-24)
Re: [imaging] Images gain size.
I recently had the requirement for a process that would read TIFF Group IV images, 'stamp' them with a string, and save the images. Below is some code I wrote as part of playing with options. The code barely changes the size of the image. In fact, most of the size difference was from adding a software tag. I've copied my code below. This will run headless if you need it to run on a server without access to a display. Maybe it will be of use. (NOTE: XPath does not always work on a metadata Node tree. I've been told that IIOMetadata's getAsTree() does not return a true W3C Node, so XPath will not work in all cases. However I've found that it does work on the Group IV's that I deal with.) public class ImageStamper { public static void main(String[] args) { new ImageStamper(args[0]); } private final static float FONT_SIZE_IN_POINTS = 12.0f; private final static String FONT_FAMILY = Times New Roman; private final static float OFFSET_FROM_RIGHT = 3.0f; private final static float OFFSET_FROM_TOP = 0.3f; public ImageStamper() {} public ImageStamper(String inFilename) { Path p = FileSystems.getDefault().getPath(., inFilename); int width = 0; int height = 0; int xDpi = 0; int yDpi = 0; ImageReader reader = getTIFFImageReader(); ImageWriter writer = getTIFFImageWriter(); try { // Make new image. Path outFile = Files.createTempFile(FileSystems.getDefault().getPath(.), tmp, .tif); ImageOutputStream ios = ImageIO.createImageOutputStream(outFile.toFile()); writer.setOutput(ios); writer.prepareWriteSequence(null); byte [] buffer = Files.readAllBytes(p); // We'll need TIFFDirectory for dpi ByteArrayInputStream bais = new ByteArrayInputStream(buffer); ImageInputStream iis = ImageIO.createImageInputStream(bais); reader.setInput(iis); int pages = reader.getNumImages(true); for (int page = 0; page pages; page++) { BufferedImage image = reader.read(page); IIOMetadata inMetadata = reader.getImageMetadata(page); TIFFDirectory tiffDir = TIFFDirectory.createFromMetadata(inMetadata); // Get size TIFFField w = tiffDir.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_WIDTH); width = (w != null) ? w.getAsInt(0) : image.getWidth(); TIFFField h = tiffDir.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_LENGTH); height = (h!= null) ? h.getAsInt(0) : image.getHeight(); // Get dpi TIFFField xrez = tiffDir.getTIFFField(BaselineTIFFTagSet.TAG_X_RESOLUTION); xDpi = (xrez != null) ? xrez.getAsInt(0) : 72; TIFFField yrez = tiffDir.getTIFFField(BaselineTIFFTagSet.TAG_Y_RESOLUTION); yDpi = (yrez != null) ? yrez.getAsInt(0) : 72; TIFFField rezu = tiffDir.getTIFFField(BaselineTIFFTagSet.TAG_RESOLUTION_UNIT); int rezUnit = (rezu != null) ? rezu.getAsInt(0) : BaselineTIFFTagSet.RESOLUTION_UNIT_INCH; if (rezUnit == BaselineTIFFTagSet.RESOLUTION_UNIT_CENTIMETER) { xDpi = (int)((float)xDpi/2.54); yDpi = (int)((float)yDpi/2.54); } Graphics2D g2 = image.createGraphics(); // Scale the font. float fontRatio = xDpi/72.0f; int fontSize = Math.round(FONT_SIZE_IN_POINTS * fontRatio); // Set up the font. MapTextAttribute, Object fontAttributes = new HashMapTextAttribute, Object(); fontAttributes.put(TextAttribute.FAMILY, FONT_FAMILY); fontAttributes.put(TextAttribute.SIZE, fontSize); fontAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); Font font = new Font(Serif, fontSize, Font.BOLD); font = font.deriveFont(fontAttributes); g2.setFont(font); FontMetrics fm = g2.getFontMetrics(); // Text String stamp = PLACE STAMP HERE; g2.setColor(java.awt.Color.black); g2.setPaintMode(); // Position print top right int y = Math.round(OFFSET_FROM_TOP * yDpi + fm.getMaxDescent()); int x = width - Math.round(OFFSET_FROM_RIGHT * xDpi) - fm.stringWidth(stamp); g2.drawString(stamp, x, y); // Position print in other locations. // Set compression while writing. ImageWriteParam writeParam = writer.getDefaultWriteParam(); writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); writeParam.setCompressionType(CCITT T.6); writeParam.setCompressionQuality(1.0f); // Get the initial metadata ImageTypeSpecifier spec = ImageTypeSpecifier.createFromRenderedImage(image); IIOMetadata metadata = writer.getDefaultImageMetadata(spec, writeParam); String formatName = metadata.getNativeMetadataFormatName(); // Reset the metadata with new values. try { Node metadataNode = metadata.getAsTree(formatName); XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); NodeList
Re: [imaging] Images gain size.
Good luck. You are dealing with *far larger* images than I am, and probably different compression. My images are all single page TIFF Gp IV, 200 to 300 dpi, Letter and Legal size, and range from 50K to 115K. This is typical for us. On Mon, Apr 27, 2015 at 10:25 AM, Remi Malessa r...@llgc.org.uk wrote: Thanks for the code Thad, I'll give it a whirl ! Remi On 27/04/15 14:52, Thad Humphries wrote: I recently had the requirement for a process that would read TIFF Group IV images, 'stamp' them with a string, and save the images. Below is some code I wrote as part of playing with options. The code barely changes the size of the image. In fact, most of the size difference was from adding a software tag. I've copied my code below. This will run headless if you need it to run on a server without access to a display. Maybe it will be of use. (NOTE: XPath does not always work on a metadata Node tree. I've been told that IIOMetadata's getAsTree() does not return a true W3C Node, so XPath will not work in all cases. However I've found that it does work on the Group IV's that I deal with.) - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v. 121-24)
Re: [fileupload] - Question about uploading additional files other than the ones in the form?
FileUpload is pretty straight forward and the examples are clear. However it sound to me like you are describing a scenario like this: On Machine A, files foo, bar, baz, etc. and file FilesList.txt with the full paths for those files. On Server B: A web app with a form and your servlet. User at Machine A loads the form from Server B, chooses FilesList.txt and submits the form back to Server B, uploading FilesList.txt. Your servlet reads the paths in FilesList.txt and requests that Machine A send it each file listed. Is that correct? In any case, this scenario won't work without a program on Machine A that could accept a request from Server B for those files (maybe a webapp and servlet running on Machine A). But Server B cannot simply tell the browser send me the following files. You cannot even pre-populate the input type=file... element with path strings from FilesList.txt in any form you send back. The user on Machine A is going to have to send each file separately, or zip them up and send them. My apologies if I got this scenario wrong. On Fri, Sep 5, 2014 at 8:05 PM, Konrad Zuse thekonradz...@hotmail.com wrote: Hello all, I am basically uploading a file to my server, but within that file contains path information to images that also need to be uploaded. I am looking to read the file mid stream and get the data for the images to upload. It seems I am able to do this, but if this is not possible will I be able save the file, read it, and then be able to get these images? I am curious about how I will go about grabbing the additional files? I see that streaming works with InputStream from JavaIO as well as something from CommonsIO, so I figured I could configure something to work with the fileupload stream. I also thought that I could possibly try to create a form through my servlet and pass the data through that, but I figured this would be the less favorable approach. If anyone has any advice or thoughts I would appreciate it... Thanks! -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v. 121-24)
[fileupload] IE not releasing files in network shared directories
This does *not* appear to be a FileUpload issue because it works in Chrome and Firefox. I'm asking this group may have seen this before and know a workaround. My app uses several different XML files. A user can upload the file, make changes in their browser using of my app's forms, and save the result as a new XML file. If an IE user uploads a file from a Windows network shared directory, and file download set to always require save-as, the user cannot overwrite the file, but must rename the file or save it to a different directory. The problem does not affect Chrome and Firefox users, nor does it affect files opened from unshared directories. Has anyone seen this before? Is there some setting among the gawd-awful number of options IE gives that can change this behavior? -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
Re: [imaging] Read/Write Bilevel TIFF A4 image thumbnail
The TIFF specification ( https://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf) does not provide for a thumbnail. However, since a TIFF can have multiple pages, you could (for example) assume a convention internal to your application that creates a second image that is a thumbnail of the first (and you'd have to create the thumbnail yourself). You would have to handle this inside your app. Another TIFF viewer, like GIMP, would simply see a 2-page TIFF. I've not created multipage TIFFs with the Commons Imaging, so I've got no sample code to offer. On Sun, Mar 2, 2014 at 2:13 AM, Ramanathan Srinivasan rsrinivasan...@gmail.com wrote: Greetings, Is it possible to embed Thumbnail in bilevel TIFF A4 image? If yes, any example or Link for the same Thanks, srinivasan -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
[daemon] ClassNotFoundException though class in path
I've written a class called MultiThread which implements Daemon. However when I try to run it with jsvc, it fails although the class is clearly present in my classpath. What am I not seeing? The call and debug are below: $ sudo ~/bin/jsvc -jvm server -debug -cp ~/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:./target/MultiThread-1.0-SNAPSHOT.jar com.mindwrap.sample.thread.MultiThread once Password: +-- DUMPING PARSED COMMAND LINE ARGUMENTS -- | Detach: True | Show Version:No | Show Help: No | Check Only: Disabled | Stop:False | Wait:0 | Run as service: No | Install service: No | Remove service: No | JVM Name:server | Java Home: null | PID File:/var/run/jsvc.pid | User Name: null | Extra Options: 1 | -Djava.class.path=/Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:./target/MultiThread-1.0-SNAPSHOT.jar | Class Invoked: com.mindwrap.sample.thread.MultiThread | Class Arguments: 1 | once +--- Home not specified on command line, using environment Home not on command line or in environment, searching Attempting to locate Java Home in /System/Library/Frameworks/JavaVM.framework/Home Attempting to locate VM configuration file /System/Library/Frameworks/JavaVM.framework/Home/jre/lib/jvm.cfg Attempting to locate VM configuration file /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg Found VM configuration file at /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg Found VM client definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib Found VM jvm definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib Found VM hotspot definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib Found VM server definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib Found VM classic definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclassic.dylib Cannot locate library for VM classic (skipping) Java Home located in /System/Library/Frameworks/JavaVM.framework/Home +-- DUMPING JAVA HOME STRUCTURE | Java Home: /System/Library/Frameworks/JavaVM.framework/Home | Java VM Config.: /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg | Found JVMs: 4 | JVM Name:client | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib | JVM Name:jvm | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib | JVM Name:hotspot | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib | JVM Name:server | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib +--- redirecting stdout to /dev/null and stderr to /dev/null Switching umask back to 022 from 077 Using specific JVM in /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib Attemtping to load library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib thad@Thads-Mac-mini.local:~/jdevel/MultiThreadTest 621 $ JVM library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib loaded Attemtping to load library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libverify.dylib Shell library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libverify.dylib loaded JVM library entry point found (0x09E34762) +-- DUMPING JAVA VM CREATION ARGUMENTS - | Version: 0x010004 | Ignore Unrecognized Arguments: False | Extra options: 1 | -Djava.class.path=/Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:./target/MultiThread-1.0-SNAPSHOT.jar (0x) +--- | Internal options: 4 | -Dcommons.daemon.process.id=17848 (0x) | -Dcommons.daemon.process.parent=17847 (0x) | -Dcommons.daemon.version=1.0.15-dev (0x) | abort (0x096a6f50) +--- Java VM created successfully Class org/apache/commons/daemon/support/DaemonLoader found Native methods registered java_init done Daemon loading... java.lang.ClassNotFoundException: com.mindwrap.sample.thread.MultiThread at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
Re: [daemon] ClassNotFoundException though class in path
=/Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:/Users/thad/jdevel/MultiThreadTest/target/MultiThread-1.0-SNAPSHOT.jar (0x) +--- | Internal options: 4 | -Dcommons.daemon.process.id=18273 (0x) | -Dcommons.daemon.process.parent=18272 (0x) | -Dcommons.daemon.version=1.0.15-dev (0x) | abort (0x06ca5f50) +--- Java VM created successfully Class org/apache/commons/daemon/support/DaemonLoader found Native methods registered java_init done Daemon loading... 2013-11-19 13:10:48.376 jsvc[18273:203] Apple AWT Java VM was loaded on first thread -- can't start AWT. java.lang.InternalError: Can't start the AWT because Java was started on the first thread. Make sure StartOnFirstThread is not specified in your application's Info.plist or on the command line at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1833) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1730) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at java.lang.System.loadLibrary(System.java:1044) at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.loadLibraries(Toolkit.java:1605) at java.awt.Toolkit.clinit(Toolkit.java:1627) at sun.awt.AppContext$2.run(AppContext.java:240) at sun.awt.AppContext$2.run(AppContext.java:226) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.AppContext.initMainAppContext(AppContext.java:226) at sun.awt.AppContext.access$200(AppContext.java:112) at sun.awt.AppContext$3.run(AppContext.java:306) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.AppContext.getAppContext(AppContext.java:287) at com.sun.jmx.trace.Trace.out(Trace.java:180) at com.sun.jmx.trace.Trace.isSelected(Trace.java:88) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.isTraceOn(DefaultMBeanServerInterceptor.java:1830) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:929) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:916) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312) at com.sun.jmx.mbeanserver.JmxMBeanServer$2.run(JmxMBeanServer.java:1195) at java.security.AccessController.doPrivileged(Native Method) at com.sun.jmx.mbeanserver.JmxMBeanServer.initialize(JmxMBeanServer.java:1193) at com.sun.jmx.mbeanserver.JmxMBeanServer.init(JmxMBeanServer.java:225) at com.sun.jmx.mbeanserver.JmxMBeanServer.init(JmxMBeanServer.java:170) at com.sun.jmx.mbeanserver.JmxMBeanServer.newMBeanServer(JmxMBeanServer.java:1401) at javax.management.MBeanServerBuilder.newMBeanServer(MBeanServerBuilder.java:93) at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:311) at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:214) at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:175) at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:302) at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:504) at com.mindwrap.sample.thread.MultiThread.init(MultiThread.java:26) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:357) at java.lang.Class.newInstance(Class.java:310) at org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:190) Cannot load daemon java_load failed Service exit with a return value of 3 On Tue, Nov 19, 2013 at 12:53 PM, Thomas Neidhart thomas.neidh...@gmail.com wrote: On 11/19/2013 06:11 PM, Thad Humphries wrote: I've written a class called MultiThread which implements Daemon. However when I try to run it with jsvc, it fails although the class is clearly present in my classpath. What am I not seeing? The call and debug are below: $ sudo ~/bin/jsvc -jvm server -debug -cp ~/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:./target/MultiThread-1.0-SNAPSHOT.jar com.mindwrap.sample.thread.MultiThread once try using an absolute path to the MultiThread jar file. Thomas Password: +-- DUMPING PARSED COMMAND LINE ARGUMENTS -- | Detach: True | Show Version:No | Show Help: No | Check Only: Disabled | Stop:False | Wait:0 | Run as service: No | Install service
Re: [daemon] ClassNotFoundException though class in path
Thanks. That seems to have done it. And adding -pidfile /var/run/jsvc.pid -stop stops it. However now I don't see the System.out.println() that I was (lazily) using to track MultiThread and its three SubTreads. I guess I've got to swap those for a logger if I want to see anything, huh? On Tue, Nov 19, 2013 at 1:40 PM, Thomas Neidhart thomas.neidh...@gmail.comwrote: On 11/19/2013 07:35 PM, Thad Humphries wrote: Different error this time (see list below). The failure is 2013-11-19 13:10:48.376 jsvc[18273:203] Apple AWT Java VM was loaded on first thread -- can't start AWT. java.lang.InternalError: Can't start the AWT because Java was started on the first thread. Make sure StartOnFirstThread is not specified in your application's Info.plist or on the command line well, I do not know what you are trying to do, but you may want to try out the headless mode: http://www.oracle.com/technetwork/articles/javase/headless-136834.html Thomas However I find no StartOnFirstThread in the Info.plist. Question: MultiThread spawns 3 threads of SubThread. Could that be the problem? A thread that spawns threads? MultiThread grabs AWT so SubThread's can't (though neither user AWT classes). I had been using a JVM shutdown hookhttp://javapapers.com/core-java/jvm-shutdown-hook/for MultiThread and assigning a shutdown hook to each of the SubThread instances. In my target app, I want to give the user one process to start via a shell script with the subthreads (variable in number) configured in an XML file. I just today started looking at Daemon thinking it might be a better way to go, especially as I'd also like this eventually to run as a Windows service (beat writing a *.BAT file). Debug follows: $ sudo ~/bin/jsvc -jvm server -debug -cp /Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:/Users/thad/jdevel/MultiThreadTest/target/MultiThread-1.0-SNAPSHOT.jar com.mindwrap.sample.thread.MultiThread once +-- DUMPING PARSED COMMAND LINE ARGUMENTS -- | Detach: True | Show Version:No | Show Help: No | Check Only: Disabled | Stop:False | Wait:0 | Run as service: No | Install service: No | Remove service: No | JVM Name:server | Java Home: null | PID File:/var/run/jsvc.pid | User Name: null | Extra Options: 1 | -Djava.class.path=/Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:/Users/thad/jdevel/MultiThreadTest/target/MultiThread-1.0-SNAPSHOT.jar | Class Invoked: com.mindwrap.sample.thread.MultiThread | Class Arguments: 1 | once +--- Home not specified on command line, using environment Home not on command line or in environment, searching Attempting to locate Java Home in /System/Library/Frameworks/JavaVM.framework/Home Attempting to locate VM configuration file /System/Library/Frameworks/JavaVM.framework/Home/jre/lib/jvm.cfg Attempting to locate VM configuration file /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg Found VM configuration file at /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg Found VM client definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib Found VM jvm definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib Found VM hotspot definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib Found VM server definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib Found VM classic definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclassic.dylib Cannot locate library for VM classic (skipping) Java Home located in /System/Library/Frameworks/JavaVM.framework/Home +-- DUMPING JAVA HOME STRUCTURE | Java Home: /System/Library/Frameworks/JavaVM.framework/Home | Java VM Config.: /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg | Found JVMs: 4 | JVM Name:client | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib | JVM Name:jvm | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib | JVM Name:hotspot | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib | JVM Name:server | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib +--- redirecting stdout to /dev/null and stderr to /dev/null Switching umask back to 022 from 077
Re: [daemon] ClassNotFoundException though class in path
Ha! I can still be lazy thanks to the -outfile param. Thanks again for all the help. On Tue, Nov 19, 2013 at 2:13 PM, Thad Humphries thad.humphr...@gmail.comwrote: Thanks. That seems to have done it. And adding -pidfile /var/run/jsvc.pid -stop stops it. However now I don't see the System.out.println() that I was (lazily) using to track MultiThread and its three SubTreads. I guess I've got to swap those for a logger if I want to see anything, huh? On Tue, Nov 19, 2013 at 1:40 PM, Thomas Neidhart thomas.neidh...@gmail.com wrote: On 11/19/2013 07:35 PM, Thad Humphries wrote: Different error this time (see list below). The failure is 2013-11-19 13:10:48.376 jsvc[18273:203] Apple AWT Java VM was loaded on first thread -- can't start AWT. java.lang.InternalError: Can't start the AWT because Java was started on the first thread. Make sure StartOnFirstThread is not specified in your application's Info.plist or on the command line well, I do not know what you are trying to do, but you may want to try out the headless mode: http://www.oracle.com/technetwork/articles/javase/headless-136834.html Thomas However I find no StartOnFirstThread in the Info.plist. Question: MultiThread spawns 3 threads of SubThread. Could that be the problem? A thread that spawns threads? MultiThread grabs AWT so SubThread's can't (though neither user AWT classes). I had been using a JVM shutdown hookhttp://javapapers.com/core-java/jvm-shutdown-hook/for MultiThread and assigning a shutdown hook to each of the SubThread instances. In my target app, I want to give the user one process to start via a shell script with the subthreads (variable in number) configured in an XML file. I just today started looking at Daemon thinking it might be a better way to go, especially as I'd also like this eventually to run as a Windows service (beat writing a *.BAT file). Debug follows: $ sudo ~/bin/jsvc -jvm server -debug -cp /Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:/Users/thad/jdevel/MultiThreadTest/target/MultiThread-1.0-SNAPSHOT.jar com.mindwrap.sample.thread.MultiThread once +-- DUMPING PARSED COMMAND LINE ARGUMENTS -- | Detach: True | Show Version:No | Show Help: No | Check Only: Disabled | Stop:False | Wait:0 | Run as service: No | Install service: No | Remove service: No | JVM Name:server | Java Home: null | PID File:/var/run/jsvc.pid | User Name: null | Extra Options: 1 | -Djava.class.path=/Users/thad/.m2/repository/commons-daemon/commons-daemon/1.0.15/commons-daemon-1.0.15.jar:/Users/thad/jdevel/MultiThreadTest/target/MultiThread-1.0-SNAPSHOT.jar | Class Invoked: com.mindwrap.sample.thread.MultiThread | Class Arguments: 1 | once +--- Home not specified on command line, using environment Home not on command line or in environment, searching Attempting to locate Java Home in /System/Library/Frameworks/JavaVM.framework/Home Attempting to locate VM configuration file /System/Library/Frameworks/JavaVM.framework/Home/jre/lib/jvm.cfg Attempting to locate VM configuration file /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg Found VM configuration file at /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg Found VM client definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib Found VM jvm definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib Found VM hotspot definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib Found VM server definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib Found VM classic definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclassic.dylib Cannot locate library for VM classic (skipping) Java Home located in /System/Library/Frameworks/JavaVM.framework/Home +-- DUMPING JAVA HOME STRUCTURE | Java Home: /System/Library/Frameworks/JavaVM.framework/Home | Java VM Config.: /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg | Found JVMs: 4 | JVM Name:client | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib | JVM Name:jvm | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib | JVM Name:hotspot | /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib | JVM Name:server | /System/Library/Frameworks/JavaVM.framework/Home
[daemon] jsvc and java.management
Now that I've managed to my Java class as a daemon, what became of its management hooks? When I run my class without jsvc, it's thread show in jconsole. They are not present when run with jsvc. Are Java classes unable to register with Java managers if jsvc is present? Dynamic control and monitoring are part of my requirements. How can I fix this or how can I work around it? -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
Re: [imaging] Latest Download Links Are not working
On Wed, Aug 7, 2013 at 2:53 AM, Benedikt Ritter brit...@apache.org wrote: The latest SNAPSHOT build is available via the snapshot repo: https://repository.apache.org/content/groups/snapshots/org/apache/commons/commons-imaging/ I'll try to get some time tonight to update the site. Sorry for the inconvenience. Benedikt 2013/8/7 Thad Humphries thad.humphr...@gmail.com These downloads are still not available. Can someone fix the links or tell me where to find the files? I would like to try the 1.0-SNAPSHOT, especially the TIFF classes. On Tue, Jul 16, 2013 at 5:06 AM, R. S. Patil kpr.rspa...@gmail.com wrote: Helo, I tried to download from http://commons.apache.org/proper/commons-imaging/download_imaging.cgiboth zip and tar.gz and tried all the servers but every time 404 error is generated. However Archive download links work and I could download 0.97 version zip/tar.gz. Kindly help by rectifying the links. Thanks and warm regards. Raja Thanks, Benedikt. I see that the files in 1.0-SNAPSHOT are as recent as last week while those in 1.1-SNAPSHOT are from September 2012. Should we test with 1.0-SNAPSHOT? -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
Re: [imaging] Latest Download Links Are not working
On Wed, Aug 7, 2013 at 5:40 AM, Andreas Lehmkuehler andr...@lehmi.dewrote: Hi, Am 07.08.2013 11:00, schrieb Benedikt Ritter: 2013/8/7 Thad Humphries thad.humphr...@gmail.com On Wed, Aug 7, 2013 at 2:53 AM, Benedikt Ritter brit...@apache.org wrote: The latest SNAPSHOT build is available via the snapshot repo: https://repository.apache.org/**content/groups/snapshots/org/** apache/commons/commons-**imaging/https://repository.apache.org/content/groups/snapshots/org/apache/commons/commons-imaging/ I'll try to get some time tonight to update the site. Sorry for the inconvenience. Benedikt 2013/8/7 Thad Humphries thad.humphr...@gmail.com These downloads are still not available. Can someone fix the links or tell me where to find the files? I would like to try the 1.0-SNAPSHOT, especially the TIFF classes. On Tue, Jul 16, 2013 at 5:06 AM, R. S. Patil kpr.rspa...@gmail.com wrote: Helo, I tried to download from http://commons.apache.org/**proper/commons-imaging/** download_imaging.cgibothhttp://commons.apache.org/proper/commons-imaging/download_imaging.cgiboth zip and tar.gz and tried all the servers but every time 404 error is generated. However Archive download links work and I could download 0.97 version zip/tar.gz. Kindly help by rectifying the links. Thanks and warm regards. Raja Thanks, Benedikt. I see that the files in 1.0-SNAPSHOT are as recent as last week while those in 1.1-SNAPSHOT are from September 2012. Should we test with 1.0-SNAPSHOT? I don't know where 1.1-SNAPSHOT is coming from, but the latest trunk is 1.0-SNAPSHOT [1] Maybe it was uploaded by accident? Perhaps someone should simply delete it from the repository to avoid further misunderstandings. Benedikt [1] http://svn.apache.org/viewvc/**commons/proper/imaging/trunk/** pom.xml?view=markuphttp://svn.apache.org/viewvc/commons/proper/imaging/trunk/pom.xml?view=markup BR Andreas Lehmkühler When I click on anything in https://repository.apache.org/content/groups/snapshots/org/apache/commons/commons-imaging/1.0-SNAPSHOT/I get a 404 error. When I put dependency groupIdorg.apache.commons/groupId artifactIdcommons-imaging/artifactId version1.0-SNAPSHOT/version /dependency in my pom.xml, Eclipse tells me that the artifact is missing. -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
[imaging] Success!
First, thanks for your great work. I downloaded the 1.0-SNAPSHOT JAR and I also grabbed SVN and build the project. I then took an old JAI-Swing demo I wrote *way back*, commented out JAI.create( fileload, filename ) and replaced it with your org.apache.commons.imaging.examples.ImageReadExample.imageReadExample(file). I'm able to open the various TIFF Group 4 images I commonly test with. I hope to have time this next week play some more with commons-imaging, possibly adapting the rest of that demo--scale, rotate, etc.--to use commons-imaging vs JAI. -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
[imaging] DISPLAY required?
Does any part of the commons-imaging library require the host system to have a DISPLAY? If so, what are they? Can I avoid those parts of the library that cannot run headless? For example, parts of AWT need a DISPLAY, others don't. In servlets, I avoid those calls that won't run headless. These days I primarily open and manipulate images in servlets. Some of my customers run headless servers. Even when they do have a DISPLAY, the Tomcat user might not have access to it. I've tried one (to remain nameless) commercial package that fails to open images without a display. That's a no-go. I'm currently using JAI (mostly), but would *love* to swap it out for something from Apache. I see no movement to maintain or enhance JAI. Also, JAI runs afoul of Tomcat's JreMemoryLeakPreventionListener, requiring me to disable that listener and to restart Tomcat whenever I redeploy my WAR files. -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
Re: [imaging] Latest Download Links Are not working
These downloads are still not available. Can someone fix the links or tell me where to find the files? I would like to try the 1.0-SNAPSHOT, especially the TIFF classes. On Tue, Jul 16, 2013 at 5:06 AM, R. S. Patil kpr.rspa...@gmail.com wrote: Helo, I tried to download from http://commons.apache.org/proper/commons-imaging/download_imaging.cgi both zip and tar.gz and tried all the servers but every time 404 error is generated. However Archive download links work and I could download 0.97 version zip/tar.gz. Kindly help by rectifying the links. Thanks and warm regards. Raja -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
Re: [codec] problem with Base64OutputStream
On Sun, Feb 17, 2013 at 4:56 AM, Thomas Neidhart thomas.neidh...@gmail.comwrote: On 02/17/2013 12:13 AM, Thad Humphries wrote: I am using Commons Codec v1.7 to Base64 encode a TIFF file for writing to an XML file as CDATA. Simple: File file = new File(fileName); FileInputStream fis = new FileInputStream(file); ByteArrayOutputStream baos = new ByteArrayOutputStream(); Base64OutputStream b64os = new Base64OutputStream(baos); int bufSize = 8 * 1024; byte [] buffer = new byte[bufSize]; int count; while ((count = fis.read(buffer, 0, bufSize)) != -1) b64os.write(buffer, 0, count); fis.close(); baos.flush(); b64os.close(); baos.close(); xtw.writeCData(new String(baos.toByteArray())); However I'm concerned that a future version Commons Codec of might not default to chunked output. So I'd like to swap Base64OutputStream b64os = new Base64OutputStream(baos); for byte [] eol = {0xD, 0xA}; Base64OutputStream b64os = new Base64OutputStream(baos, true, 76, eol); However when I do this, the program crashes out on creating new Base64OutputStream(...). If fact, it skips right past a catch on Exception and goes directly to finally (honest--my logger shows nothing and I've watched this dozens of times in Eclipse's deugger). Am I doing something wrong? Hi Thad, I just tried your example and this works pretty fine for me. Could you please post the exception you are getting? Thomas Hi Thomas, Thanks for the response. The call does not catch as an Exception, but just now I found that it catches as a Throwable. My log4j log is below. Line 1703 is where I instantiate Base64OutputStream: Base64OutputStream b64os = new Base64OutputStream(baos, true, 76, eol); From the log. java.lang.VerifyError: (class: org/apache/commons/codec/binary/Base64OutputStream, method: init signature: (Ljava/io/OutputStream;ZI[B)V) Incompatible argument to function at com.optix.cold.server.ColdServicesImpl.makeColdFormFile(ColdServicesImpl.java:1703) at com.optix.cold.server.ColdServicesImpl.saveColdForm(ColdServicesImpl.java:1339) 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 com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097) at com.optix.cold.server.GWTCacheControlFilter.doFilter(GWTCacheControlFilter.java:52) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)
[sanselan] Source Repository not found
Where can I check out the Sanselan source? The site instructions are not working for me: $ svn checkout http://svn.apache.org/repos/asf/commons/proper/sanselan/trunkcommons-sanselan svn: URL 'http://svn.apache.org/repos/asf/commons/proper/sanselan/trunk' doesn't exist I'm interested in making a simple addition for a project I'm working on. Down the road, I'd like to contribute, especially to the TIFF area. -- Hell hath no limits, nor is circumscrib'd In one self-place; but where we are is hell, And where hell is, there must we ever be --Christopher Marlowe, *Doctor Faustus* (v, 121-24)