ChenilleKit 1.3.3 and tapestry-kaptcha 5.4-beta28 are incompatible

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ChenilleKit 1.3.3 and tapestry-kaptcha 5.4-beta28 are incompatible

balapal
Hi,

The reason for the below exception that I had both ChenilleKit and
tapestry-kaptcha on my classpath.
If I remove tapestry-kaptcha I don't get the below error.

Regards,
Balazs

On 25 February 2015 at 23:10, Balázs Palcsó <[hidden email]> wrote:

> Hi,
>
> Thanks for the quick replies. I will try to implement it.
>
> Regarding ChenilleKit JARs. I have added this dependency to build.gradle:
> compile 'org.chenillekit:chenillekit-tapestry:1.3.3' which brings in these
> files. chenillekit-core-1.3.3, chenillekit-google-1.3.3,
> chenillekit-image-1.3.3, chenillekit-tapestry-1.3.3
> The deployed version only contains one copy of each of these JARs.
> The full stacktrace is
>
> java.lang.RuntimeException: Service id 'KaptchaProducer' has already been
> defined by
> org.chenillekit.image.ChenilleKitImageModule.buildKaptchaProducer(Map) (at
> ChenilleKitImageModule.java:38) and may not be redefined by
> org.apache.tapestry5.kaptcha.internal.services.KaptchaProducerImpl(Map) (at
> KaptchaProducerImpl.java:34) via
> org.apache.tapestry5.kaptcha.modules.KaptchaModule.bind(ServiceBinder) (at
> KaptchaModule.java:39). You should rename one of the service builder
> methods.
>     at
> org.apache.tapestry5.ioc.internal.RegistryImpl.<init>(RegistryImpl.java:186)
>     at
> org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:181)
>     at
> org.apache.tapestry5.internal.TapestryAppInitializer.createRegistry(TapestryAppInitializer.java:175)
>     at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:103)
>     at
> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
>     at
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
>     at
> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
>     at
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775)
>     at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>     at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
>     at
> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>     at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>     at java.lang.Thread.run(Thread.java:744)
>
>
> Best regards,
> Balazs
>
> On 25 February 2015 at 02:51, Geoff Callender <
> [hidden email]> wrote:
>
>> In the following code, I made ImageInlineStreamResponse by extending
>> InlineStreamResponse from
>> http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile.
>>
>>         public ImageInlineStreamResponse getPictureAsImageStream(Integer
>> someId) throws FileNotFoundException {
>>
>>                 File file = toFileUsingMySecretPathAlgorithm(someId);
>>
>>                 return new ImageInlineStreamResponse(file);
>>         }
>>
>>
>> ImageInlineStreamResponse calls super(file), then sets the contentType
>> appropriately, eg. this.contentType = "image/jpeg".
>>
>> Two modifications to InlineStreamResponse :
>>
>> - add this constructor:
>>
>>         public InlineStreamResponse(File file) throws
>> FileNotFoundException {
>>                 this.is = new FileInputStream(file);
>>                 this.filename = file.getName();
>>         }
>>
>> - in prepareResponse(...), add this:
>>
>>         // Set content length to prevent chunking - see
>>         //
>> http://tapestry-users.832.n2.nabble.com/Disable-Transfer-Encoding-chunked-from-StreamResponse-td5269662.html#a5269662
>>                 try {
>>                         response.setHeader("Content-Length", "" +
>> is.available());
>>                 }
>>                 catch (IOException e) {
>>                         // Aaaaaaarrrrrrrrrggggggggggghhhhhhhhh!
>> Unrecoverable? Client will simply fail to receive the file.
>>                         e.printStackTrace();
>>                 }
>>
>> HTH,
>>
>> Geoff
>>
>> On 25 Feb 2015, at 11:58 am, Thiago H de Paula Figueiredo <
>> [hidden email]> wrote:
>>
>> > On Tue, 24 Feb 2015 20:29:44 -0300, Balázs Palcsó <
>> [hidden email]> wrote:
>> >
>> >> Hi,
>> >
>> > Hi!
>> >
>> >> I am developing an application that allows uploading images with
>> tapestry
>> >> 5.4-beta-28.
>> >>
>> >> My plan is to store the uploaded files on the file system. I have
>> managed
>> >> to implement this bit, but I am struggling to come up with a solution
>> to
>> >> show the uploaded images.
>> >
>> > I prefer some kind of database, as storing files in the filesystem can
>> be a pain and serving them can be a serious security risk, but that's not
>> the point of this message. :)
>> >
>> >> I am getting an error if I include ChenilleKit Tapestry in the
>> classpath
>> >> Service id 'KaptchaProducer' has already been defined by
>> >> org.chenillekit.image.ChenilleKitImageModule.buildKaptchaProducer(Map)
>> >
>> > This means there's two ChenilleKit JARs in the classpath. Or two
>> different module classes defining a service with the same id, but you've
>> cut off the error message, so it's not possible to know.
>> >
>> > --
>> > Thiago H. de Paula Figueiredo
>> > Tapestry, Java and Hibernate consultant and developer
>> > http://machina.com.br
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]
>> > For additional commands, e-mail: [hidden email]
>> >
>>
>>
>