facebook

CDI not working with MyEclipse hotdeploy

  1. MyEclipse IDE
  2.  > 
  3. WebSphere Development
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #331038 Reply

    striebhz
    Member

    In our project we worked with JSF ManagedBeans and EJB DI (@EJB annotation) which worked fine.

    Now we need to switch from JSF ManagedBeans to CDI (@Named and @Inject annotations) but unfortunately, CDI does not work when we deploy our project in MyEclipse.
    The JSF beans cannot be resolved or we are getting errors like

    Caused by: com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Api type [x.y.z.BusinessFacade] is not found with the qualifiers 
    Qualifiers: [@javax.enterprise.inject.Default()]
    for injection into 
     Field Injection Point, field :  private x.y.z.BusinessFacade x.y.z.managedbeans.JsfBean.businessFacade, Bean Owner : [-53106909,Name:jsfBean,WebBeans Type:MANAGED,API Types:[java.lang.Object,java.io.Serializable,x.y.z.managedbeans.JsfBean],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
          InjectionType   :  [class x.y.z.BusinessFacade]
          Annotated       :  [Annotated Field,Base Type : class x.y.z.BusinessFacade,Type Closures : [class java.lang.Object, class x.y.z.BusinessFacade, interface java.io.Serializable, class x.y.z.AbstractBusinessFacade],Annotations : [@javax.inject.Inject()],Java Member Name : businessFacade]
          Qualifiers      :  [[@javax.enterprise.inject.Default()]]

    However, if we deploy the same EAR file in WebSphere directly (via Admin Console) everything works fine so this issue is MyEclipse related.

    #331041 Reply

    support-swapna
    Moderator

    striebhz,

    Sorry that you are seeing this issue.

    1. Can you please share the details about the version of your project along with the websphere server version?

    2. Also please share the contents of the deployment.log for us to investigate further. Clear the deployment.log, replicate the issue and then copy paste the contents of the deployment log here.

    #331086 Reply

    striebhz
    Member

    The project is a JEE6 application for WAS 8.0.
    We are using JPA 2.0, JSF 2.0, EJB 3.1, everything from WAS. We used JSF ManagedBeans with EJB DI and want use CDI with EJB DI (or just CDI).
    Deployment is made via “Enhanced mode” (“Classic mode” is not working properly it gets stuck after deploying ~60% of the ejb modules, neither exploded nor packaged)

    Deployment.log:

    ---------------------------------------------------------------------------------------------------------------------------------
    MyEclipse: deploy START packaged project: myearproject server: websphere8Server#base time: Thu Oct 11 11:01:42 CEST 2012
    ---------------------------------------------------------------------------------------------------------------------------------
    ADMA5016I: Installation of myearproject started.
    ADMA5058I: Application and module versions are validated with versions of deployment targets.
    ADMA5005I: The application myearproject is configured in the WebSphere Application Server repository.
    ADMA5005I: The application myearproject is configured in the WebSphere Application Server repository.
    ADMA5081I: The bootstrap address for client module is configured in the WebSphere Application Server repository.
    ADMA5053I: The library references for the installed optional package are created.
    ADMA5005I: The application myearproject is configured in the WebSphere Application Server repository.
    ADMA5001I: The application binaries are saved in D:\Programme\IBM\WebSphere8\AppServer\profiles\base\wstempa4f0f9874\workspace\cells\iap\applications\myearproject.ear\myearproject.ear
    ADMA5005I: The application myearproject is configured in the WebSphere Application Server repository.
    SECJ0400I: Successfully updated the application myearproject with the appContextIDForSecurity information.
    ADMA5005I: The application myearproject is configured in the WebSphere Application Server repository.
    ADMA5005I: The application myearproject is configured in the WebSphere Application Server repository.
    ADMA5113I: Activation plan created successfully.
    ADMA5011I: The cleanup of the temp directory for application myearproject is complete.
    ADMA5013I: Application myearproject installed successfully.
    ----------------------------------------------------------------------------------------------------------------------
    MyEclipse: deploy END project: myearproject server: websphere8Server#base time: Thu Oct 11 11:04:12 CEST 2012
    ----------------------------------------------------------------------------------------------------------------------

    Exception:

    javax.enterprise.inject.UnsatisfiedResolutionException: Api type [x.y.z.BusinessFacade] is not found with the qualifiers 
    Qualifiers: [@javax.enterprise.inject.Default()]
    for injection into 
     Field Injection Point, field :  private x.y.z.BusinessFacade x.y.web.ManagedBean.businessFacade, Bean Owner : [-1904380501,Name:managedBean,WebBeans Type:MANAGED,API Types:[java.lang.Object,java.io.Serializable,x.y.web.ManagedBean],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]]
          InjectionType   :  [class x.y.z.BusinessFacade]
          Annotated       :  [Annotated Field,Base Type : class x.y.z.BusinessFacade,Type Closures : [class java.lang.Object, class x.y.z.AbstractBusinessFacade, interface java.io.Serializable, class x.y.z.BusinessFacade],Annotations : [@javax.inject.Inject()],Java Member Name : businessFacade]
          Qualifiers      :  [[@javax.enterprise.inject.Default()]]
        at org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:92)
        at org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:96)
        at org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:189)
        at org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1087)
        at org.apache.webbeans.config.BeansDeployer.validate(BeansDeployer.java:388)
        at org.apache.webbeans.config.BeansDeployer.validateInjectionPoints(BeansDeployer.java:332)
        at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:183)
        at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:124)
        at org.apache.webbeans.web.lifecycle.WebContainerLifecycle.startApplication(WebContainerLifecycle.java:78)
        at com.ibm.ws.webbeans.common.CommonLifeCycle.startApplication(CommonLifeCycle.java:106)
        at com.ibm.ws.webbeans.services.JCDIServletContainerInitializer.onStartup(JCDIServletContainerInitializer.java:85)
        at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:609)
        at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:405)
        at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
        at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
        at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:746)
        at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
        at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:422)
        at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:714)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1154)
        at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1369)
        at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:638)
        at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:967)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:760)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1348)
        at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2144)
        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:5413)
        at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5539)
        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:1240)
        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.invokeMethod(RequiredModelMBean.java:1085)
        at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:966)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:773)
        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.AppManagementImpl._startApplication(AppManagementImpl.java:1481)
        at com.ibm.ws.management.application.AppManagementImpl.startApplication(AppManagementImpl.java:1370)
        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.invokeMethod(RequiredModelMBean.java:1085)
        at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:966)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:773)
        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.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
        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 com.ibm.ws.management.connector.soap.SOAPConnector.invoke(SOAPConnector.java:480)
        at com.ibm.ws.management.connector.soap.SOAPConnector.service(SOAPConnector.java:309)
        at com.ibm.ws.management.connector.soap.SOAPConnection.handleRequest(SOAPConnection.java:65)
        at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:733)
        at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:522)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659)
    #331090 Reply

    striebhz
    Member
    #331095 Reply

    support-swapna
    Moderator

    striebhz,

    Thank you for the details.

    1. Can you please check if the web module’s MANIFEST.MF entry is pointing to the EJB module ? It might be the reason why the @Inject in that module does not see beans in the EJB module.

    Please take a look at this link to trouble shoot dependeny injection issues on WAS. Check the point 2 ‘Resolve an unsatisfiable dependency ‘ :
    http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Ftweb_troubleshoot_cdi.html

    2. Can you check if in-workspace deployment fixes the issue discussed here? :
    https://www.genuitec.com/forums/topic/redeploy-with-changed-xhtml-only/

    Let us know how it works for you.

    #331099 Reply

    striebhz
    Member

    I’m making some test but it doesn’t seem to help :-/ I’m coming back to that in some minutes…

    But to the other problem:
    @support-swapna wrote:

    2. Can you check if in-workspace deployment fixes the issue discussed here? :
    https://www.genuitec.com/forums/topic/redeploy-with-changed-xhtml-only/

    In-Workspace-Deployment seems to fix it, yes. Unfortunately, we can’t use it, because we have separate source and output folders for test cases and for unknown reason, our resource/message bundle for i18n in JSF isn’t found.
    But, according to the test I have made, In-Workspace-Mode is much faster and would solve it.
    Please make it production-ready. 🙂

    #331111 Reply

    striebhz
    Member

    @support-swapna wrote:

    1. Can you please check if the web module’s MANIFEST.MF entry is pointing to the EJB module ? It might be the reason why the @Inject in that module does not see beans in the EJB module.

    You are right, the MANIFEST.MF is empty. However, I can’t find a possibility to fix that:

    We are using maven for our projects and if MyEclipse builds the ear file (File -> Export or hotdeploy is the same) the MANIFEST.MF files of the EAR and of the WAR have an empty classpath.

    After building with maven, everything is built correctly and that is (probably) why deploying via Admin Console worked.

    How can I change that!? Are there configuration options for the maven integration?

    #331148 Reply

    support-swapna
    Moderator

    striebhz,

    The issue with in-workspace deployment you are seeing is a known issue and our dev team is looking into it.

    1. For the issue with empty MANIFEST.MF file, make sure all your Maven projects use Deployment Assembly. Select project, right click -> Properties -> MyEclipse -> Deployment Assembly. “Use deployment assembly mapping for deployment” should be checked.

    2. Can you please check something for us ?

    a. Export EAR file using our export wizard
    b. Compare such EAR with the one built using Maven (there will be source files – please ignore that difference)

    Let us know what differences you see and also the contents of the Maven built MANIFEST.MF file.

    #331251 Reply

    striebhz
    Member

    1. The deployment assembly is active for all projects – EJB modules, WAR module and EAR project.
    One thing I noticed is that the WAR module has the maven dependencies in the deployment assembly while the EJB modules do not.

    2. The difference is that the exported EAR file does not contain MANIFEST.MF files for the EAR and the WAR ( the EJB modules are fine).
    The “empty” MANIFEST.MF came from manually created files in the resource folder. I deleted them and now there are no MANIFEST.MF files any more.
    But the maven build generates them.

    There are generated files in target/m2ee-jee/(ear|war)-resources/META-INF but they are not copied to the archives.

    #331311 Reply

    support-swapna
    Moderator

    striebhz,

    Thank you for the details. I have filed a PR for the dev team to look into it.
    For now please copy the MANIFEST.MFs generated by Maven from target/m2ee-jee/(ear|war)-resources/META-INF to a main src folder.

    Sorry for inconvenience caused.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: CDI not working with MyEclipse hotdeploy

You must be logged in to post in the forum log in