From users-return-26550-apmail-tomee-users-archive=tomee.apache.org@tomee.apache.org Thu Mar 8 18:19:04 2018 Return-Path: X-Original-To: apmail-tomee-users-archive@www.apache.org Delivered-To: apmail-tomee-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 901491896E for ; Thu, 8 Mar 2018 18:19:04 +0000 (UTC) Received: (qmail 47123 invoked by uid 500); 8 Mar 2018 18:18:59 -0000 Delivered-To: apmail-tomee-users-archive@tomee.apache.org Received: (qmail 47078 invoked by uid 500); 8 Mar 2018 18:18:59 -0000 Mailing-List: contact users-help@tomee.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@tomee.apache.org Delivered-To: mailing list users@tomee.apache.org Received: (qmail 47067 invoked by uid 99); 8 Mar 2018 18:18:58 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Mar 2018 18:18:58 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 4CDC8C0111 for ; Thu, 8 Mar 2018 18:18:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.839 X-Spam-Level: X-Spam-Status: No, score=0.839 tagged_above=-999 required=6.31 tests=[KAM_COUK=0.85, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id xImdtblDoQqj for ; Thu, 8 Mar 2018 18:18:56 +0000 (UTC) Received: from ns1.nbmlaw.co.uk (ns1.nbmlaw.co.uk [217.174.253.19]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 2A13C5F1B9 for ; Thu, 8 Mar 2018 18:18:56 +0000 (UTC) Received: from Mac-mini-2.local (156.red-83-50-150.dynamicip.rima-tde.net [83.50.150.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by ns1.nbmlaw.co.uk (Postfix) with ESMTPSA id D127F2C2985 for ; Thu, 8 Mar 2018 18:18:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 ns1.nbmlaw.co.uk D127F2C2985 Authentication-Results: ns1.nbmlaw.co.uk; dmarc=fail (p=quarantine dis=none) header.from=nbmlaw.co.uk Authentication-Results: ns1.nbmlaw.co.uk; spf=fail smtp.mailfrom=matthew.broadhead@nbmlaw.co.uk Subject: Re: velocityengine in cdi applicationscoped To: users@tomee.apache.org References: From: Matthew Broadhead Message-ID: Date: Thu, 8 Mar 2018 19:18:53 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US if i remove velocity from NoteDao then TomEE starts fine On 08/03/2018 19:15, Romain Manni-Bucau wrote: > Hi > > If you keep the bean and remove velocity you will probably get the same > error until its classloader is not correctly set and you have extensions in > your webapp but it should fail at runtime. > > > Le 8 mars 2018 18:48, "Matthew Broadhead" > a écrit : > >> TomEE 7.0.3 (i cannot upgrade to 7.0.4) >> >> i am trying to switch from using XSLT to using velocity templates. i >> noticed that velocity was included as a lib in TomEE >> >> if i declare VelocityEngine inside a CDI @ApplicationScoped >> try { >> VelocityEngine velocityEngine = new VelocityEngine(); >> velocityEngine.init(); >> Template t = velocityEngine.getTemplate("ve >> locity/reports/note.vm"); >> VelocityContext context = new VelocityContext(); >> context.put("note", note); >> StringWriter writer = new StringWriter(); >> t.merge(context, writer); >> System.out.println(writer.toString()); >> } catch (ResourceNotFoundException e1) { >> e1.printStackTrace(); >> } catch (ParseErrorException e1) { >> e1.printStackTrace(); >> } catch (MethodInvocationException e1) { >> e1.printStackTrace(); >> } catch (IOException e1) { >> e1.printStackTrace(); >> } catch (Exception e1) { >> e1.printStackTrace(); >> } >> >> then i get >> 08-Mar-2018 18:47:07.931 SEVERE [localhost-startStop-1] >> org.apache.openejb.cdi.OpenEJBLifecycle.startApplication CDI Beans module >> deployment failed >> org.apache.webbeans.exception.WebBeansDeploymentException: >> javax.enterprise.inject.UnsatisfiedResolutionException: Api type >> [uk.me.kissy.file.dao.NoteDao] is not found with the qualifiers >> Qualifiers: [@javax.enterprise.inject.Default()] >> for injection into Field Injection Point, field name : noteDao, Bean >> Owner : [FileRS, WebBeansType:MANAGED, Name:null, API >> Types:[java.lang.Object,uk.me.kissy.file.rs.FileRS], >> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]] >> at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeploye >> r.java:327) >> at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(Ope >> nEJBLifecycle.java:196) >> at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize >> (ThreadSingletonServiceImpl.java:189) >> at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:41) >> at org.apache.openejb.assembler.classic.Assembler.createApplica >> tion(Assembler.java:914) >> at org.apache.openejb.assembler.classic.Assembler.createApplica >> tion(Assembler.java:718) >> at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal( >> TomcatWebAppBuilder.java:1298) >> at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart >> (TomcatWebAppBuilder.java:1124) >> at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEve >> nt(GlobalListenerSupport.java:133) >> at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(Li >> fecycleBase.java:94) >> at org.apache.catalina.core.StandardContext.startInternal(Stand >> ardContext.java:5087) >> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase. >> java:150) >> at org.apache.catalina.core.ContainerBase$StartChild.call(Conta >> inerBase.java:1419) >> at org.apache.catalina.core.ContainerBase$StartChild.call(Conta >> inerBase.java:1409) >> at java.util.concurrent.FutureTask.run(FutureTask.java:266) >> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool >> Executor.java:1142) >> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo >> lExecutor.java:617) >> at java.lang.Thread.run(Thread.java:748) >> Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api >> type [uk.me.kissy.file.dao.NoteDao] is not found with the qualifiers >> Qualifiers: [@javax.enterprise.inject.Default()] >> for injection into Field Injection Point, field name : noteDao, Bean >> Owner : [FileRS, WebBeansType:MANAGED, Name:null, API >> Types:[java.lang.Object,uk.me.kissy.file.rs.FileRS], >> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]] >> at org.apache.webbeans.util.InjectionExceptionUtil.throwUnsatis >> fiedResolutionException(InjectionExceptionUtil.java:65) >> at org.apache.webbeans.container.InjectionResolver.checkInjecti >> onPoint(InjectionResolver.java:234) >> at org.apache.webbeans.container.BeanManagerImpl.validate(BeanM >> anagerImpl.java:1209) >> at org.apache.webbeans.util.WebBeansUtil.validate(WebBeansUtil. >> java:1709) >> at org.apache.webbeans.config.BeansDeployer.validate(BeansDeplo >> yer.java:913) >> at org.apache.webbeans.config.BeansDeployer.validateInjectionPo >> ints(BeansDeployer.java:824) >> at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeploye >> r.java:307) >> ... 17 more >> >> is VelocityEngine not allowed in there? or is there somewhere else i can >> be defining it for general use inside the container? >> >> >>