1 Reply Latest reply on Aug 15, 2003 6:45 PM by jonlee

    Complex Classpath Question

    cwstanton

      This may not be a beginner question, but I don't know where else to post it.

      We have a core set of EJBs and several web applications--all currently deployed as a single EAR. We also have a few MBeans--two of which pass custom value object classes back and forth with our EJBs. Presently, I package separate instances of those classes both in the mbeans.jar and in the ejb.jar. (Which end up in the .sar and the .ear, respectively.) But I understand that this results in serialization of the classes since the .sar and the .ear have different classloaders that don't share. (Can they be taught to share?) ;-)

      For reasons of development and licensing, we'd like to split out each web application into its own deployable .war. However, this is going to mean even more classpath juggling.

      Here is my question: I know I could dump all the "common" classes into a .jar and put it in the server/xxx/lib directory, but this would prevent "hot deploys" during development--and that's not acceptable. I could also put this common.jar into server/xxx/deploy, but as far as I can tell, there is no way to control the order that .ears, .wars and .jars are deployed. (Is there?) So the .ear may be deployed before the .jar, resulting in a host of ClassNotFoundExceptions...

      So, how have others solved this? If you have a .sar, an .ear and a .war that all depend on common classes, and you DON'T want to put those common classes in the /lib directory (because you want to be able to hot deploy them), how do you make those common classes available to "everyone?"

      Ideally, how do I get the ConfigClassLoader to load a specific .jar from the /deploy directory before deploying anything else? (Considered another way--Services (.sars) can list dependencies that must be loaded first. Can .ears and .wars list such dependencies??)

      Sorry if I missed the solution to this in the forums or docs somewhere, but I really don't know where to find this...

      Thanks!

      Charles

        • 1. Re: Complex Classpath Question
          jonlee

          There are a few issues encapsulated in this.

          You can influence deployment order. Have a look at the conf/jboss-service.xml in the area of the URLComparator. You can substitute the default sorter with org.jboss.deployment.scanner.PrefixDeploymentSorter. There is more information in the config file on this. This would solve the problem of bootstrap deployment.

          The main problem with the EARs and WARs are there are no dependency attributes.

          The only way I could see an automatic hot deploy working would be if you had the servlet container SAR depend on your custom SAR. This would however force all web apps to redeploy - not necessarily desirable. I'm not sure how an EAR would respond to such an event.

          However, this solution will allow you to manually change deployments and manually redeploy in the right order while solving the bootstrap situation.

          Other than that, perhaps someone else might have a better understanding for a solution.