为类创建托管对象时出错:class org.jboss.weld.module.web.servlet.WeldListener

时间:2018-01-13 00:26:45

标签: maven jsf omnifaces weld payara

我在Primefaces和Omnifaces的Java EE项目中使用Omnifaces的@Eager注释以及Payara 4.1.2.174和5.0-beta。将@Eager添加到以下托管bean会触发5.x上的问题,而4.x可以正常工作:

@Named
@ApplicationScoped
@Eager
public class MyManagedBean {
    @EJB
    private InitService initService;
    private MyEntity myEntity;

    public MyManagedBean() {
    }

    @PostConstruct
    private void init() {
        this.myEntity = initService.init();
    }

    public MyEntity getMyEntity() {
        return myEntity;
    }

    public void setMyEntity(MyEntity myEntity) {
        this.myEntity = myEntity;
    }
}

该实体如下所示:

@Entity
public class MyEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    private Long id;
    @Basic
    private Money money;

    public MyEntity() {
    }

    public MyEntity(Long id, Money monetaryAmount) {
        this.id = id;
        this.money = monetaryAmount;
    }

    [getter and setter for id and money]

和版本

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>6.1</version>
</dependency>
<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>eclipselink</artifactId>
    <version>2.6.5</version>
</dependency>
<dependency>
    <groupId>org.javamoney</groupId>
    <artifactId>moneta</artifactId>
    <version>1.1</version>
</dependency>
<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>7.0</version>
</dependency>
<dependency>
    <groupId>org.omnifaces</groupId>
    <artifactId>omnifaces</artifactId>
    <version>2.6.7</version>
</dependency>
<dependency>
    <groupId>org.jboss.weld</groupId>
    <artifactId>weld-core-bom</artifactId>
    <version>3.0.1.Final</version>
    <type>pom</type>
</dependency>

我设置

<glassfish-web-app error-url="">
    <class-loader delegate="false"/>
</glassfish-web-app>
glassfish-web.xml中的

我知道这很可能会导致用户错误,这意味着我必须在没有来自服务器,焊接和omnifaces的任何反馈的情况下找出缺少的依赖关系。我更喜欢这种设置而不是在服务器上使用库,因为它们肯定会在以后引起问题。所以,我做了一个选择,我可能看不到过去了。)

(缩短的)服务器日志是

Information:   WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Information:   WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionHolder is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionInterceptor is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.TransactionalExceptionMapper is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class com.ibm.jbatch.container.cdi.BatchProducerBean is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class com.sun.faces.flow.FlowDiscoveryCDIHelper is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider$JaxRsParamProducer is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.servlet.internal.CdiExternalRequestScope is deprecated from CDI 1.1!
WARNUNG:   The following warnings have been detected: WARNING: Parameter interceptedBean of type javax.enterprise.inject.spi.Bean<?> from private javax.enterprise.inject.spi.Bean<?> org.glassfish.soteria.cdi.LoginToContinueInterceptor.interceptedBean is not resolvable to a concrete type.

WARNUNG:   The following warnings have been detected: WARNING: Parameter interceptedBean of type javax.enterprise.inject.spi.Bean<?> from private javax.enterprise.inject.spi.Bean<?> org.glassfish.soteria.cdi.RememberMeInterceptor.interceptedBean is not resolvable to a concrete type.

WARNUNG:   Exception while dispatching an event
org.glassfish.api.invocation.InvocationException
    at org.glassfish.api.invocation.InvocationManagerImpl.postInvoke(InvocationManagerImpl.java:178)
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:293)
    at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:333)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:492)
    [...]

SCHWERWIEGEND:   ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5688)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:609)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:956)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:939)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:684)
    [...]
Caused by: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:3005)
    at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:2200)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:236)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:95)
    at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:239)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:336)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:163)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5685)
    ... 48 more
Caused by: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:3126)
    at org.apache.catalina.core.StandardContext.loadListener(StandardContext.java:5208)
    at com.sun.enterprise.web.WebModule.loadListener(WebModule.java:1709)
    at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:3003)
    ... 55 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:298)
    at com.sun.enterprise.web.WebContainer.createListenerInstance(WebContainer.java:808)
    at com.sun.enterprise.web.WebModule.createListenerInstance(WebModule.java:2079)
    at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:3124)
    ... 58 more
Caused by: java.lang.NullPointerException
    at org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:414)
    at org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:284)
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:476)
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:429)
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:283)
    ... 61 more

WARNUNG:   java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:960)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:939)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:684)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2099)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1745)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:107)
    [...]

[two stacks repeated twice]

SCHWERWIEGEND:   Exception while loading the app
SCHWERWIEGEND:   Undeployment failed for context /monteta-clazz-not-found-issue
SCHWERWIEGEND:   Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
INFORMATION:   Portable JNDI names for EJB DefaultInitService: [java:global/monteta-clazz-not-found-issue/DefaultInitService, java:global/monteta-clazz-not-found-issue/DefaultInitService!richtercloud.monteta.clazz.not.found.issue.InitService]
Information:   WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Information:   WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionHolder is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionInterceptor is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.TransactionalExceptionMapper is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class com.ibm.jbatch.container.cdi.BatchProducerBean is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class com.sun.faces.flow.FlowDiscoveryCDIHelper is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider$JaxRsParamProducer is deprecated from CDI 1.1!
WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.servlet.internal.CdiExternalRequestScope is deprecated from CDI 1.1!
WARNUNG:   The following warnings have been detected: WARNING: Parameter interceptedBean of type javax.enterprise.inject.spi.Bean<?> from private javax.enterprise.inject.spi.Bean<?> org.glassfish.soteria.cdi.LoginToContinueInterceptor.interceptedBean is not resolvable to a concrete type.

WARNUNG:   The following warnings have been detected: WARNING: Parameter interceptedBean of type javax.enterprise.inject.spi.Bean<?> from private javax.enterprise.inject.spi.Bean<?> org.glassfish.soteria.cdi.RememberMeInterceptor.interceptedBean is not resolvable to a concrete type.

WARNUNG:   Exception while dispatching an event
org.glassfish.api.invocation.InvocationException
    at org.glassfish.api.invocation.InvocationManagerImpl.postInvoke(InvocationManagerImpl.java:178)
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:293)
    at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:333)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:492)
    [...]

SCHWERWIEGEND:   ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5688)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:609)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:956)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:939)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:684)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2099)
    [...]
Caused by: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:3005)
    at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:2200)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:236)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:95)
    at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:239)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:336)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:163)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5685)
    ... 48 more
Caused by: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:3126)
    at org.apache.catalina.core.StandardContext.loadListener(StandardContext.java:5208)
    at com.sun.enterprise.web.WebModule.loadListener(WebModule.java:1709)
    at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:3003)
    ... 55 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:298)
    at com.sun.enterprise.web.WebContainer.createListenerInstance(WebContainer.java:808)
    at com.sun.enterprise.web.WebModule.createListenerInstance(WebModule.java:2079)
    at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:3124)
    ... 58 more
Caused by: java.lang.NullPointerException
    at org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:414)
    at org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:284)
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:476)
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:429)
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:283)
    ... 61 more

WARNUNG:   java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:960)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:939)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:684)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2099)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1745)
    [...]

[two stacks repeated]

SCHWERWIEGEND:   Exception while loading the app
SCHWERWIEGEND:   Undeployment failed for context /monteta-clazz-not-found-issue
SCHWERWIEGEND:   Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.module.web.servlet.WeldListener

我必须使用Payara 5.x测试版,因为其他版本存在问题,因为有很多其他应用服务器。

com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class似乎与此问题无关。

0 个答案:

没有答案
相关问题