Re: velocityengine in cdi applicationscoped

2018-03-08 Thread Romain Manni-Bucau
Means the bean is vetoed, probably cause the class cannot be loaded
surprisingly.

Le 8 mars 2018 21:58, "Matthew Broadhead" 
a écrit :

> i didn't add velocity in my app i was trying to use the TomEE one. i moved
> the code out of the @ApplicationScoped and into a @Named and the container
> started but then the @Named bean resolved to null
> javax.el.PropertyNotFoundException: Target Unreachable, identifier
> 'eventsBean' resolved to null
>
> On 08/03/2018 21:38, Romain Manni-Bucau wrote:
>
>> Then you can use the force-load option if you have velocity in your app or
>> remove it from here to use tomee one
>>
>> That said tomee should only need velocity in embedded mode and not others
>> so maybe a dependency leak to fix if not already.
>>
>> Le 8 mars 2018 19:21, "Matthew Broadhead" > >
>> a écrit :
>>
>> btw is there some way to define VelocityEngine as a Resource in tomee.xml
>>> so it doesn't have to be loaded each time?
>>>
>>> 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" <
 matthew.broadh...@nbmlaw.co.uk
 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
> 

Re: velocityengine in cdi applicationscoped

2018-03-08 Thread Matthew Broadhead
i didn't add velocity in my app i was trying to use the TomEE one. i 
moved the code out of the @ApplicationScoped and into a @Named and the 
container started but then the @Named bean resolved to null
javax.el.PropertyNotFoundException: Target Unreachable, identifier 
'eventsBean' resolved to null


On 08/03/2018 21:38, Romain Manni-Bucau wrote:

Then you can use the force-load option if you have velocity in your app or
remove it from here to use tomee one

That said tomee should only need velocity in embedded mode and not others
so maybe a dependency leak to fix if not already.

Le 8 mars 2018 19:21, "Matthew Broadhead" 
a écrit :


btw is there some way to define VelocityEngine as a Resource in tomee.xml
so it doesn't have to be loaded each time?

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" 

Re: velocityengine in cdi applicationscoped

2018-03-08 Thread Romain Manni-Bucau
Then you can use the force-load option if you have velocity in your app or
remove it from here to use tomee one

That said tomee should only need velocity in embedded mode and not others
so maybe a dependency leak to fix if not already.

Le 8 mars 2018 19:21, "Matthew Broadhead" 
a écrit :

> btw is there some way to define VelocityEngine as a Resource in tomee.xml
> so it doesn't have to be loaded each time?
>
> 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)

FTP trace level logging?

2018-03-08 Thread RobD
Hello, this seems simple enough but having difficulty in enabling FTP wire
trace logging in TomEE; using org.apache.commons.net.ftp.FTPClient and would
think I could either update logging.properties to include debug or trace
level logging to that, or use a -D switch but cannot find anything.  Anyone
have any hints or have configured TomEE to produce trace or debug level
output for all FTP ops (or from super-classes org.apache.commons.net.ftp.FTP
or org.apache.commons.net.SocketClient) output?

Thanks for any info.



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html


Re: velocityengine in cdi applicationscoped

2018-03-08 Thread Matthew Broadhead
btw is there some way to define VelocityEngine as a Resource in 
tomee.xml so it doesn't have to be loaded each time?


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?







Re: velocityengine in cdi applicationscoped

2018-03-08 Thread Matthew Broadhead

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?







Re: velocityengine in cdi applicationscoped

2018-03-08 Thread Romain Manni-Bucau
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?
>
>
>


velocityengine in cdi applicationscoped

2018-03-08 Thread Matthew Broadhead

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("velocity/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(BeansDeployer.java:327)
    at 
org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.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.createApplication(Assembler.java:914)
    at 
org.apache.openejb.assembler.classic.Assembler.createApplication(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.lifecycleEvent(GlobalListenerSupport.java:133)
    at 
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
    at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5087)

    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)

    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.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.throwUnsatisfiedResolutionException(InjectionExceptionUtil.java:65)
    at 
org.apache.webbeans.container.InjectionResolver.checkInjectionPoint(InjectionResolver.java:234)
    at 
org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1209)
    at 
org.apache.webbeans.util.WebBeansUtil.validate(WebBeansUtil.java:1709)
    at 
org.apache.webbeans.config.BeansDeployer.validate(BeansDeployer.java:913)
    at 
org.apache.webbeans.config.BeansDeployer.validateInjectionPoints(BeansDeployer.java:824)
    at 
org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.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?





Re: UnsatisfiedResolutionException with qualifiers -- what am I doing wrong?

2018-03-08 Thread Romain Manni-Bucau
yes, try reproducing it in a sample maybe


Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book


2018-03-08 14:20 GMT+01:00 Emmanuel Touzery <
emmanuel.touz...@lit-transit.com>:

> Hello,
>
> thank you for the answer! No, definitely it's not in the default
> excludes. Already injecting bunch of things from that JAR. Also, the
> interface is in a JAR, but the producer is in the main code of the app. And
> it's the producer which can't be found.
> From your answer I take it that it should work :-(
>
> emmanuel
>
> On 08/03/18 14:12, Romain Manni-Bucau wrote:
>
>> Hi Emmanuel,
>>
>> did you check your jar was not in the default excludes? (try renaming it
>> "foo.jar" to test quickly)
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau  |  Blog
>>  | Old Blog
>>  | Github <
>> https://github.com/rmannibucau> |
>> LinkedIn  | Book
>> > high-performance>
>>
>>
>> 2018-03-08 13:32 GMT+01:00 Emmanuel Touzery <
>> emmanuel.touz...@lit-transit.com>:
>>
>> Hello,
>>>
>>>  I'm confused about a CDI error, I would expect this to work... What
>>> am
>>> I doing wrong? It's true otherwise that the interface is defined in
>>> another
>>> JAR than the producer but I wouldn't expect it to be a problem...
>>>
>>>  At runtime I get:
>>>
>>> 08-Mar-2018 12:27:57.287 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 [
>>> com.lecip.core.application.customer_profiles.CustomerProfile] is not
>>> found with the qualifiers
>>> Qualifiers: [@com.lecip.core.application.customer_profiles.CustomerConte
>>> xt()]
>>> for injection into Field Injection Point, field name : _customerProfile,
>>> Bean Owner : [TmsAllFunctionalitiesProvider, WebBeansType:MANAGED,
>>> Name:null, API Types:[java.lang.Object,com.le
>>> cip.tms.tms_core.authorization.TmsAllFunctionalitiesProvider
>>> ,com.lecip.core.authorization.AllFunctionalitiesProvider],
>>> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise
>>> .inject.Any]]
>>>
>>>  Any ideas?
>>>
>>> --- beans.xml --
>>>
>>> 
>>> http://xmlns.jcp.org/xml/ns/javaee;
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>> xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
>>> http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd;
>>> version="1.2" bean-discovery-mode="all">
>>> 
>>>
>>> -- CustomerContext.java --
>>>
>>> @Qualifier
>>> @Retention(RUNTIME)
>>> @Target({TYPE, METHOD, FIELD, PARAMETER})
>>> public @interface CustomerContext {}
>>>
>>> -- CustomerProfileProducer.java --
>>>
>>> public class CustomerProfileProducer {
>>>  @Produces
>>>  @CustomerContext
>>>   public CustomerProfile getCustomerProfile() {
>>>   return null;
>>> }
>>> }
>>>
>>>   -- Injecting class --
>>>
>>>  @Inject @CustomerContext
>>>  CustomerProfile customerProfile;
>>>
>>>
>>>
>


Re: UnsatisfiedResolutionException with qualifiers -- what am I doing wrong?

2018-03-08 Thread Emmanuel Touzery

Hello,

    thank you for the answer! No, definitely it's not in the default 
excludes. Already injecting bunch of things from that JAR. Also, the 
interface is in a JAR, but the producer is in the main code of the app. 
And it's the producer which can't be found.

    From your answer I take it that it should work :-(

emmanuel

On 08/03/18 14:12, Romain Manni-Bucau wrote:

Hi Emmanuel,

did you check your jar was not in the default excludes? (try renaming it
"foo.jar" to test quickly)


Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book


2018-03-08 13:32 GMT+01:00 Emmanuel Touzery <
emmanuel.touz...@lit-transit.com>:


Hello,

 I'm confused about a CDI error, I would expect this to work... What am
I doing wrong? It's true otherwise that the interface is defined in another
JAR than the producer but I wouldn't expect it to be a problem...

 At runtime I get:

08-Mar-2018 12:27:57.287 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 [
com.lecip.core.application.customer_profiles.CustomerProfile] is not
found with the qualifiers
Qualifiers: [@com.lecip.core.application.customer_profiles.CustomerConte
xt()]
for injection into Field Injection Point, field name : _customerProfile,
Bean Owner : [TmsAllFunctionalitiesProvider, WebBeansType:MANAGED,
Name:null, API Types:[java.lang.Object,com.le
cip.tms.tms_core.authorization.TmsAllFunctionalitiesProvider
,com.lecip.core.authorization.AllFunctionalitiesProvider],
Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]

 Any ideas?

--- beans.xml --


http://xmlns.jcp.org/xml/ns/javaee;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd;
version="1.2" bean-discovery-mode="all">


-- CustomerContext.java --

@Qualifier
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
public @interface CustomerContext {}

-- CustomerProfileProducer.java --

public class CustomerProfileProducer {
 @Produces
 @CustomerContext
  public CustomerProfile getCustomerProfile() {
  return null;
}
}

  -- Injecting class --

 @Inject @CustomerContext
 CustomerProfile customerProfile;






Re: UnsatisfiedResolutionException with qualifiers -- what am I doing wrong?

2018-03-08 Thread Romain Manni-Bucau
Hi Emmanuel,

did you check your jar was not in the default excludes? (try renaming it
"foo.jar" to test quickly)


Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book


2018-03-08 13:32 GMT+01:00 Emmanuel Touzery <
emmanuel.touz...@lit-transit.com>:

> Hello,
>
> I'm confused about a CDI error, I would expect this to work... What am
> I doing wrong? It's true otherwise that the interface is defined in another
> JAR than the producer but I wouldn't expect it to be a problem...
>
> At runtime I get:
>
> 08-Mar-2018 12:27:57.287 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 [
> com.lecip.core.application.customer_profiles.CustomerProfile] is not
> found with the qualifiers
> Qualifiers: [@com.lecip.core.application.customer_profiles.CustomerConte
> xt()]
> for injection into Field Injection Point, field name : _customerProfile,
> Bean Owner : [TmsAllFunctionalitiesProvider, WebBeansType:MANAGED,
> Name:null, API Types:[java.lang.Object,com.le
> cip.tms.tms_core.authorization.TmsAllFunctionalitiesProvider
> ,com.lecip.core.authorization.AllFunctionalitiesProvider],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>
> Any ideas?
>
> --- beans.xml --
>
> 
> http://xmlns.jcp.org/xml/ns/javaee;
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
> http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd;
>version="1.2" bean-discovery-mode="all">
> 
>
> -- CustomerContext.java --
>
> @Qualifier
> @Retention(RUNTIME)
> @Target({TYPE, METHOD, FIELD, PARAMETER})
> public @interface CustomerContext {}
>
> -- CustomerProfileProducer.java --
>
> public class CustomerProfileProducer {
> @Produces
> @CustomerContext
>  public CustomerProfile getCustomerProfile() {
>  return null;
>}
> }
>
>  -- Injecting class --
>
> @Inject @CustomerContext
> CustomerProfile customerProfile;
>
>


UnsatisfiedResolutionException with qualifiers -- what am I doing wrong?

2018-03-08 Thread Emmanuel Touzery

Hello,

    I'm confused about a CDI error, I would expect this to work... What 
am I doing wrong? It's true otherwise that the interface is defined in 
another JAR than the producer but I wouldn't expect it to be a problem...


    At runtime I get:

08-Mar-2018 12:27:57.287 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 
[com.lecip.core.application.customer_profiles.CustomerProfile] is not 
found with the qualifiers
Qualifiers: 
[@com.lecip.core.application.customer_profiles.CustomerContext()]
for injection into Field Injection Point, field name : _customerProfile, 
Bean Owner : [TmsAllFunctionalitiesProvider, WebBeansType:MANAGED, 
Name:null, API 
Types:[java.lang.Object,com.lecip.tms.tms_core.authorization.TmsAllFunctionalitiesProvider,com.lecip.core.authorization.AllFunctionalitiesProvider], 
Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]


    Any ideas?

--- beans.xml --


http://xmlns.jcp.org/xml/ns/javaee;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd;

   version="1.2" bean-discovery-mode="all">


-- CustomerContext.java --

@Qualifier
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
public @interface CustomerContext {}

-- CustomerProfileProducer.java --

public class CustomerProfileProducer {
    @Produces
    @CustomerContext
 public CustomerProfile getCustomerProfile() {
 return null;
   }
}

 -- Injecting class --

    @Inject @CustomerContext
    CustomerProfile customerProfile;