Bug 1358556

Summary: [GSS](6.4.z) org.jboss.modules.ModuleNotFoundException when setting annotations=true in jboss-deployment-structure.xml
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Brad Maxwell <bmaxwell>
Component: ServerAssignee: Radovan Netuka <rnetuka>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Slavicek <pslavice>
Severity: unspecified Docs Contact: eap-docs <eap-docs>
Priority: unspecified    
Version: 6.4.9CC: chaowan, ihradek, jason.greene, jtruhlar, msochure, rnetuka
Target Milestone: CR1   
Target Release: EAP 6.4.11   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-17 13:14:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1361648    
Attachments:
Description Flags
reproducer none

Description Brad Maxwell 2016-07-21 00:33:19 UTC
helloWorld.ear 
 - helloWorld-ejb.jar
    - HelloBean - @Stateless EJB extends AbstractBean
 - lib 
  - helloWorld-api.jar
    - META-INF
      - jandex.idx
    - Hello - EJB interface
    - AbstractBean - abstract class which has @PostConstruct and implements Hello

helloWorld2.ear
 - helloWorld2-ejb.jar
   - HelloBean2 - @Startup @Singleton extends AbstractBean
 - META-INF
  - jboss-deployment-structure.xml depends on deployment.helloWorld.ear export=true annotations=true


To have HelloBean2 pickup the annotations on AbstractBean, jandex.idx was generate for the helloWorld-api.jar and then the j-d-s.xml file dependency has export=true so helloWorld2-ejb.jar sees the classes and annotations=true set to pull in the annotations.

When annotations is not set or annotations=false the helloWorld2.ear deploys (but the @PostConstruct is not run since annotations are not enabled).  When annotations=true is set, helloWorld2.ear fails to deploy with the exception below.

It looks like the annotations handling is possibly out of order as the j-d-s.xml dependency should ensure the deployment.helloWorld.ear module is there (which it does when annotations=false, but when true it seems the module is not ready)




19:26:59,773 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."helloWorld2.ear".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."helloWorld2.ear".PARSE: JBAS018733: Failed to process phase PARSE of deployment "helloWorld2.ear"
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [jboss-as-server-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.6.Final-redhat-1.jar:1.1.6.Final-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.6.Final-redhat-1.jar:1.1.6.Final-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_101]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_101]
	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_101]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: org.jboss.modules.ModuleNotFoundException: deployment.helloWorld.ear:main
	at org.jboss.as.server.deployment.annotation.CompositeIndexProcessor.deploy(CompositeIndexProcessor.java:83) [jboss-as-server-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [jboss-as-server-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
	... 5 more
Caused by: org.jboss.modules.ModuleNotFoundException: deployment.helloWorld.ear:main
	at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:240) [jboss-modules.jar:1.3.7.Final-redhat-1]
	at org.jboss.as.server.deployment.annotation.CompositeIndexProcessor.deploy(CompositeIndexProcessor.java:74) [jboss-as-server-7.5.9.Final-redhat-2.jar:7.5.9.Final-redhat-2]
	... 6 more


A workaround is putting a jboss-all.xml in helloWorld2.ear/META-INF/ to make a blanket dependency on helloWorld.ear so that helloWorld2.ear is not started until after helloWorld.ear, but this should not be necessary:

<jboss umlns="urn:jboss:1.0">
  <jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">

    <dependency name="helloWorld.ear" />

  </jboss-deployment-dependencies>
</jboss>

Comment 1 Brad Maxwell 2016-07-21 00:41:09 UTC
Created attachment 1182302 [details]
reproducer

Reproducer , unzip the example.zip into the deployments dir and start JBOss

Comment 6 Ivo Hradek 2016-10-04 06:48:38 UTC
Verified with EAP 6.4.11.CP.CR1;

Comment 7 Petr Penicka 2017-01-17 13:14:12 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.

Comment 8 Petr Penicka 2017-01-17 13:15:26 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.