0 Replies Latest reply on Jul 31, 2002 4:10 AM by sihet

    it is easy for you

    sihet Newbie

      ¢ñ.configure jdk1.3.1+jboss3.0.0+tomcat4.0.3+soap2.2+w2k
      1. download jboss3.0.0
      2. download jdk1.3.1
      3. download tomcat4.0.3 // instead of jboss3.0.0 embedded tomcat4.0.3
      4. download apache soap2.2
      5. download xerces.jar //Ö§³Ösoap2.2
      6. setup jdk1.3.1 to %jdk_root%
      7. setup jboss3.0.0 to %jboss_root%
      8. setup soap2.2 to %soap_root%
      9. setup tomcat4.0.3 to %Catalina_root% %jboss_root%\Catalina\
      //if not ,you need modify %Catalina_root%\server\default\deploy\tomcat4-service.xml
      10. set java_home=%jdk_root%
      11. set catalina_home=%Catalina_root%
      12. set jboss_home=%jboss_root%
      13. set path=%jdk%\bin
      14. set classpath=
      %jdk%\lib\tools.jar;
      %jdk%\lib\dt.jar;
      %catalina%\common\lib\servlet.jar;
      %catalina%\common\lib\mail.jar;
      %catalina%\common\lib\activation.jar;
      %xerces%\xerces.jar
      %soap%\lib\soap.jar
      %jboss%\server\default\lib\jboss.jar
      ¢ò.startup jboss&tomcat
      %jboss%\bin\run.bat
      ¢ó.test tomcat running
      jar %catalina%\webapps\root root.war£¬and copy to %jboss%\server\default\deploy\
      http://localhost:8080/root/index.html
      it is ok, test passed.
      In fact,the third deploy a web application to jboss
      ¢ô.program a session ejb,a jsp with call ejb,and deploy them to jboss
      romote interface:First
      package com.stardeveloper.ejb.session;
      import javax.ejb.EJBObject;
      import java.rmi.RemoteException;
      public interface First extends EJBObject {
      public String getTime() throws RemoteException;
      }
      home interface:FirstHome
      package com.stardeveloper.ejb.session;
      import javax.ejb.EJBHome;
      import javax.ejb.CreateException;
      import java.rmi.RemoteException;
      public interface FirstHome extends EJBHome {
      public First create() throws CreateException, RemoteException;
      }
      bean: FirstEJB
      package com.stardeveloper.ejb.session;
      import javax.ejb.SessionBean;
      import javax.ejb.EJBException;
      import javax.ejb.SessionContext;
      import java.rmi.RemoteException;
      import java.util.Date;
      public class FirstEJB implements SessionBean {
      public String getTime() {
      return "Time is : " + new Date().toString();
      }
      public void ejbCreate() {}
      public void ejbPassivate() {}
      public void ejbActivate() {}
      public void ejbRemove() {}
      public void setSessionContext(SessionContext context) {}
      }
      ejb-jar.xml:
      <?xml version="1.0"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
      <ejb-jar>

      <enterprise-beans>

      <display-name>FirstEJB</display-name>
      <ejb-name>First</ejb-name>
      com.stardeveloper.ejb.session.FirstHome
      com.stardeveloper.ejb.session.First
      <ejb-class>com.stardeveloper.ejb.session.FirstEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>First</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Supports</trans-attribute>
      </container-transaction>

      <security-role>
      Users
      <role-name>users</role-name>
      </security-role>
      </assembly-descriptor>
      </ejb-jar>

      jboss.xml
      <?xml version='1.0' encoding='UTF-8' ?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN"
      "http://www.jboss.org/j2ee/dtd/jboss.dtd">

      <enterprise-beans>

      <ejb-name>First</ejb-name>
      <jndi-name>ejb/First</jndi-name>

      </enterprise-beans>



      tree:
      com\ stardeveloper\ejb\session\FirstHome.class
      com\ stardeveloper\ejb\session\First.class
      com\ stardeveloper\ejb\session\FirstEJB.class
      META-INT\ejb-jar.xml
      META-INF\jboss.xml

      Jar cvfM FirstEJB.jar com META-INF
      Copy FirstEJB.jar to %jboss%\server\default\deploy\

      FirstEJB.jsp:
      <%@ page import="javax.naming.InitialContext,
      javax.naming.Context,
      java.util.Properties,
      com.stardeveloper.ejb.session.First,
      com.stardeveloper.ejb.session.FirstHome"%>
      <%
      long t1 = System.currentTimeMillis();
      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "localhost:1099");

      Context ctx = new InitialContext(props);
      FirstHome home = (FirstHome)ctx.lookup("ejb/First");
      First bean = home.create();
      String time = bean.getTime();
      bean.remove();
      ctx.close();
      long t2 = System.currentTimeMillis();
      %>


      p { font-family:Verdana;font-size:12px; }


      Message received from bean = "<%= time %>".Time taken :
      <%= (t2 - t1) %> ms.



      tree:
      test\web-inf\classes
      test\web-inf\lib
      test\web-inf\web.xml
      test\FirstEJB.jsp

      copy %jboss%\client\*.jar to test\web-inf\lib

      jar cvfM test.war web-inf FirstEJB.jsp
      copy test.war to %jboss%\server\default\deploy\


      http://localhot:8080/test/FirstEJB.jsp
      it is ok

      jboss connect tomcat4.1.3 is fail,anybody tell me why