0 Replies Latest reply on Apr 4, 2007 1:15 PM by Robert Simmons

    EAR Deployment Classloader Issues

    Robert Simmons Newbie

      Greetings, I am having a problem with deploying an EAR to the current production release of JBoss. The problem is that I have two WARs that use the same libraries as the EJBs in the EAR. However, neither WAR is able to see the libraries that are deployed in the EAR. Multiple attempts to resolve this problem have been unsuccessful and the classpath errors continue. Ultimately I would like all of the libraries in the EAR only once and in a place where all WARs and EJBs can access them.

      The EAR is structured in the following way:

      myapp.ear
      * APP-INF
      * * classes
      * * * ehcache.xml
      * * * jndi.properties
      * * * myapp.hibernate.cfg.xml
      * lib
      * * commons-lang.jar
      * * mycom-common-utils.jar
      * * ... other jars
      * META-INF
      * * application.xml
      * * jboss-app.xml
      * * MANIFEST.MF
      * myapp-ejb.jar
      * myapp-web.war
      * myapp-ws-axis.war


      The application.xml file contains the following contents:


      <?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 id="ProducerManagementApplication">
      <display-name>myappServices</display-name>
      <module>
      <ejb>myapp-ejb.jar</ejb>
      </module>
      <module>
      <web>
      <web-uri>myapp-ws-axis.war</web-uri>
      <context-root>myappWebServices</context-root>
      </web>
      </module>
      <module>
      <web>
      <web-uri>myapp-web.war</web-uri>
      <context-root>myapp</context-root>
      </web>
      </module>
      <security-role>
      <role-name>myapp.USER</role-name>
      </security-role>
      </application>


      The jboss-app.xml contains:


      <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">

      <jboss-app>
      <security-domain>java:/jaas/mycom-ldap</security-domain>
      <loader-repository>com.mycom.myapp:loader=mycom-myapp</loader-repository>
      <security-role>
      <role-name>myapp.user</role-name>
      <principal-name>myapp.USER</principal-name>
      </security-role>
      </jboss-app>


      The MANIFEST.MF Contains


      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.7.0
      Created-By: 1.6.0-b88-17-release (Apple Computer, Inc.)


      Attempts were made to include the libs in the Class-Path attribute of the manifest with no change in the issues.

      The myapp-web.war web-inf files are:

      web.xml

      <?xml version="1.0" encoding="ISO-8859-1"?>

      <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">

      <web-app>
      <display-name>ICAT Producer Management</display-name>
      <listener>
      <listener-class>com.mycom.myapp.web.listener.myappSessionAttributeListener</listener-class>
      </listener>
      <listener>
      <listener-class>com.mycom.myapp.web.listener.myappContextAttributeListener</listener-class>
      </listener>
      <!-- Standard Action Servlet Configuration (with debugging) -->
      <servlet>
      <servlet-name>action</servlet-name>
      <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
      <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
      </init-param>
      <init-param>
      <param-name>debug</param-name>
      <param-value>4</param-value>
      </init-param>
      <init-param>
      <param-name>detail</param-name>
      <param-value>4</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
      </servlet>

      <servlet>
      <servlet-name>Initialize</servlet-name>
      <description>Put logic in here that needs to be run on startup</description>
      <servlet-class>com.mycom.myapp.web.util.Initializer</servlet-class>
      <load-on-startup>1</load-on-startup>
      </servlet>

      <!-- Standard Action Servlet Mapping -->
      <servlet-mapping>
      <servlet-name>action</servlet-name>
      <url-pattern>*.do</url-pattern>
      </servlet-mapping>

      <!-- After the user authenticates, send them to this page: -->
      <welcome-file-list>
      <welcome-file>/Main.do</welcome-file>
      </welcome-file-list>

      <security-constraint>
      <display-name>SecurityConstraint</display-name>
      <web-resource-collection>
      <web-resource-name>myapp Application</web-resource-name>
      <url-pattern>*.do</url-pattern>
      <url-pattern>*.jsp</url-pattern>
      <http-method>POST</http-method>
      <http-method>GET</http-method>
      </web-resource-collection>
      <auth-constraint>
      <role-name>myapp.USER</role-name>
      </auth-constraint>
      <user-data-constraint>
      <transport-guarantee>NONE</transport-guarantee>
      </user-data-constraint>
      </security-constraint>

      <login-config>
      <auth-method>FORM</auth-method>
      <realm-name>mycom-ldap</realm-name>
      <form-login-config>
      <form-login-page>/login.jsp</form-login-page>
      <form-error-page>/loginError.jsp</form-error-page>
      </form-login-config>
      </login-config>

      <security-role>
      <role-name>myapp.USER</role-name>
      </security-role>
      </web-app>


      jboss-web.xml

      <!DOCTYPE jboss-web
      PUBLIC "-//JBoss//DTD Web Application 2.3//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd">
      <jboss-web>
      <class-loading>
      <loader-repository>
      com.mycom.myapp:loader=mycom-myapp
      </loader-repository>
      </class-loading>
      </jboss-web>