glassfish4焊接部署异常:javax.enterprise.inject.spi.DefinitionException

时间:2014-02-27 18:29:32

标签: cdi ejb-3.1 java-ee-7

我有远程ejb refs(在remote.jar中)

 @Remote
    public interface UserManager{
      public void doSomething();
    }

在ejb.jar中实施

 @Stateless
   public class UserManagerImpl implements UserManager{
     public void doSomething(){}
   }

//通常这是一个只在ejb jar中访问的本地bean    //这实际上是一个实体会话bean

@Stateless
   public class CompanyFacade{
   }

CDI in war archive

   public class CDIProducer{
     @EJB
     @Produces
     UserManager usermanager;
   } 




 @Named
    @SessionScoped
    public class Controller implements Serializable{
       @Inject
       private UserManager userManager;
    }

这是我的错误追踪:

SEVERE:   Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI definition failure:The type of the injection point userManager is com.anosym.remote.ejb.manager.user.UserManager.  The type of the physical resource is com.anosym.ejb.facade.CompanyFacade They are incompatible. 
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
    at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:356)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:744)
Caused by: javax.enterprise.inject.spi.DefinitionException: The type of the injection point userManager is com.anosym.remote.ejb.manager.user.UserManager.  The type of the physical resource is com.anosym.ejb.facade.CompanyFacade They are incompatible. 
    at org.glassfish.weld.services.InjectionServicesImpl.throwProducerDefinitionExeption(InjectionServicesImpl.java:289)
    at org.glassfish.weld.services.InjectionServicesImpl.validateResourceClass(InjectionServicesImpl.java:280)
    at org.glassfish.weld.services.InjectionServicesImpl.validateEjbProducer(InjectionServicesImpl.java:204)
    at org.glassfish.weld.services.InjectionServicesImpl.registerInjectionTarget(InjectionServicesImpl.java:167)
    at org.jboss.weld.manager.InjectionTargetFactoryImpl.postProcessInjectionTarget(InjectionTargetFactoryImpl.java:119)
    at org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:102)
    at org.jboss.weld.bean.ManagedBean.<init>(ManagedBean.java:100)
    at org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:84)
    at org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:269)
    at org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:238)
    at org.jboss.weld.bootstrap.BeanDeployer.createClassBeans(BeanDeployer.java:202)
    at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:265)
    at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:495)
    at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:213)
    ... 36 more

我正在尝试部署一个ear存档,但它失败并出现此错误:

它以某种方式解决了对错误实现的远程引用。

我做错了什么?

编辑:

我已将生产者字段更改为生产者方法:

@Stateless
@LocalBean
public class CDIProducer{
  @EJB
  private UserManager userManager

  @Produces
  public UserManager getUserManager(){
    return userManager;
  }
}

在注射点,现在我得到了一个差异错误:

SEVERE:   EJB5070: Exception creating stateless session bean : [CDIProducer]
WARNING:   EJB5184:A system exception occurred during an invocation on EJB CDIProducer method: public com.anosym.remote.ejb.manager.user.UserManager com.anosym.web.CDIProducer.getUserManager()
WARNING:   javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
    at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:435)
    at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2516)
    at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1906)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
    at com.sun.proxy.$Proxy310.getUserManager(Unknown Source)
    at com.anosym.web.__EJB31_Generated__CDIProducer__Intf____Bean__.getUserManager(Unknown Source)
    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.jboss.weld.util.reflection.Reflections.invokeAndUnwrap(Reflections.java:396)
    at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:108)
    at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
    at org.jboss.weld.bean.proxy.InjectionPointPropagatingEnterpriseTargetBeanInstance.invoke(InjectionPointPropagatingEnterpriseTargetBeanInstance.java:63)
    at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:101)
    at com.anosym.web.CDIProducer$Proxy$_$$_Weld$EnterpriseProxy$.getUserManager(Unknown Source)
    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.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
    at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:86)
    at org.jboss.weld.injection.producer.ProducerMethodProducer.produce(ProducerMethodProducer.java:97)
    at org.jboss.weld.injection.producer.AbstractMemberProducer.produce(AbstractMemberProducer.java:132)
    at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:189)
    at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:716)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:774)
    at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
    at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:368)
    at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:377)
    at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:72)
    at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:60)
    at org.jboss.weld.injection.producer.DefaultInjector$1.proceed(DefaultInjector.java:66)
    at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:142)
    at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:46)
    at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:64)
    at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:91)
    at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:158)
    at org.jboss.weld.context.ForwardingContextual.create(ForwardingContextual.java:27)
    at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:103)
    at org.jboss.weld.context.PassivatingContextWrapper$AbstractPassivatingContextWrapper.get(PassivatingContextWrapper.java:64)
    at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:93)
    at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
    at com.anosym.controller.FeaturedController$Proxy$_$$_WeldClientProxy.getTop2ApprovedFeaturedAds(Unknown Source)
    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 javax.el.BeanELResolver.getValue(BeanELResolver.java:363)
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:140)
    at com.sun.el.parser.AstValue.getValue(AstValue.java:204)
    at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
    at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
    at com.sun.faces.facelets.component.UIRepeat.getValue(UIRepeat.java:274)
    at com.sun.faces.facelets.component.UIRepeat.getDataModel(UIRepeat.java:250)
    at com.sun.faces.facelets.component.UIRepeat.setIndex(UIRepeat.java:444)
    at com.sun.faces.facelets.component.UIRepeat.doVisitChildren(UIRepeat.java:679)
    at com.sun.faces.facelets.component.UIRepeat.visitTree(UIRepeat.java:637)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
    at org.primefaces.component.tabview.TabView.visitTree(TabView.java:414)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
    at com.sun.faces.application.ValidateComponentNesting.processEvent(ValidateComponentNesting.java:53)
    at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
    at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
    at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2187)
    at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2163)
    at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:303)
    at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:739)
    at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:739)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:994)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.omnifaces.facesviews.FacesViewsForwardingFilter.doFilter(FacesViewsForwardingFilter.java:130)
    at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:744)
Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
    at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:700)
    at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:246)
    at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:430)
    ... 113 more
Caused by: javax.ejb.CreateException: Could not create stateless EJB
    at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:514)
    at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:97)
    at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:698)
    ... 115 more
Caused by: java.lang.IllegalStateException: Exception attempting to inject Remote ejb-ref name=com.anosym.web.CDIProducer/userManager,Remote 3.x interface =com.anosym.remote.ejb.manager.user.UserManager resolved to intra-app EJB UserManagerImpl in module kataxi-ejb-1.0-SNAPSHOT.jar,ejb-link=kataxi-ejb-1.0-SNAPSHOT.jar#UserManagerImpl,lookup=,mappedName=,jndi-name=com.anosym.remote.ejb.manager.user.UserManager,refType=Session into class com.anosym.web.CDIProducer: Can not set com.anosym.remote.ejb.manager.user.UserManager field com.anosym.web.CDIProducer.userManager to com.anosym.remote.ejb.manager.user._UserManager_Wrapper
    at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:145)
    at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:46)
    at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:64)
    at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:91)
    at org.glassfish.weld.services.JCDIServiceImpl.injectEJBInstance(JCDIServiceImpl.java:257)
    at com.sun.ejb.containers.BaseContainer.injectEjbInstance(BaseContainer.java:1683)
    at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:475)
    ... 117 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=com.anosym.web.CDIProducer/userManager,Remote 3.x interface =com.anosym.remote.ejb.manager.user.UserManager resolved to intra-app EJB UserManagerImpl in module kataxi-ejb-1.0-SNAPSHOT.jar,ejb-link=kataxi-ejb-1.0-SNAPSHOT.jar#UserManagerImpl,lookup=,mappedName=,jndi-name=com.anosym.remote.ejb.manager.user.UserManager,refType=Session into class com.anosym.web.CDIProducer: Can not set com.anosym.remote.ejb.manager.user.UserManager field com.anosym.web.CDIProducer.userManager to com.anosym.remote.ejb.manager.user._UserManager_Wrapper
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:717)
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:484)
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:170)
    at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:138)
    ... 123 more
Caused by: java.lang.IllegalArgumentException: Can not set com.anosym.remote.ejb.manager.user.UserManager field com.anosym.web.CDIProducer.userManager to com.anosym.remote.ejb.manager.user._UserManager_Wrapper
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164)
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168)
    at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
    at java.lang.reflect.Field.set(Field.java:741)
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:665)
    ... 126 more

我可以忘记生产者并简单地将本地bean CDIProducer注入(在jboss as7上但不在glassfish上):

@EJB
private CDIProducer producer;

然后使用注入的远程ejbs:

producer.getUserManagr().doSomething();

我真的希望避免这种情况。

Field Class loader: WebappClassLoader (delegate=false; repositories=WEB-INF/classes/)

Injected Class loader: EarClassLoader : 
urlSet = [URLEntry : file:/programming/java-projects/anosym/app/app-ear/target/gfdeploy/app-ear/app-ejb-1.0-SNAPSHOT_jar/, URLEntry : file:/home/user/glassfish4/glassfish/domains/domain1/generated/ejb/app-ear/app-ejb-1.0-SNAPSHOT_jar, URLEntry : file:/programming/java-projects/anosym/app/app-ear/target/gfdeploy/app-ear/app-service-ejb-1.0-SNAPSHOT_jar/, URLEntry : file:/home/user/glassfish4/glassfish/domains/domain1/generated/ejb/app-ear/app-service-ejb-1.0-SNAPSHOT_jar]
doneCalled = false 
 Parent -> org.glassfish.internal.api.DelegatingClassLoader@75e246cc

2 个答案:

答案 0 :(得分:0)

如果您的类已经是EJB,那么为它创建生成器方法或字段是多余的。 EJB已经公开,可以使用@Inject注入。为什么你认为你需要一个生产者方法/领域?

答案 1 :(得分:0)

基于编辑,我在glassfish-web.xml上实现了,你需要将classloader委托设置为true才能使用耳宽类加载器,这将确保接口是同一个类(相同的类加载器)< / p>

<glassfish-web-app error-url="">
  <context-root>/</context-root>
  **<class-loader delegate="true"/>**
  <jsp-config>
    <property name="keepgenerated" value="true">
      <description>Keep a copy of the generated servlet class' java code.</description>
    </property>
  </jsp-config>
</glassfish-web-app>