1 Reply Latest reply on Sep 26, 2004 9:47 AM by Costin Leau

    JBoss UCL and EAR packaging

    Costin Leau Newbie

      Hello.

      I know that classloading has been talked over and over again this forum and I searched for relevant information but without success. I have browsed the documentation and the WIKI, google and still no solution

      Here is my problem: I have an application based on WebWork, EJBs and Hibernate. It's big and is getting bigger, so far we have around 30 hbms and the same number of POJOs which map to the same number of tables.

      Also the number of EJB si beyond 60 so deployment takes a while. The web side is very reach and changes happen very often. In our current deployment environment we use EAR which makes the EJB and HB part to happen *every* time a small change occurs on the web tier.

      This is like banging the head against the wall - the server runs out of memory every 4 deploys. The solution would be to deploy only the web tier and have the EAR unpack.

      I'm using JBoss 3.2.5 and I have the following jboss-tomcat.sar/META-INF/jboss-service.xml

      <server>
      
       <mbean code="org.jboss.web.tomcat.tc5.Tomcat5"
       name="jboss.web:service=WebServer">
      
       <!-- Get the flag indicating if the normal Java2 parent first class
       loading model should be used over the servlet 2.3 web container first
       model.
       -->
       <attribute name="Java2ClassLoadingCompliance">true</attribute>
      
       <attribute name="LenientEjbLink">true</attribute>
      
       <!-- A flag indicating if the JBoss Loader should be used. This loader
       uses a unified class loader as the class loader rather than the tomcat
       specific class loader.
       -->
       <attribute name="UseJBossWebLoader">false</attribute>
       ...
      </server>
      


      At EAR lvl I have enabled the Java2ClassLoading flag off to allow servlet 2.3 behaviour. If I have both class loaders turned off then all my local interfaces don't work - I only get remote interfaces and the whole application goes down (I don't even have remote interfaces in the project).

      Here is my application.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application
      1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
      <application>
       <display-name>MyApp</display-name>
       <module>
       <ejb>ejb.jar</ejb>
       </module>
       <module>
       <web>
       <web-uri>web.war</web-uri>
       <context-root>www</context-root>
       </web>
       </module>
       <module>
       <java>common.jar</java>
       </module>
      
       <module>
       <java>commons-lang-2.0.jar</java>
       </module>
       <module>
       <java>webwork-2.1.1.jar</java>
       </module>
       <module>
       <java>xwork.jar</java>
       </module>
       <module>
       <java>velocity-dep.jar</java>
       </module>
      
       <module>
       <java>velocity-tools-view-1.1.jar</java>
       </module>
      
       <module>
       <java>ognl-2.6.5.jar</java>
       </module>
       <module>
       <java>oscore-2.2.4.jar</java>
       </module>
       <module>
       <java>sitemesh-2.1.jar</java>
       </module>
      
      </application>
      


      and jboss-app.xml

      <jboss-app>
      
       <loader-repository>app:loader=dev.ear</loader-repository>
      
       <loader-repository-config>
       java2ParentDelegaton=false
       </loader-repository-config>
       <module>
       <service>hibernate.sar</service>
       </module>
      </jboss-app>
      


      I have to mention that the hibernate.sar is deployed accordingly to the documentation from hibernate.org http://www.hibernate.org/66.html as an mbean and due to an interceptor it has dependecies on the webwork2 libraries which belong to the web tier.

      However, if I unpack the EAR and deploy the WAR, EJBs and HB SAR separately even though I mention the same loader repository and delegation module I get a big ClassCastException due to Remote interfaces (no more local interfaces) not to mention that I have to put the libraries that are shared in SAR and WAR (and this means 2 MB!!!).

      Basically, I need help on:

      1. how to avoid the remote interfaces from appearing when changing the java delegation (2.3 servlet specs on) and JBossWebCL off (to use tomcat loading and not have the libraries along the other share libs)?

      2. how can I share jars between different components inside the same loader repository? I am looking for something similar to
      <module>
       <java></java>
      </module>


      for the EAR descriptor.


      Thank you.