使用Eclipse开发J2EE应用
2009-12-21 00:00:00 来源:WEB开发网通过File->New->Lomboz EJB Test Client Wizard打开一个对话框,按下图填写:
完成以后,在src目录下面生成了TestMyEJB.java,在其中的testBean方法中加入测试代码:
System.out.println(myBean.helloWorld());
如果目前JBoss服务器已经启动,而且MyEJB模块已经部署的话,执行TestMyEJB,就会在Console窗口上显示出:
hehe, I can deploy EJB by Eclipse!
四、总结
通过以上的介绍,我们了解到,Lomboz使Eclipse开发J2EE应用变得非常简便,而且Eclipse, Lomboz, JBoss这些工具都是免费和开放源码的项目,所以这样的组合对Java开发者来说更有吸引力。
对于开发复杂的J2EE应用来说,上面的介绍可能还不够全面,希望大家在做项目的过程中体会,再将总结出来的经验放到developerWorks上来分享。
附录:JBoss320.server
<serverDefinition name="JBOSS 3.2"
ejbModules="true" webModules="true" earModules="true">
<property id="serverRootDirectory" label="Application Server Directory:"
type="directory" default="D:/jboss-3.2.0" />
<property id="serverAddress" label="Address:"
type="string" default="127.0.0.1" />
<property id="serverPort" label="Port:"
type="string" default="8080" />
<property id="classPathVariableName" label="Classpath Variable Name:"
type="string" default="JBOSS32" />
<property id="classPath" label="Classpath Variable:"
type="directory" default="D:/jboss-3.2.0" />
<serverHome>${serverRootDirectory}</serverHome>
<webModulesDeployDirectory>${serverRootDirectory}/server/all/deploy</webModulesDeployDirectory>
<ejbModulesDeployDirectory>${serverRootDirectory}/server/all/deploy</ejbModulesDeployDirectory>
<earModulesDeployDirectory>${serverRootDirectory}/server/all/deploy</earModulesDeployDirectory>
<jndiInitialContextFactory>org.jnp.interfaces.NamingContextFactory</jndiInitialContextFactory>
<jndiProviderUrl>jnp://${serverAddress}:1099</jndiProviderUrl>
<startClass>org.jboss.Main</startClass>
<startWorkingDirectory>${serverRootDirectory}/bin</startWorkingDirectory>
<startVmParameters></startVmParameters>
<startProgramArguments>-c all</startProgramArguments>
<stopClass>org.jboss.Shutdown</stopClass>
<stopWorkingDirectory>${serverRootDirectory}/bin</stopWorkingDirectory>
<stopVmParameters></stopVmParameters>
<stopProgramArguments>${serverAddress} ${serverPort}</stopProgramArguments>
<serverClassPath>
<jar type="variable">JDK_TOOLS</jar>
<jar type="variable">${classPathVariableName}/bin/run.jar</jar>
<jar type="variable">${classPathVariableName}/bin/shutdown.jar</jar>
<jar type="variable">${classPathVariableName}/client/jboss-j2ee.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/javax.servlet.jar</jar>
<jar type="variable">${classPathVariableName}/lib/commons-httpclient.jar</jar>
<jar type="variable">${classPathVariableName}/lib/concurrent.jar</jar>
<jar type="variable">${classPathVariableName}/lib/getopt.jar</jar>
<jar type="variable">${classPathVariableName}/lib/jboss-boot.jar</jar>
<jar type="variable">${classPathVariableName}/lib/jboss-common.jar</jar>
<jar type="variable">${classPathVariableName}/lib/jboss-jmx.jar</jar>
<jar type="variable">${classPathVariableName}/lib/jboss-system.jar</jar>
<jar type="variable">${classPathVariableName}/lib/jdom.jar</jar>
<jar type="variable">${classPathVariableName}/lib/log4j-boot.jar</jar>
<jar type="variable">${classPathVariableName}/lib/webdavlib.jar</jar>
<jar type="variable">${classPathVariableName}/lib/xercesImpl.jar</jar>
<jar type="variable">${classPathVariableName}/lib/xml-apis.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jnet.jar</jar>
<jar type="variable">${classPathVariableName}/lib/gnu-regexp.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jboss.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jnpserver.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jpl-util.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jpl-pattern.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jsse.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jbossha.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jboss-jaas.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jts.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jboss-transaction.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/javagroups-2.0.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jmxri.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jmxtools.jar</jar>
<jar type="variable">${classPathVariableName}/server/all/lib/jbossmx.jar</jar>
</serverClassPath>
<clientClassPath>
<jar type="variable">${classPathVariableName}/client/jboss-j2ee.jar</jar>
<jar type="variable">${classPathVariableName}/client/jnp-client.jar</jar>
<jar type="variable">${classPathVariableName}/client/jboss-client.jar</jar>
<jar type="variable">${classPathVariableName}/client/jboss-common-client.jar</jar>
<jar type="variable">${classPathVariableName}/client/jbosssx-client.jar</jar>
<jar type="variable">${classPathVariableName}/client/log4j.jar</jar>
<jar type="variable">${classPathVariableName}/client/jnet.jar</jar>
<jar type="variable">${classPathVariableName}/client/jaas.jar</jar>
</clientClassPath>
</serverDefinition>
更多精彩
赞助商链接