[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: classloading dependencies

adrian@jboss.org do-not-reply at jboss.com
Tue Feb 10 05:27:11 EST 2009


"jhalliday" wrote : I'm trying to deploy a .jar in AS 5. It contains a bean, let's call it fooBean, that links against class barClass. barClass is not in the .jar, it's in barModule. So at first I try
  | 
  | 
  |   | <bean name="fooBean" class="fooBean">
  |   |        <depends>barModule</depends>
  |   | 
  | 
  | which results in a ClassDefNotFound. Apparantly MC tries to classload the fooBean even though barModule does not yet exist. So I rant a bit about how unintuitive that is, 
  | 

A depends is for the create/start stages of the lifecycle
which is much too late for a classloading dependency.

You want to use a demand to stop the bean from being analysed for annotations
during initial installation.


  | <bean name="fooBean" class="fooBean">
  |    <demand state="PreInstall">barModule</demand>
  | 

anonymous wrote : 
  | then try to add a jboss-classloading.xml:
  | 
  | 
  |   | <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY">
  |   |    <requirements>
  |   |        <package name="org.jboss.bar"/>
  |   |    </requirements>
  |   | </classloading>
  |   | 
  | 
  | which at least prevents deployment until barModule is present, but then throws
  | 
  | 
  |   | java.lang.NullPointerException
  |   | 	at org.jboss.classloading.spi.dependency.ClassLoadingSpace.resolve(ClassLoadingSpace.java:325)
  |   | 	at org.jboss.classloading.spi.dependency.Module.resolveModule(Module.java:737)
  |   | 	at org.jboss.classloading.spi.dependency.RequirementDependencyItem.resolve(RequirementDependencyItem.java:87)
  |   | 
  | 
  | Apparently barModule.getClassLoadingSpace() returns null.
  | 
  | So now I'm stuck. What's the correct way to solve this dependency problem?

That's already been fixed:
https://jira.jboss.org/jira/browse/JBCL-77

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4208453#4208453

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4208453



More information about the jboss-dev-forums mailing list