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

📄 ch01s14.html

📁 详细介绍了jboss3.0的配置等
💻 HTML
字号:
<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Packaging and deploying the bean</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="ch01.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01.html" title="Chapter 1. First steps"><link rel="previous" href="ch01s12.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01s12.html" title="The deployment descriptor"><link rel="next" href="ch01s15.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01s15.html" title="Coding and compiling the test client"></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="ch01.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch01s12.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01s12.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch01s15.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01s15.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="section"><a name="d0e338"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="d0e338"></a>Packaging and deploying the bean</h2></div></div><p>Creation of the EJB jar package involves building a JAR archive containing 
the EJB classes and deployment descriptors. To build the EJB jar for the
Interest example simply cd to the examples/build directory of the documentation examples
source tree and execute the following ant command:</p><div class="literallayout"><br>
			<tt>bash-2.04$&nbsp;ant&nbsp;intro-interest-jar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
Buildfile:&nbsp;build.xml<br>
<br>
validate:<br>
<br>
fail_if_not_valid:<br>
<br>
init:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[echo]&nbsp;Using&nbsp;JBoss&nbsp;directory=/tmp/JBoss-2.2.2<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[echo]&nbsp;Using&nbsp;classpath=/tmp/JBoss-2.2.2/client/ejb.jar:/tmp/JBoss-2.2.2/client/jaas.jar:/tmp/JBoss-2.2.2/client/jbosssx-client.jar:/tmp/JBoss-2.2.2/client/jboss-client.jar:/tmp/JBoss-2.2.2/client/jnp-client.jar:/tmp/tomcat/lib/servlet.jar:/tmp/examples/${build.classes.dir}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[echo]&nbsp;Using&nbsp;Source&nbsp;directory=/tmp/examples<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[echo]&nbsp;Using&nbsp;Build&nbsp;directory=/tmp/examples/build-examples<br>
<br>
intro-interest-jar:<br>
<br>
compile:<br>
&nbsp;&nbsp;&nbsp;&nbsp;[javac]&nbsp;Compiling&nbsp;4&nbsp;source&nbsp;files&nbsp;to&nbsp;/tmp/examples/build-examples/interest/classes<br>
<br>
ejb-jar:<br>
&nbsp;&nbsp;&nbsp;&nbsp;[mkdir]&nbsp;Created&nbsp;dir:&nbsp;/tmp/examples/build-examples/interest/META-INF<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[copy]&nbsp;Copying&nbsp;1&nbsp;file&nbsp;to&nbsp;/tmp/examples/build-examples/interest/META-INF<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[copy]&nbsp;Copying&nbsp;1&nbsp;file&nbsp;to&nbsp;/tmp/examples/build-examples/interest/META-INF<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[jar]&nbsp;Building&nbsp;jar:&nbsp;/tmp/examples/build-examples/interest/interest.jar<br>
<br>
BUILD&nbsp;SUCCESSFUL<br>
<br>
Total&nbsp;time:&nbsp;2&nbsp;seconds</tt><br>
		</div><p>This has compiled the EJB classes and created the ejb-jar for deployment. 
If got a java.lang.NoClassDefFoundError here instead of a successful created jar file try clearing your classpath.
The contents of the
interest.jar include the structure we discussed previously as shown by running the jar -tvf
command:</p><div class="literallayout"><br>
			<tt>bash-2.04$&nbsp;jar&nbsp;-tvf&nbsp;/tmp/examples/build-examples/interest/interest.jar<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;META-INF/<br>
&nbsp;&nbsp;&nbsp;&nbsp;46&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;META-INF/MANIFEST.MF<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;org/<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;org/jboss/<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;org/jboss/docs/<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;org/jboss/docs/interest/<br>
&nbsp;&nbsp;&nbsp;246&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;org/jboss/docs/interest/Interest.class<br>
&nbsp;&nbsp;1177&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;org/jboss/docs/interest/InterestBean.class<br>
&nbsp;&nbsp;&nbsp;296&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;org/jboss/docs/interest/InterestHome.class<br>
&nbsp;&nbsp;&nbsp;599&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;META-INF/ejb-jar.xml<br>
&nbsp;&nbsp;&nbsp;220&nbsp;Sun&nbsp;Jun&nbsp;24&nbsp;22:55:52&nbsp;PDT&nbsp;2001&nbsp;META-INF/jboss.xml</tt><br>
		</div><p>To deploy the Bean on the server, all that's necessary is to copy the 
interest.jar file to the JBOSS_DIST/deploy directory of your JBoss installation.
You can do this as often as you like. The server will detect that the 
file has changed and automatically re-deploy it. With the JBoss server running, deploy
the jar by running <b>ant intro-interest-deploy</b> from the examples/build
directory. During deployment you should see messages similar to the following on the server console:</p><div class="literallayout"><br>
			<tt>[Auto&nbsp;deploy]&nbsp;Auto&nbsp;deploy&nbsp;of&nbsp;file:/tmp/JBoss-2.2.2/deploy/interest.jar<br>
[J2EE&nbsp;Deployer&nbsp;Default]&nbsp;Deploy&nbsp;J2EE&nbsp;application:&nbsp;file:/tmp/JBoss-2.2.2/deploy/interest.jar<br>
[J2EE&nbsp;Deployer&nbsp;Default]&nbsp;Create&nbsp;application&nbsp;interest.jar<br>
[J2EE&nbsp;Deployer&nbsp;Default]&nbsp;install&nbsp;module&nbsp;interest.jar<br>
[Container&nbsp;factory]&nbsp;Deploying:file:/tmp/JBoss-2.2.2/tmp/deploy/Default/interest.jar<br>
[Verifier]&nbsp;Verifying&nbsp;file:/tmp/JBoss-2.2.2/tmp/deploy/Default/interest.jar/ejb1001.jar<br>
[Container&nbsp;factory]&nbsp;Deploying&nbsp;Interest<br>
[Container&nbsp;factory]&nbsp;Deployed&nbsp;application:&nbsp;file:/tmp/JBoss-2.2.2/tmp/deploy/Default/interest.jar<br>
[J2EE&nbsp;Deployer&nbsp;Default]&nbsp;J2EE&nbsp;application:&nbsp;file:/tmp/JBoss-2.2.2/deploy/interest.jar&nbsp;is&nbsp;deployed.</tt><br>
		</div><p>If you see a message like this: </p><div class="literallayout"><br>
			<tt>[Auto&nbsp;deploy]&nbsp;Auto&nbsp;deploy&nbsp;of&nbsp;file:/tmp/JBoss-2.2.2/deploy/interest.jar<br>
[J2EE&nbsp;Deployer&nbsp;Default]&nbsp;Deploy&nbsp;J2EE&nbsp;application:&nbsp;file:/tmp/JBoss-2.2.2/deploy/interest.jar&nbsp;<br>
...<br>
[Auto&nbsp;deploy]&nbsp;Deployment&nbsp;failed:file:/tmp/JBoss-2.2.2/deploy/interest.jar</tt><br>
		</div><p>then no EJBs have been deployed -- the server always reports the EJBs
that it detects. This usually means that the deployment descriptor ejb-jar.xml 
is badly structured, or missing, or in the wrong directory. </p><p>You should now have the Interest EJB deployed on the server. We will now go over a
simple test client that runs one of its methods, just to verify that it's working.</p></div><table border="0" cellpadding="0" cellspacing="0" height="65"><tr height="65"><td rowspan="2"><img src="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="432" height="79"></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="ch01.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch01s12.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01s12.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch01s15.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch01s15.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></body></html>

⌨️ 快捷键说明

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