0 Replies Latest reply on Jul 29, 2003 8:56 PM by Leung Kam Lung

    Help with ear structure and deployment descriptor files

    Leung Kam Lung Newbie

      I have an application that requires to use EJBs and Webs (jsp & servlet).
      Please help me to verify the ejb-jar.xml, the jboss.xml, the web.xml and the jboss-web.xml that I included in this post to see if it is ok to deploy in jboss-3.0.1_tomcat-4.0.4.

      The EJB component has the following beans:
      HandService (in a jar named AllServiceBeans.jar)
      FindService (in a jar named FindingServiceBeans.jar)
      GetServiceInfoLocal (in a jar named FindingServiceBeans.jar)

      The FindService bean references both the GetServiceInfoLocal
      bean and the HandService bean.

      The Web component has the following (jsp,servlet and java):
      DisplayResult.jsp (called by the ProcessResultServlet)
      ProcessResultServlet.java (uses the EjbLookupSingleton to get the Home of the FindService bean)
      EjbLookupSingleton.java (normal java class that implement singleton pattern)

      Here is the directory structure for the Enterprise Java Bean application in ear.
      myApplication.ear
      META-INF/
      META-INF/application.xml
      AllServiceBeans.jar
      FindingServiceBeans.jar
      WebModule.war
      lib/
      lib/EjbHelperJavaClasses.jar (contains ejb helper classes. Ex, EjbLookupSingleton.class)
      lib/EjbInterfacesForClient.jar (contains remote interfaces of EJBs required by the web component)


      <!-- Here is the application.xml file -->

      <display-name>Service Application</display-name>



      <web-uri>WebModule.war</web-uri>
      <context-root>/WeModule</context-root>




      AllServiceBeans.jar



      FindingServiceBeans.jar




      <!-- Here is the ejb-jar.xml file in the AllServiceBeans.jar file -->
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC
      "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
      "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <ejb-jar>
      <display-name>Service Application</display-name>
      <enterprise-beans>

      <display-name>Hand Service Session Bean</display-name>
      <ejb-name>HandService</ejb-name>
      com.xxx.HandServiceHome
      com.xxx.HandService
      <ejb-class>com.xxx.HandServiceBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      </enterprise-beans>
      </ejb-jar>


      <!-- Here is the jboss.xml file in the AllServiceBeans.jar file -->
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC
      "-//JBoss//DTD JBOSS 3.0//EN"
      "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">

      <enterprise-beans>

      <ejb-name>HandService</ejb-name>
      <jndi-name>HandServiceRemoteJNDI</jndi-name>

      </enterprise-beans>



      <!-- Here is the ejb-jar.xml file in the FindingServiceBeans.jar file -->
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC
      "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
      "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <ejb-jar>
      <display-name>Service Application</display-name>
      <enterprise-beans>

      <display-name>Get Service Information Session Bean</display-name>
      <ejb-name>GetServiceInfo</ejb-name>
      <local-home>com.xxx.GetServiceInfoLocalHome</local-home>
      com.xxx.GetServiceInfoLocal
      <ejb-class>com.xxx.GetServiceInfoLocalBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>



      <display-name>Find Services Session Bean</display-name>
      <ejb-name>FindService</ejb-name>
      com.xxx.FindServiceHome
      com.xxx.FindService
      <ejb-class>com.xxx.FindServiceBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      <ejb-local-ref>
      <ejb-ref-name>ejb/refToGetServiceInfo</ejb-ref-name>
      <ejb-local-type>Stateless</ejb-local-type>
      <local-home>com.xxx.GetServiceInfoLocalHome</local-home>
      com.xxx.GetServiceInfoLocal
      <ejb-link>GetServiceInfo</ejb-link>
      </ejb-local-ref>

      <ejb-ref>
      <ejb-ref-name>ejb/refToHandService</ejb-ref-name>
      <ejb-type>Stateless</ejb-local-type>
      com.xxx.HandServiceHome
      com.xxx.HandService
      <ejb-link>HandService</ejb-link>
      </ejb-ref>

      </enterprise-beans>
      </ejb-jar>


      <!-- Here is the jboss.xml file in the FindingServiceBeans.jar file -->
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC
      "-//JBoss//DTD JBOSS 3.0//EN"
      "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">

      <enterprise-beans>

      <ejb-name>GetServiceInfo</ejb-name>
      <local-jndi-name>GetServiceInfoLocalJNDI</jndi-name>



      <ejb-name>FindService</ejb-name>
      <jndi-name>FindServiceRemoteJNDI</jndi-name>

      <ejb-local-ref>
      <ejb-ref-name>ejb/refToGetServiceInfo</ejb-ref-name>
      <local-jndi-name>GetServiceInfoLocalJNDI</jndi-name>
      </ejb-local-ref>

      <ejb-ref>
      <ejb-ref-name>ejb/refToHandService</ejb-ref-name>
      <jndi-name>HandServiceRemoteJNDI</jndi-name>
      </ejb-ref>

      </enterprise-beans>



      <!-- Here is the WEB-INF/web.xml file in the WebModule.war file -->
      <?xml version="1.0"?>
      <!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>

      The standard web descriptor


      <servlet-name>ProcessResultServlet</servlet-name>
      <servlet-class>com.xxx.web.servlet.ProcessResultServlet</servlet-class>


      <servlet-mapping>
      <servlet-name>ProcessResultServlet</servlet-name>
      <url-pattern>/ProcessResult</url-pattern>
      </servlet-mapping>

      <ejb-ref>
      <ejb-ref-name>ejb/refToFindService</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.xxx.FindServiceHome
      com.xxx.FindService
      </ejb-ref>
      </web-app>


      <!-- Here is the WEB-INF/jboss-web.xml file in the WebModule.war file -->
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-web
      PUBLIC "-//JBoss//DTD Web Application 2.3//EN"
      "http://www.jboss.org/j2ee/dtds/jboss-web_3_0.dtd">

      <jboss-web>
      <ejb-ref>
      <ejb-ref-name>ejb/refToFindService</ejb-ref-name>
      <jndi-name>FindServiceRemoteJNDI</jndi-name>
      </ejb-ref>
      </jboss-web>


      <!-- Here is the MANIFEST.MF in the WebModule.war file -->
      Manifest-Version: 1.0
      Created-By: Apache Ant 1.5
      Built-By: wlwa
      Class-Path: ./lib/EjbInterfacesForClient.jar ./lib/EjbInterfacesForClient.jar