Return-Path: X-Original-To: apmail-uima-user-archive@www.apache.org Delivered-To: apmail-uima-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5D1DF17B4D for ; Fri, 10 Apr 2015 19:38:09 +0000 (UTC) Received: (qmail 90929 invoked by uid 500); 10 Apr 2015 19:38:04 -0000 Delivered-To: apmail-uima-user-archive@uima.apache.org Received: (qmail 90883 invoked by uid 500); 10 Apr 2015 19:38:04 -0000 Mailing-List: contact user-help@uima.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@uima.apache.org Delivered-To: mailing list user@uima.apache.org Received: (qmail 90869 invoked by uid 99); 10 Apr 2015 19:38:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Apr 2015 19:38:03 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jtatria@gmail.com designates 209.85.216.47 as permitted sender) Received: from [209.85.216.47] (HELO mail-vn0-f47.google.com) (209.85.216.47) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Apr 2015 19:37:58 +0000 Received: by vnbf1 with SMTP id f1so8037028vnb.0 for ; Fri, 10 Apr 2015 12:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=IT6fWtx+EULTXmlqIlw1hShWG+JBVhUJwAVOVjUiB5g=; b=Pzf3eveITYgv3E7d5ZqS0iTUtQPWRbjQjXEQjcDD9EYMOmsvQvBHT3YeIybspJ4Hny T95z7pHln1KdaEc/P8YDqlWsn1Dg5bCtSW3nsAfX1WNhbTop+kRYwUaINzYlRoyIEbLE 7h4IkvNmVLiHMd6xGKSoyhUlF2AS77Vb/WLzcUnVTC2VRD7jun6XVTcedcOdswosnQxq QkxG68XLT7CUcjwfvV/kH8qstcguEfkLhK0ZuuARWAsQybDRJL41lppjWth3uVUBJgq+ 5AEXusxxIYJkBJJAsVfjx72XoqbqauKTVBYVB6la/HtcfiQRHBp0KmFgzo0OyCEVZroT v4iQ== X-Received: by 10.140.97.98 with SMTP id l89mr3750438qge.92.1428694612381; Fri, 10 Apr 2015 12:36:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.91.52 with HTTP; Fri, 10 Apr 2015 12:36:12 -0700 (PDT) In-Reply-To: References: From: =?UTF-8?B?Sm9zw6kgVG9tw6FzIEF0cmlh?= Date: Fri, 10 Apr 2015 15:36:12 -0400 Message-ID: Subject: Re: ClassCastException when passing String[] parameters to external resource. To: user@uima.apache.org Content-Type: multipart/alternative; boundary=001a113ac466dd17fd051363e261 X-Virus-Checked: Checked by ClamAV on apache.org --001a113ac466dd17fd051363e261 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Richard, Thanks a lot for the pointers. I'll take a look at the code and docs and figure out how best to procede. Best, jta On Fri, Apr 10, 2015 at 2:41 PM, Richard Eckart de Castilho wrote: > Hi, > > there are different variations of shared/external resources: > > * based on Resource_ImplBase - currently only supports String values > * based on SharedResourceObject - should support the typical value types > also supported for readers and AEs > > Unfortunately, the support for the SharedResourceObject-kind is not (yet) > great. > It requires some hacking around. Both approaches are documented in the > Guide: > > http://uima.apache.org/d/uimafit-current/tools.uimafit.book.html#d5e485 > > For more "examples", you could check out the ExternalResourceFactoryTest > in the uimaFIT code base. > > Cheers, > > -- Richard > > On 10.04.2015, at 20:29, Jos=C3=A9 Tom=C3=A1s Atria w= rote: > > > Hello all, > > > > I'm getting this error when trying to pass values to a > > @ConfiugrationParameter over a String[] field in a Resource > > implementation... > > > > Exception in thread "main" java.lang.ClassCastException: > > [Ljava.lang.String; cannot be cast to java.lang.String > > at > > > org.apache.uima.fit.factory.ExternalResourceFactory.createExternalResourc= eDescription(ExternalResourceFactory.java:177) > > at > > > org.apache.uima.fit.factory.ExternalResourceFactory.createExternalResourc= eDescription(ExternalResourceFactory.java:122) > > > > In the debugger, I can see that starting at line 175 in > > ExternalResourceFactory: > > > > Parameter param =3D new Parameter_impl(); > > param.setName((String) aParams[i * 2]); > > param.setValue((String) aParams[i * 2 + 1]); > > params.add(param); > > > > aParams[i * 2] correctly resolves to the param key, while aParams[i * 2= + > > 1] resolves to the full string array, so param.setValue( (String) > aParams[i > > * 2 + 1 ]) fails with the above class cast exception. > > > > I remember it being possible to pass String[]'s as values for > > ConfigurationParameters passed to AnalysisEngineFactory... is this usag= e > > not supported for external resources or am i doing something wrong? > > > > Thanks! > > =E2=80=8Bjta=E2=80=8B > > > > -- > > entia non sunt multiplicanda praeter necessitatem > > --=20 entia non sunt multiplicanda praeter necessitatem --001a113ac466dd17fd051363e261--