2015-01-09 7 views
0

의 원인, 다음 주입 널 도착하지 않은 :CDI 주입도 CDI 패싯 즉 일을하는 CDI @Inject를 받고 실패하면 예외

private Standardizating standardizeService; 

@Inject 
public void setStandardizating(Standardizating standardizeService) { 

    this.standardizeService = standardizeService; 
} 

클래스 주입을 :

@Default 
public class StandardizationService extends Service implements Standardizating { 

내가 CDI 1.0 8.5 WAS 내 이클립스/케플러의면이 나타났습니다 (I는 META-INF \ beans.xml 환경이있다). 나는 패싯을 켜 놓았고 다음과 같은 예외가 생겼다. (적어도 이제는 CDI가 작동하는 것을 볼 수있다.) 나는 이전에 로그에서 아무것도 보지 못했다.

[09/01/15 15:06:14:097 EST] 00000091 StandaloneEJB I StandaloneEJBLifeCycle startApplication OpenWebBeans Container is starting... 
[09/01/15 15:06:14:136 EST] 00000091 Helpers  W NMSV0606E: Object is not of any type which can be bound. 
[09/01/15 15:06:14:140 EST] 00000091 BeansDeployer E BeansDeployer deploy 
          java.lang.RuntimeException: 
com.ibm.ws.naming.util.CannotBindObjectException: Object is not of any type which can be bound. 
    at com.sun.jersey.server.impl.cdi.CDIExtension.initialize(CDIExtension.java:196) 
    at com.sun.jersey.server.impl.cdi.CDIExtension.beforeBeanDiscovery(CDIExtension.java:297) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:285) 
    at org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:455) 
    at org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:415) 
    at org.apache.webbeans.config.BeansDeployer.fireBeforeBeanDiscoveryEvent(BeansDeployer.java:260) 
    at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:159) 
    at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:124) 
    at com.ibm.ws.webbeans.common.CommonLifeCycle.startApplication(CommonLifeCycle.java:106) 
    at com.ibm.ws.webbeans.services.JCDIComponentImpl.startEJBLifeCycle(JCDIComponentImpl.java:588) 
    at com.ibm.ws.webbeans.services.JCDIComponentImpl.stateChanged(JCDIComponentImpl.java:562) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.stateChanged(ApplicationMgrImpl.java:1120) 
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectEvent(DeployedApplicationImpl.java:1353) 
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.setState(DeployedApplicationImpl.java:294) 
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.setState(DeployedApplicationImpl.java:289) 
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:978) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:774) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1374) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2179) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445) 
    at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:663) 
    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5384) 
    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5600) 
    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:677) 
    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621) 
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1266) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:49) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:256) 
    at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148) 
    at java.security.AccessController.doPrivileged(AccessController.java:252) 
    at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30) 
    at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41) 
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142) 
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:995) 
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848) 
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:774) 
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335) 
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) 
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228) 
    at com.ibm.ws.management.application.sync.StartDeploymentTask.startDeployment(StartDeploymentTask.java:247) 
    at com.ibm.ws.management.application.sync.StartDeploymentTask.fullAppUpdate(StartDeploymentTask.java:119) 
    at com.ibm.ws.management.application.sync.StartDeploymentTask.performTask(StartDeploymentTask.java:107) 
    at com.ibm.ws.management.application.sync.AppBinaryProcessor$ExpandApp.expand(AppBinaryProcessor.java:1711) 
    at com.ibm.ws.management.application.sync.AppBinaryProcessor.postProcessSynchronousExt(AppBinaryProcessor.java:751) 
    at com.ibm.ws.management.bla.sync.BLABinaryProcessor.postProcess(BLABinaryProcessor.java:599) 
    at com.ibm.ws.management.bla.sync.BLABinaryProcessor.onChangeCompletion(BLABinaryProcessor.java:476) 
    at com.ibm.ws.management.bla.sync.BinaryProcessorWrapper.onChangeCompletion(BinaryProcessorWrapper.java:109) 
    at com.ibm.ws.management.repository.FileRepository.postNotify(FileRepository.java:1924) 
    at com.ibm.ws.management.repository.FileRepository.update(FileRepository.java:1433) 
    at com.ibm.ws.management.repository.client.LocalConfigRepositoryClient.update(LocalConfigRepositoryClient.java:189) 
    at com.ibm.ws.sm.workspace.impl.WorkSpaceMasterRepositoryAdapter.update(WorkSpaceMasterRepositoryAdapter.java:665) 
    at com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.update(RepositoryContextImpl.java:1998) 
    at com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.synch(RepositoryContextImpl.java:1946) 
    at com.ibm.ws.sm.workspace.impl.WorkSpaceImpl.synch(WorkSpaceImpl.java:549) 
    at com.ibm.ws.management.configservice.ConfigServiceImpl.save(ConfigServiceImpl.java:719) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:49) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 
    at java.lang.reflect.Method.invoke(Method.java:611) 
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:256) 
    at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148) 
    at java.security.AccessController.doPrivileged(AccessController.java:252) 
    at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30) 
    at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41) 
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142) 
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:995) 
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848) 
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:774) 
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335) 
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) 
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228) 
    at com.ibm.ws.management.remote.AdminServiceForwarder.invoke(AdminServiceForwarder.java:346) 
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1465) 
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:85) 
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1306) 
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1398) 
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 
    at javax.management.remote.rmi._RMIConnectionImpl_Tie.invoke(_RMIConnectionImpl_Tie.java:751) 
    at javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(_RMIConnectionImpl_Tie.java:158) 
    at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:669) 
    at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:523) 
    at com.ibm.rmi.iiop.ORB.process(ORB.java:523) 
    at com.ibm.CORBA.iiop.ORB.process(ORB.java:1575) 
    at com.ibm.rmi.iiop.Connection.doRequestWork(Connection.java:3039) 
    at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2922) 
    at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64) 
    at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118) 
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862) 
Caused by: com.ibm.ws.naming.util.CannotBindObjectException: Object is not of any type which can be bound. 
    at com.ibm.ws.naming.util.Helpers.processJavaObjectForBinding(Helpers.java:718) 
    at com.ibm.ws.naming.jndicos.CNContextImpl.doRebind(CNContextImpl.java:2076) 
    at com.ibm.ws.naming.jndicos.CNContextImpl.rebind(CNContextImpl.java:697) 
    at com.ibm.ws.naming.jndicos.CNContextImpl.rebind(CNContextImpl.java:717) 
    at com.sun.jersey.server.impl.cdi.CDIExtension.initialize(CDIExtension.java:193) 
    ... 108 more 

Jersey JAX-RS의 경우이 Jar에도 사용되는 일부 Jersey 라이브러리가 있지만이 예외는 IBM 라이브러리를 참조하는 것으로 보입니다. NMSV0606E는 CORBA 객체, EJB, 직렬화 된 객체가 아닌 객체에 대한 문제를 강조하는 것처럼 보입니다. 나는 CDI로 할 수 있어야한다고 생각되는 간단한 객체를 주입하려고합니다. 그것은 CDI 1.0 패싯에서 말합니다. 이것은 간단한 객체 삽입을 지원합니까? 저는 이것을 결정할 수 없었습니다.

어떤 도움을 주시면 감사하겠습니다 감사합니다

+0

나는 성공하지 못한 채 이것을 일찍 시도했다 : \t @Inject private Standardizating standardizeService; – user1069528

+0

나 자신을 바로 잡자. Jersey 라이브러리는 JAX-RS 휴식 서비스에이 jar 내에서가 아니라 동일한 귀 안에있는 다른 Jar에서 사용됩니다. – user1069528

답변

0

앱이 두 가지 문제가있을 수 있습니다 :

  • 대신 기본 WebSphere JAX-RS 제공자의 저지를 올바르게로 구성해야 사용하려는 경우 고립 된 공유 라이브러리 - 이것을 확인하십시오 - JAX-RS Jersey 2.10 support in Websphere 8
  • JAX-RS 컨테이너를 교체하면 불행히도 CDI는이 등급에서 작동하지 않습니다. here을 참조하십시오.

JAX-RS 런타임 환경을 비활성화, JAX-RS 기능을 사용할 수를 포함하여 기본 JAX-RS 런타임 기능, 기업 자바 빈즈 (EJB) 런타임 통합, 자바 컨텍스트 및 종속성 주입 (아니다 JCDI) 런타임 통합 및 Servlet 3.0 웹 컨테이너 통합.

저지를 사용해야하는 경우가 아니면 defalut WebSphere JAX-RS 구현으로 전환하는 것이 좋습니다. 그러면 CDI가 작동합니다.

+0

감사합니다. 나 자신을 바로 잡자. Jersey 라이브러리는 JAX-RS 휴식 서비스에이 jar 내에서가 아니라 동일한 귀 안에있는 다른 Jar에서 사용됩니다. 이 병 안에 기본 WAS CDI를 사용하고 싶지만 작동하지 않는 것 같습니다. @Inject는 null ptrs로 끝납니다. – user1069528

+0

Jersey 1.17 라이브러리는 CDI를 수행하려고하는 병의 프로젝트에 포함되어 있습니다. 이 라이브러리 프로젝트에는 내가 필요한 다른 것들이 있습니다. config 그룹에 의해 설정됩니다 (변경하기 어려울 수도 있음). – user1069528

+0

@ user1069528 저지 라이브러리를 공유 라이브러리로 추출 할 수 있다면 특정 모듈에만 선택적으로 추가 할 수 있습니다. 또한 별도의 EJB 모듈을 만들고 비즈니스 라이브러리 만 추가하여 작동하는지 확인하십시오. 귀하의 프로젝트 구조를 잘 모릅니다. 그래서 좀 더 구체적인 것을 제안하는 것이 어렵습니다. – Gas