On Tue, 4 Mar 2003 05:26, Chris Bonham wrote:
> There have been a couple of discussions about how to establish dependencies
> between deployment units (EARs, JARs, SARs, etc.)  But how can you make
> sure that a bean is not deployed until another has been?
>
> Environment: JBoss 3.2.0beta2, Sun JDK 1.4.1_01, WinXP Pro, Oracle 9i
>
> Basically, we have an MDB that listens on a JMS queue (via
> JVMServerILService) and it calls a stateless session bean that performs
> some business operations. In the case where JBoss was shutdown improperly,
> there are still messages on the queue that are persisted in the
> JMS_MESSAGES table (we're using the JDBC2 PersistenceManager).  When JBoss
> starts up, the undelivered messages are sent, triggering the MDB, but the
> dependent SLSB is not yet ready!  Is there a way to reorder this sequence
> of events or is it a bug?  I've attached a stacktrace.

1) You can indicate a dependency of one jar(sar/war,etc..) on another using
   the manifest Class-Path entry. So if using ant you would put

     <jar destfile="charlie.jar">
       <manifest>
         <attribute name="Class-Path" value="fred.jar"/>
       </manifest>
      ...
     </jar>

   and then charlie.jar will depend on fred.jar so fred.jar will get loaded
   first. Space seperate other jar files in the value if you need more than
   one.

2) If it is an MBean requiring an ejb then you can put explicit dependencies
   in the MBean declaration in the jboss-service.xml. XDoclet can sort of
   handle this for you if you are using it to generate the jboss-service.xml
   in the sar file. What you need is a <depends>...</depends> with the MBean
   name for the EJB in it, ie: "jboss.j2ee:jndiName=ejb/aardvark/Name,service=EJB".

3) Finally for MBeans, you can just put a classpath element in the *-service.xml
   referencing the dependent jar, ie

     <classpath codebase="." archives="fred.jar"/>

Remember that loading an EJB jar both loads the classes *and* starts the ejbs,
similarly for other jars with descriptors in them. If you just want to access classes
then you need to seperate them from the deployment descriptors. I usually have
a _client.jar and an _ejb.jar for ejbs. The client jar file contains most of the 
classes,
the ejb one has the bean classes and the deployment descripters. Similar for
other types.


brian wallis...

P.S. I am only just getting this right myself, dependencies can get very complicated 
in a large multi component project.


-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to