繁体   English   中英

在Apache Tomcat 7中部署MyFaces CODI + Weld + JSF时出错

[英]Error deploying MyFaces CODI + Weld + JSF in Apache Tomcat 7

我是使用JSF的新手,并且注意到JSF没有提供一些有用的注释,例如@ViewAccessScoped(CODI)。 为了使用CODI,我需要使用CDI依赖关系,因此我用Weld配置了项目。

然后, JSF + Weld + Tomcat 7可以正常工作 ,将注释范围更改为Weld注释,将@ManagedBean更改为@Named,将@NamedProperty更改为@Inject。

否则,当我现在尝试使用CODI部署Tomcat服务器时,将具有以下堆栈跟踪(是否使用CODI库,例如@ViewAccessScoped批注)和服务器关闭:

Mai 22, 2014 12:03:28 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib
Mai 22, 2014 12:03:28 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:BioRequestWeld' did not find a matching property.
Mai 22, 2014 12:03:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mai 22, 2014 12:03:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Mai 22, 2014 12:03:28 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 469 ms
Mai 22, 2014 12:03:28 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mai 22, 2014 12:03:28 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.53
Mai 22, 2014 12:03:30 AM org.jboss.weld.environment.servlet.EnhancedListener onStartup
INFO: Initialize Weld using ServletContainerInitializer
Mai 22, 2014 12:03:30 AM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 2.2.1 (Final)
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
Mai 22, 2014 12:03:31 AM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit>
WARN: WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled
Mai 22, 2014 12:03:31 AM org.jboss.weld.interceptor.util.InterceptionTypeRegistry <clinit>
WARN: WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
Mai 22, 2014 12:03:31 AM org.jboss.weld.event.ExtensionObserverMethodImpl checkRequiredTypeAnnotations
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.apache.myfaces.extensions.cdi.jsf.impl.listener.phase.PhaseListenerExtension.filterJsfPhaseListeners(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Mai 22, 2014 12:03:31 AM org.jboss.weld.event.ExtensionObserverMethodImpl checkRequiredTypeAnnotations
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewConfigExtension.processPageDefinitions(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Mai 22, 2014 12:03:31 AM org.jboss.weld.event.ExtensionObserverMethodImpl checkRequiredTypeAnnotations
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] protected org.apache.myfaces.extensions.cdi.core.impl.activation.ActivationExtension.vetoAlternativeTypes(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Mai 22, 2014 12:03:31 AM org.jboss.weld.event.ExtensionObserverMethodImpl checkRequiredTypeAnnotations
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] protected org.apache.myfaces.extensions.cdi.jsf2.impl.scope.mapped.MappedJsf2ScopeExtension.convertJsf2Scopes(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Mai 22, 2014 12:03:31 AM org.jboss.weld.event.ExtensionObserverMethodImpl checkRequiredTypeAnnotations
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.apache.myfaces.extensions.cdi.core.impl.CodiDeactivatorExtension.filter(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Mai 22, 2014 12:03:31 AM org.apache.myfaces.extensions.cdi.core.api.provider.ServiceProvider <clinit>
INFO: org.apache.myfaces.extensions.cdi.core.impl.provider.DefaultServiceProvider installed successfully.
Mai 22, 2014 12:03:31 AM org.apache.myfaces.extensions.cdi.core.api.provider.ServiceProvider <clinit>
INFO: org.apache.myfaces.extensions.cdi.core.impl.provider.DefaultServiceProviderContext installed successfully.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.InjectableValidator because of underlying class loading error: Type javax.validation.Validator not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.InjectableValidatorFactory because of underlying class loading error: Type javax.validation.ValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.jsf.impl.bv.resolver.InvalidValueAwareValidatorFactory because of underlying class loading error: Type javax.validation.ValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.InjectableMessageInterpolator because of underlying class loading error: Type javax.validation.MessageInterpolator not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.jsf.impl.bv.resolver.InvalidValueAwareValidatorContext because of underlying class loading error: Type javax.validation.ValidatorContext not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.jsf.impl.bv.resolver.JsfValidatorFactoryProducer because of underlying class loading error: Type javax.validation.ValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.CdiAwareValidatorFactory$1 because of underlying class loading error: Type javax.validation.ConstraintValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.jpa.impl.EntityManagerEntry because of underlying class loading error: Type javax.persistence.EntityManager not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.ValidatorFactoryStorage because of underlying class loading error: Type javax.validation.ValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.CdiAwareBeanValidationProducer because of underlying class loading error: Type javax.validation.ValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.jsf.impl.bv.InvalidValueAwareMessageInterpolator because of underlying class loading error: Type javax.validation.MessageInterpolator not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.api.ClassLevelConstraintValidator because of underlying class loading error: Type javax.validation.ConstraintValidator not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.jsf.impl.bv.resolver.SerializableValidatorFactory because of underlying class loading error: Type javax.validation.ValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.jpa.impl.LegacyTransactionalInterceptorStrategy because of underlying class loading error: Type javax.persistence.EntityManager not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.InjectableConstraintValidatorFactory because of underlying class loading error: Type javax.validation.ConstraintValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.InjectionAwareConstraintValidatorFactory because of underlying class loading error: Type javax.validation.ConstraintValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.SerializableValidatorFactory because of underlying class loading error: Type javax.validation.ValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.AdvancedValidatorContext because of underlying class loading error: Type javax.validation.ValidatorContext not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.ValidatorFactoryResolver because of underlying class loading error: Type javax.validation.ValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.jpa.impl.transaction.TransactionalInterceptorStrategy because of underlying class loading error: Type javax.persistence.EntityManager not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.jpa.impl.PersistenceHelper because of underlying class loading error: Type javax.persistence.EntityManager not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.apache.myfaces.extensions.cdi.bv.impl.CdiAwareValidatorFactory because of underlying class loading error: Type javax.validation.ValidatorFactory not found.  If this is unexpected, enable DEBUG logging to see the full error.
Mai 22, 2014 12:03:31 AM org.apache.myfaces.extensions.cdi.core.impl.projectstage.ProjectStageProducer initProjectStage
INFO: Computed the following CODI ProjectStage: Production
Mai 22, 2014 12:03:31 AM org.jboss.weld.environment.tomcat.TomcatContainer initialize
INFO: Tomcat 7+ detected, CDI injection will be available in Servlets, Filters and Listeners.
Mai 22, 2014 12:03:32 AM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/BioRequest]]
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
    at java.util.concurrent.FutureTask.get(FutureTask.java:111)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799)
    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$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    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:724)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/BioRequest]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    ... 7 more
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type PersistenceStrategy with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private org.apache.myfaces.extensions.cdi.jpa.impl.transaction.TransactionalInterceptor.persistenceStrategy
  at org.apache.myfaces.extensions.cdi.jpa.impl.transaction.TransactionalInterceptor.persistenceStrategy(TransactionalInterceptor.java:0)

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:370)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:291)
    at org.jboss.weld.bootstrap.Validator.validateInterceptor(Validator.java:567)
    at org.jboss.weld.bootstrap.ConcurrentValidator$2.doWork(ConcurrentValidator.java:85)
    at org.jboss.weld.bootstrap.ConcurrentValidator$2.doWork(ConcurrentValidator.java:83)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
    ... 5 more

Mai 22, 2014 12:03:32 AM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
    at java.util.concurrent.FutureTask.get(FutureTask.java:111)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    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$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    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:724)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:799)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 7 more

Mai 22, 2014 12:03:32 AM org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more

Mai 22, 2014 12:03:32 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Mai 22, 2014 12:03:32 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Mai 22, 2014 12:03:32 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Mai 22, 2014 12:03:32 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Mai 22, 2014 12:03:32 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-worker-1] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-worker-2] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-worker-3] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-worker-4] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-worker-5] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-worker-6] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-worker-7] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-worker-8] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-preloader-1] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-preloader-2] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-preloader-3] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-preloader-4] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-preloader-5] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-preloader-6] but has failed to stop it. This is very likely to create a memory leak.
Mai 22, 2014 12:03:32 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/BioRequest] appears to have started a thread named [weld-preloader-7] but has failed to stop it. This is very likely to create a memory leak.

这是一个非常奇怪的错误日志。
要点是:在Tomcat 7下如何将CODI与JSF一起使用? 我想使用CODI提供的注释@ViewAccessScoped。
CODI与Weld兼容吗? 这是一个非常奇怪的堆栈跟踪,因为如果没有CODI,一切都会正常进行。

当我尝试使用JSF + CODI + Tomcat 7部署项目时,预计会出现一些错误,因为CODI在某些CDI库上工作(但是我的项目在不使用CODI的情况下工作)。 然后,堆栈跟踪的主要部分是:

Mai 22, 2014 1:18:18 AM com.sun.faces.config.AnnotationScanner processClassList
SEVERE: Unable to load annotated class: org.apache.myfaces.extensions.cdi.jsf2.impl.scope.mapped.MappedJsf2ScopeExtension, reason: java.lang.NoClassDefFoundError: javax/enterprise/inject/spi/Extension
Mai 22, 2014 1:18:18 AM com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment: 
com.sun.faces.config.ConfigurationException: Factory'javax.faces.context.FacesContextFactory' was not configured properly.

下面列出了我正在使用的库:

    Weld:   weld-servlet-2.2.1.Final.jar
    CODI:   myfaces-extcdi-bundle-jsf20-1.0.6.jar
    JSF:    javax.faces-2.2.6.jar
    Tomcat: apache-tomcat-7.0.53

我尝试使用TomEE,唯一需要的库是myfaces-extcdi-bundle-jsf20-1.0.6.jar ,在一切正常之后

否则,我将无法使用JSF v2.2 +。 当前 使用TomEE配置的JSF版本是2.1 因此,我不想迁移到TomEE,因为只能在2.2+版本中访问该标记。

我解决了将MyFaces CODI更改为Apache DeltaSpike的问题

我还不知道为什么将MyFaces CODI与Weld容器一起使用时会遇到问题,但是使用Apache DeltaSpike代替MyFaces CODI可以正常工作。

当我使用Maven时,这是pom.xml中使用的依赖项:

      <properties>
        <deltaspike.version>0.7</deltaspike.version>
        <myfaces2.version>2.2.3</myfaces2.version>
        <weld.version>2.2.1.Final</weld.version>
        <jsf.version>2.2.6</jsf.version>
      </properties>

    <dependencies>
        <!-- <dependency> -->
        <!--    <groupId>javax.servlet</groupId> -->
        <!--    <artifactId>jstl</artifactId> -->
        <!--    <version>1.2</version> -->
        <!-- </dependency> -->

    <!-- Mojarra JSF 2.2.6 -->
    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>${jsf.version}</version>
    </dependency>

        <!-- DeltaSpike modules -->
        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-api</artifactId>
            <version>${deltaspike.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-impl</artifactId>
            <version>${deltaspike.version}</version>
            <scope>compile</scope>
            <!-- compile since we extends DefaultMessageResolver -->
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-jsf-module-api</artifactId>
            <version>${deltaspike.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-jsf-module-impl</artifactId>
            <version>${deltaspike.version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- weld -->
        <dependency>
            <groupId>org.jboss.weld.servlet</groupId>
            <artifactId>weld-servlet</artifactId>
            <version>${weld.version}</version>
        </dependency>
  </dependencies>

在WEB-INF中,我具有以下内容:
---- beans.xml(空)
---- faces-config.xml(我包括了来自deltaspike的FacesMessage-不必要)
---- web.xml(设置Servlet侦听器以侦听Weld Servlet容器-具有CDI)

beans.xml中:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>

faces-config.xml中:

<application>
    <message-bundle>org.apache.deltaspike.example.message.FacesMessages</message-bundle>
</application>

web.xml中:

<listener>
  <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>

现在,通过此配置,我可以将所需的CDI扩展名@ViewAccessScoped用作其他扩展名。

如果您使用DeltaSpike CDI扩展将JSF应用程序部署到Apache Tomcat 7.0.53上的Weld CDI,则一切正常。

希望它对希望使用tomcat 7在JSF中使用CDI扩展的所有人有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM