Matthew Broadhead
2018-03-08 17:48:05 UTC
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?
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?