Using JBossIDE + XDoclet with both JBoss4.0.0 and WebSphere AS 6.0

来源:互联网 发布:mac双系统安装win10 编辑:程序博客网 时间:2024/06/14 07:36

Prepare:

  1. Download the latest version of JBossIDE ( JBossIDE-1.5M2-Bundle-win32.zip is recommended)

  2. Download the latest version of XDoclet , extract to a folder and copy *.* to eclipse/plugins/org.jboss.ide.eclipse.xdoclet.core_1.5.0.M2/, or extract to eclipse/plugins/org.jboss.ide.eclipse.xdoclet.core_1.5.0.M2/ directly.

  3. Download and install JBoss4.0.0(the default configuration of 4.0.0 is J2EE1.4 compliant, and the default configurations of 4.0.1 and above are not fully J2EE1.4 compliant)

  4. install WebSphere Application Server 6.0

Development:

  1. Create a new J2EE 1.4 Project, a stateless session bean with local interface, a servlet which would lookup the ejb and invoke some methods.

  2. Config XDoclet properties to add extra support for WebSphere.(the support for JBoss is provided by default)

  3. Add XDoclet annotation "@ejb.util generate="physical"" to the ejb class

  4. Run XDoclet, then you will get source files for ejb home and deployment descriptors for both JBoss and WebSphere.

  5. Modify "SomeEjbLocalHome.JNDI_NAME" from "xxx" to "local:xxx", this is a workground for WebSphere

  6. Modify jndi references in all descriptors from "xxx" to "local:xxx".

  7. Create "application.xml" in META-INF manually, fill its content just like below:

  <?xml version="1.0" encoding="UTF-8" ?>

  <!DOCTYPE application (View Source for full doctype...)>

- <application>

  <display-name>Both</display-name>

- <module>

  <ejb>yourejb.jar</ejb>

  </module>

- <module>

- <web>

  <web-uri>yourweb.war</web-uri>

  <context-root>/yourroot</context-root>

  </web>

  </module>

  </application>

  1. Config "Packaging Configurations" of project, add descriptors for WebSphere to standard war and standard jar.(once again, the descriptors for JBoss are included in standard war&jar by default)

  2. Run "Packaging", then you will got yourejb.jar and youweb.war

  3. Config "Packaging Configurations" of project, create the app.ear which include yourejb.jar and youweb.war and application.xml

  4. Run "Packaging" again to create app.ear

Deployment:

  1. you can use JBossIDE deploy app.ear to JBoss directly

  2. or you can use any other methods such as Web Administration Console to deploy our application to WebSphere and JBoss


 
原创粉丝点击