Sound captcha - could not write audio file: file type not supported: WAVE
anthonycheung66 Mar 27, 2012 4:57 AMHi,
I am migrating my application from JBoss 4.2 to JBoss 7 on the same machine. My application involves generation of sound captcha through JCaptcha library. The deployment on JBoss 7 is successful but with the following error in the server log
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/myApp]] (MSC service thread 1-2) StandardWrapper.Throwable: java.lang.IllegalArgumentException: could not write audio file: file type not supported: WAVE
at javax.sound.sampled.AudioSystem.write(AudioSystem.java:1306) [rt.jar:1.6.0_20]
at com.octo.captcha.sound.SoundCaptcha.<init>(SoundCaptcha.java:42) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.sound.speller.SpellerSound.<init>(SpellerSound.java:25) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.sound.speller.SpellerSoundFactory.getSoundCaptcha(SpellerSoundFactory.java:94) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.engine.sound.SoundCaptchaEngine.getNextSoundCaptcha(SoundCaptchaEngine.java:121) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.engine.sound.SoundCaptchaEngine.getNextCaptcha(SoundCaptchaEngine.java:63) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.service.AbstractCaptchaService.generateAndStoreCaptcha(AbstractCaptchaService.java:156) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.service.AbstractManageableCaptchaService.generateCountTimeStampAndStoreCaptcha(AbstractManageableCaptchaService.java:342) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.service.AbstractManageableCaptchaService.generateAndStoreCaptcha(AbstractManageableCaptchaService.java:331) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.service.AbstractCaptchaService.getChallengeForID(AbstractCaptchaService.java:73) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.service.AbstractCaptchaService.getChallengeForID(AbstractCaptchaService.java:55) [jcaptcha-1.0-all.jar:]
at com.octo.captcha.service.sound.AbstractManageableSoundCaptchaService.getSoundChallengeForID(AbstractManageableSoundCaptchaService.java:48) [jcaptcha-1.0-all.jar:]
I have added some debug codes to check the supported audio file type of the machine
boolean test = javax.sound.sampled.AudioSystem.isFileTypeSupported(AudioFileFormat.Type.WAVE);
logger.info("Support WAVE = " + test);
The output is different in JBoss 4.2 and JBoss 7
JBoss 4.2:
Support WAVE = true
JBoss 7:
Support WAVE = false
I have no idea why the output is different as they are running on the same machine and even the same JAVA_HOME