org.jboss.weld.exceptions.DefinitionException:在payara / glassfish中部署时为WELD-001113

时间:2019-03-31 13:42:20

标签: java glassfish ejb payara

我正试图用netbeans在payara / glassfish中部署战争。

如果我不放置@Stateless@Stateful@Singleton批注,则应用程序启动,但是一旦使用,就会引起期望,并且什么也没有开始。

@Stateless
@LocalBean
public class CustomerManager {

    @PersistenceContext(unitName = "CustomerApp-ejbPU")  
    private EntityManager em;  

    public List<Customer> getAllCustomers() {  
       Query query = em.createNamedQuery("Customer.findAll");  
       return query.getResultList();  
    }  

    public Customer update(Customer customer) {  
       return em.merge(customer);  
    }  

    public void persist(Customer customer) {  
       em.persist(customer);  
    }  
}

错误:

WARN:   WELD-001124: Context.getScope() returned interface javax.transaction.TransactionScoped which is not a scope annotation. Context: org.glassfish.cdi.transaction.TransactionScopedContextImpl@49a32dc1
GRAVE:   Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI definition failure:Exception List with 1 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DefinitionException: WELD-001113: interface javax.transaction.TransactionScoped defined on org.glassfish.jms.injection.JMSCDIExtension$LocalPassivationCapableBean@4111d621 is not a scope annotation
    at org.jboss.weld.bean.attributes.ExternalBeanAttributesFactory.validateScope(ExternalBeanAttributesFactory.java:139)
    at org.jboss.weld.bean.attributes.ExternalBeanAttributesFactory.validateBeanAttributes(ExternalBeanAttributesFactory.java:71)
    at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.addBean(AfterBeanDiscoveryImpl.java:97)
    at org.glassfish.jms.injection.JMSCDIExtension.afterBeanDiscovery(JMSCDIExtension.java:78)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
    at org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:144)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
    at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123)
    at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
    at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
    at javax.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:124)
    at org.jboss.weld.util.Observers.notify(Observers.java:166)
    at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285)
    at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273)
    at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177)
    at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:171)
    at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53)
    at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:44)
    at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:75)
    at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:456)
    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:86)
    at org.glassfish.weld.WeldDeployer.processApplicationLoaded(WeldDeployer.java:516)
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:428)
    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:497)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:540)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:549)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:545)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:544)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:567)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:566)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1475)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1857)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1733)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:564)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:251)
    at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:166)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
    at java.lang.Thread.run(Thread.java:745)

我已经尝试安装并重新安装payara 5.183、5.184、5.191,glashfish 5,但是问题仍然存在,我要做的就是用EJB打个招呼世界,但是只要我使用@Stateless批注崩溃

1 个答案:

答案 0 :(得分:0)

最后,我通过更改jdk的版本解决了该问题。 我从1.8.0_77版本升级到1.8.0_191,它可以正常运行