⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch14.html

📁 详细介绍了jboss3.0的配置等
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Chapter 14. Third Party Examples</title><link rel="stylesheet" href="styles.css" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/styles.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets Vimages/callouts/"><link rel="home" href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html" title="JBoss 3.0 Documentation"><link rel="up" href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html" title="JBoss 3.0 Documentation"><link rel="previous" href="ch13s144.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s144.html" title="Clustering in JBoss 3.0 alpha"><link rel="next" href="ch14s02.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch14s02.html" title="Deploying the Pet Store 1.1.2 Demo in JBoss"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table border="0" cellpadding="0" cellspacing="0" height="65"><tr height="65"><td rowspan="2"><img src="jboss.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/jboss.gif" border="0"></td><td rowspan="2" background="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="100%" align="right" valign="top"><a href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html"><img src="doc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/doc.gif" border="0"></a><a href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch13s144.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s144.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch14s02.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch14s02.html"><img src="next.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/next.gif" border="0"></a></td></tr><tr></tr></table><div class="chapter"><div class="titlepage"><div><h2 class="title"><a name="d0e12085"></a>Chapter 14. Third Party Examples</h2></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="ch14.html#d0e12088" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch14.html#d0e12088">Running the Examples from Enterprise JavaBeans, by Richard Monson-Haefel (Unix) </a></dt><dt><a href="ch14s02.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch14s02.html">Deploying the Pet Store 1.1.2 Demo in JBoss</a></dt><dt><a href="ch14s07.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch14s07.html">Deploying Cocoon 2 in JBoss</a></dt><dt><a href="ch14s12.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch14s12.html">Using SSL with JBoss</a></dt></dl></div><div class="section"><a name="d0e12088"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="d0e12088"></a>Running the Examples from Enterprise JavaBeans, by Richard Monson-Haefel (Unix) </h2></div></div><p>Author:<span class="author">Sebastien Alborini</span>
		<tt>&lt;<a href="mailto:sebastien.alborini@m4x.org">sebastien.alborini@m4x.org</a>&gt;</tt>  
	</p><p>This page describes how to run the examples from Richard Monson-Haefel's book Enterprise JavaBeans, 2nd Edition
(Chapter 4) in JBoss.</p><p>You can download <a href="javascript:if(confirm('http://www.oreilly.com/catalog/entjbeans2/chapter/examples.zip  \n\nThis file was not retrieved by Teleport Pro, because it did not meet the project\'s file type specifications.  \n\nDo you want to open it from the server?'))window.location='http://www.oreilly.com/catalog/entjbeans2/chapter/examples.zip'" tppabs="http://www.oreilly.com/catalog/entjbeans2/chapter/examples.zip" target="_top">the examples</a> (zip file) from O'Reilly's site. I will assume you have unzipped this file and you work in
the chapter4/EJB11 directory.</p><p>These examples need to be slightly modified to run with JBoss. You can download the modified version <a href="javascript:if(confirm('http://www.jboss.org/documentation/rmh_jboss.zip  \n\nThis file was not retrieved by Teleport Pro, because it did not meet the project\'s file type specifications.  \n\nDo you want to open it from the server?'))window.location='http://www.jboss.org/documentation/rmh_jboss.zip'" tppabs="http://www.jboss.org/documentation/rmh_jboss.zip" target="_top">here</a>, but I
recommend you to follow these instructions which tell exactly what has to be modified.</p><div class="itemizedlist"><ul><li><p><a name="d0e12115"></a>Setup your environment.</p><p>JBoss libraries will be needed to compile and run the examples, so you have to set the environment variable
     JBOSS_HOME to your JBoss installation. For example: 
	 <div class="itemizedlist"><ul><li><p><a name="d0e12121"></a>export JBOSS_HOME=$HOME/jboss_pr4 if you have the binary version in your home directory </p></li><li><p><a name="d0e12124"></a>export JBOSS_HOME=$HOME/jboss/dist if you have the CVS version.</p></li></ul></div> 
      
			</p></li><li><p><a name="d0e12128"></a>Compile and deploy the beans.</p><p>The beans are almost ok for JBoss, the only difference is about the reference made by TravelAgentBean to
     CabinBean: a bean must lookup in the java:comp/env namespace. Edit
     com/titan/travelagent/TravelAgentBean.java, and replace 
     <pre class="programlisting">     Object obj = jndiContext.lookup("ejb/CabinHome");</pre>    
     with 
     <pre class="programlisting">     Object obj = jndiContext.lookup("java:comp/env/ejb/CabinHome"); </pre>     
			</p><p>     This ejb-reference from TravelAgentBean (in travelagent.jar) to CabinBean (in cabin.jar) is an external
     reference (different ejb-jar file). You must then provide the full jndi name for CabinBean in a jboss.xml for
     TravelAgentBean: create and edit com/titan/travelagent/jboss.xml 

     <pre class="programlisting">
     &lt;?xml version="1.0"?&gt;                                                 
     &lt;jboss&gt;
       &lt;enterprise-beans&gt;
         &lt;session&gt;
           &lt;ejb-name&gt;TravelAgentBean&lt;/ejb-name&gt;
           &lt;ejb-ref&gt;
             &lt;ejb-ref-name&gt;ejb/CabinHome&lt;/ejb-ref-name&gt;
             &lt;jndi-name&gt;CabinBean&lt;/jndi-name&gt;
           &lt;/ejb-ref&gt;
         &lt;/session&gt;
       &lt;/enterprise-beans&gt;
     &lt;/jboss&gt;
     </pre>     
			</p><p> 
     You don't jave to change anything in ejb-jar.xml. You can now use the following script jbossMakeIt.sh to
     compile and deploy: 
      
     <div class="literallayout">&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
					<b><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#!/bin/sh&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;make&nbsp;cabin&nbsp;bean<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;javac&nbsp;-classpath&nbsp;$JBOSS_HOME/lib/ext/ejb.jar:.&nbsp;\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;com/titan/cabin/Cabin*.java<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cp&nbsp;com/titan/cabin/ejb-jar.xml&nbsp;META-INF/ejb-jar.xml<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jar&nbsp;cvf&nbsp;cabin.jar&nbsp;com/titan/cabin/Cabin*.class&nbsp;META-INF/ejb-jar.xml<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;make&nbsp;travelagent&nbsp;bean<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;javac&nbsp;-classpath&nbsp;$JBOSS_HOME/lib/ext/ejb.jar:.&nbsp;\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;com/titan/travelagent/TravelAgent*.java<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cp&nbsp;com/titan/travelagent/ejb-jar.xml&nbsp;\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;com/titan/travelagent/jboss.xml&nbsp;\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;META-INF/<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;JBoss&nbsp;needs&nbsp;the&nbsp;Home,&nbsp;Remote&nbsp;and&nbsp;primary&nbsp;key&nbsp;(PK)&nbsp;classes<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;of&nbsp;the&nbsp;Cabin&nbsp;in&nbsp;travelagent.jar&nbsp;so&nbsp;that&nbsp;TravelAgent*.class<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;can&nbsp;access&nbsp;the&nbsp;Cabin&nbsp;bean<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jar&nbsp;cvf&nbsp;travelagent.jar&nbsp;\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;com/titan/cabin/CabinHome.class&nbsp;\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;com/titan/cabin/Cabin.class&nbsp;\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;com/titan/cabin/CabinPK.class&nbsp;\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;com/titan/travelagent/TravelAgent*.class&nbsp;\<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;META-INF/ejb-jar.xml&nbsp;META-INF/jboss.xml<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rm&nbsp;-f&nbsp;META-INF/ejb-jar.xml<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rm&nbsp;-f&nbsp;META-INF/jboss.xml<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;deploy<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cp&nbsp;cabin.jar&nbsp;travelagent.jar&nbsp;$JBOSS_HOME/deploy<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b><br>
				</div>  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -