📄 ch10s10.html
字号:
tmp
</pre></li><li><p><a name="d0e6927"></a>Change the references to configuration files in the source code:</p><div class="itemizedlist"><ul><li><p><a name="d0e6931"></a>
<span class="emphasis"><i> jboss.conf:</i></span>
</p><p> In org.jboss.Main.Main() add conf/default in line:</p><p> URL mletConf = mlet.getResource("conf/default/jboss.conf") </p></li><li><p><a name="d0e6941"></a>
<span class="emphasis"><i>jboss.jcml:</i></span>
</p><p>In org.jboss.configuration.ConfigurationService.loadConfiguration() add conf/default in line:</p><p>InputStream conf = Thread.currentThread().getContextClassLoader().getResourceAsStream "conf/default/jboss.jcml");</p><p>In org.jboss.configuration.ConfigurationService.loadConfiguration() add conf/default in line:</p><p>conf = Thread.currentThread().getContextClassLoader().getResourceAsStream("conf/default/jboss.jcml");</p></li><li><p><a name="d0e6955"></a>
<span class="emphasis"><i>jndi.properties</i></span>
</p><p>org.jboss.naming.NamingService.initService() add conf/default in line:</p><p>System.getProperties().load(Thread.currentThread().getContextClassLoader().getResourceAsStream("conf/default/jndi.properties"));</p><p>org.jboss.Main.Main() add conf/default in line:</p><p>URL jndiLocation = this.getClass().getResource("conf/default/jndi.properties");</p></li><li><p><a name="d0e6969"></a>
<span class="emphasis"><i>tmp.properties</i></span>
</p><p>org.jboss.deployment.J2eeDeployer.initService() add /tmp in line:</p><p>URL tmpDirUrl = getClass().getResource("/tmp/tmp.properties");</p><p>org.jboss.resource.RARDeployer.initService() add /tmp in line:</p><p>URL tmpPropURL = getClass().getResource("/tmp/tmp.properties");</p></li><li><p><a name="d0e6983"></a>
<span class="emphasis"><i>db.properties</i></span>
</p><p>org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.init() add db/ in line:</p><p>File databaseDir = new File(getClass().getResource("db/db.properties").getFile()).getParentFile();</p><p>org.jboss.jdbc.HypersonicDatabase.startService() add /db/ in line:</p><p>URL dbLocator = getClass().getResource("/db/db.properties");</p></li><li><p><a name="d0e6997"></a>
<span class="emphasis"><i> standardjaws.xml</i></span>
</p><p>org.jboss.ejb.plugins.jaws.metadata.JawsXmlFileLoader.load() add conf/default in line:</p><p>URL stdJawsUrl = classLoader.getResource("conf/default/standardjaws.xml");</p></li><li><p><a name="d0e7007"></a>
<span class="emphasis"><i>standardjboss.xml</i></span>
</p><p>org.jboss.metadata.XmlFileLoader.load() add conf/default in line:</p><p>URL defaultJbossUrl = Thread.currentThread().getContextClassLoader().getResource("conf/default/standardjboss.xml");</p></li><li><p><a name="d0e7017"></a>
<span class="emphasis"><i>jnp.properties</i></span>
</p><p>org.jnp.server.Main.Main() add conf/default in line:</p><p>System.getProperties().load(getClass().getClassLoader().getResourceAsStream("conf/default/jnp.properties"));</p></li><li><p><a name="d0e7027"></a>
<span class="emphasis"><i>log.properties</i></span>
</p><p>org.jboss.logging.FileLogging.openLogFile() add /log in line:</p><p>URL properties = getClass().getResource("/log/log.properties");</p></li><li><p><a name="d0e7037"></a>
<span class="emphasis"><i>jboss-auto.jcml</i></span>
</p><p>org.jboss.configuration.ConfigurationService.loadConfiguration() add conf/default in line:</p><p>conf = Thread.currentThread().getContextClassLoader().getResourceAsStream("conf/default/jboss-auto.jcml");</p><p>org.jboss.configuration.ConfigurationService.saveConfiguration() add conf/default in line:</p><p>URL confFile = Thread.currentThread().getContextClassLoader().getResource("conf/default/jboss-auto.jcml");</p></li><li><p><a name="d0e7051"></a>
<span class="emphasis"><i>mail.properties</i></span>
</p><p>org.jboss.mail.MailService.startService() add conf/default in line:</p><p>if (properties == null) {properties = "conf/default/mail.properties";}</p><p>in jboss.jcml (in VAJ's <vaj.home>/ide/project_resources/jboss/conf/default directory) add conf/default in mail.properties line:</p><p>
<attribute name="ConfigurationFile">conf/default/mail.properties</attribute>
</p></li><li><p><a name="d0e7065"></a>
<span class="emphasis"><i>jbossmq.properties</i></span>
</p><p>org.jbossmq.Log.getLevel() add conf/default in line:</p><p>InputStream in = Thread.currentThread().getContextClassLoader().getResource("conf/default/jbossmq.properties").openStream();</p></li><li><p><a name="d0e7075"></a>
<span class="emphasis"><i>jbossmq.xml</i></span>
</p><p>org.jbossmq.server.JMSServer.saveConfig() add conf/default in line:</p><p>String file = getClass().getClassLoader().getResource("conf/default/jbossmq.xml").getFile();</p><p>org.jbossmq.server.StartServer.run() add conf/default in line:</p><p>InputStream in = getClass().getClassLoader().getResource("conf/default/jbossmq.xml").openStream();</p><p>org.jbossmq.persistence.PersistenceManager.PersistenceManager() add conf/default in line:</p><p>URL configFile = getClass().getClassLoader().getResource("conf/default/jbossmq.xml");</p></li></ul></div></li><li><p><a name="d0e7093"></a>Properties to change in <tt>org.jboss.Main</tt> (right click on class and
bring up Properties dialog) (NOTE -- please adjust the path to point to your Visual Age install
directory):</p><div class="orderedlist"><ol type="a"><li><p><a name="d0e7100"></a>Program tab:</p><p>1. Command line argument:</p><p>conf/default</p><p>2. Properties: (as listed)</p><p>jboss.home="e:/Program Files/Ibm/VisualAge for Java/ide/project_resources/jboss" Note that this command line should be quoted if there are spaces in the
command line (like Program Files).</p></li><li><p><a name="d0e7111"></a>Classpath tab:</p><p>1. Project Path: Add any other projects that jBoss needs if classes it contains are not in the jBoss project.</p><p>2. Extra Directories Path:</p><div class="orderedlist"><ol type="i"><li><p><a name="d0e7119"></a>Add the following jar files from the <jboss.home>/lib or <jboss.home>/lib/etx directory : lib\ext\dynaserver.jar;lib\ext\ejxjaws.jar;lib\ext\ejxjboss.jar;lib\ext\exolabcore-0.1.jar;lib\ext\gnu-regexp-1.0.8.jar;lib\ext\jboss.jar;lib\ext\jbossmq.jar;lib\ext\jetty-service.jar;lib\ext\jmxtools.jar;lib\ext\jnpserver.jar;lib\ext\tomcat-service.jar;lib\jboss-jaas.jar</p></li><li><p><a name="d0e7122"></a>Add the following directories: "./conf/default;./db;./deploy;./log"</p></li></ol></div></li></ol></div></li><li><p><a name="d0e7125"></a>For <tt>org.jboss.jmx.connector.rmi.RMIConnectorImpl</tt>,
<tt>org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker</tt>,
<tt>org.jbossmq.distributed.server.ConnectionReceiverRMIImpl</tt> and <tt>org.jbossmq.distributed.server.DistributedJMSServerRMIImpl</tt>, manually generate RMI stub/skeleton using VAJ's built-in RMI tool (Right click on the class and select Tools --> Generate RMI/JDK 1.2 --> stubs/skeleton). You might need to temporarily move java.transaction.* into the jboss project for the rmic compiler to function without errors for JRMPContainerInvoker or directly import the RMI stub from the binary jboss.jar (org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.class).
</p></li><li><p><a name="d0e7140"></a>In jboss.conf (in <jboss.home>/conf/default directory): </p><div class="itemizedlist"><ul><li><p><a name="d0e7144"></a>Change all references from ../../ in file to ./ using search and replace</p></li><li><p><a name="d0e7147"></a>Change references from ../xml.jar to ./xml.jar</p></li></ul></div></li><li><p><a name="d0e7150"></a>In jboss.jcml (in <jboss.home>/conf/default directory)
change ../deploy to ./deploy in this tag:</p><pre class="programlisting">
<mbean code="org.jboss.ejb.AutoDeployer" name="EJB:service=AutoDeployer">
<attribute name="Deployer">J2EE:service=J2eeDeployer</attribute>
<attribute name="URLs">./deploy</attribute>
</mbean>
</pre><p>a. Change single reference from ../conf/default/instantdb.properties to ./conf/default/instantdb.properties</p></li><li><p><a name="d0e7157"></a>In instantdb.properties (in <jboss.home>/conf/default directory) change all references from ../../ to ./.</p></li><li><p><a name="d0e7160"></a>In org.jboss.util.Shutdown.preRegister(), comment out this shutdown hook code:
</p><pre class="programlisting">
/* Modified by Craig since addShutdownHook is implemented in JDK 1.3
try
{
Runtime.getRuntime().addShutdownHook(new Thread()
{
public void run()
{
System.out.println("Shutting down");
// Make sure all services are down properly
shutdownServices();
System.out.println("Shutdown complete");
}
});
log.log("Shutdown hook added");
*/
//} catch (Throwable e)
//{
log.error("Could not add shutdown hook");
//}
</pre></li><li><p><a name="d0e7165"></a>Removing InstantDB from VAJ (do this if it freezes VAJ during startup).
</p><p>This can be done by remove all references to InstantDB in the <jboss.home>/conf/default/jboss.jcml file.
</p></li></ol></div></div><div class="section"><a name="running-and-debugging"></a><div class="titlepage"><div><h3 class="title"><a name="running-and-debugging"></a>Running and debugging EJBs inside of Visual Age</h3></div></div><div class="orderedlist"><ol type="1"><li><p><a name="d0e7175"></a>Create META-INF subdirectory in the deploy directory of <jboss.home>.</p><p>a. Add ejb-jar.xml and both jboss.xml and jaws.xml (if needed) to the directory.</p></li><li><p><a name="d0e7180"></a>Run <tt>org.jboss.Main</tt> using VAJ run command to start jBoss.</p></li><li><p><a name="d0e7186"></a>Make sure any projects that contain EJBs that you are developing are in the classpath of <tt>org.jboss.Main</tt>.</p></li><li><p><a name="d0e7192"></a>If running EJBs from servlets/JSPs, make sure that jBoss's project is in Tomcat's
classpath (the <tt>com.ibm.ivj.tomcat.TomcatRunner</tt> class). If you are calling EJBs from a client class with a main() method, make sure the jBoss project is in its
classpath in addition to all jars from the <jboss.home>/client directory.
</p></li><li><p><a name="d0e7198"></a>To debug, set breakpoints inside of EJB bean class.</p></li><li><p><a name="d0e7201"></a>To allow changes to EJBs to take effect in VAJ, either restart jBoss
or touch one of the XML files in the <jboss.home>/deploy/META-INF directory.</p></li></ol></div></div></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="ch10.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch10.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch10.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch10.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch10s14.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch10s14.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 + -