Hello,
I've written a patch
fpr the ejb task to make it support WebSphere 5.1. See
attachments.
Hope this is the
right place to place it.
Regards
Ralf
Ralf Kretzschmar-Auer
Senior Consultant
Software Architecture
Cellent AG
Finance
Solutions
Niederlassung Stuttgart
Calwer Straße 33
70173
Stuttgart
Tel.: ++49 711 222 992 - 812
Mobil: +170 323 5838
Fax:
++49 711 222 992 - 899
[EMAIL PROTECTED]
<http://www.cellent.de/fs>
<http://www.cellent.de/>
--- WebsphereDeploymentTool.java.orig 2004-10-27 11:16:59.444211200 +0200 +++ WebsphereDeploymentTool.java 2004-10-28 15:51:34.000647500 +0200 @@ -33,6 +33,7 @@ import org.apache.tools.ant.types.Environment; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.util.FileUtils; +import org.apache.tools.ant.util.JavaEnvUtils; /** * Websphere deployment tool that augments the ejbjar task. @@ -55,9 +56,10 @@ * is called for every ejb-jar. Unfortunately, this step only works, if you * use the ibm jdk. Otherwise, the rmic (called by ejbdeploy) throws a * ClassFormatError. Be sure to switch ejbdeploy off, if run ant with - * sun jdk. + * sun jdk or to set <code>useWebSphereJdk</code> to <code>true</code> * * @author <a href="mailto:[EMAIL PROTECTED]">Maneesh Sahu</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Ralf Kretzschmar-Auer</a> */ public class WebsphereDeploymentTool extends GenericDeploymentTool { /** @@ -68,7 +70,7 @@ public String[] getValues() { return new String[]{ "SQL92", "SQL99", "DB2UDBWIN_V71", "DB2UDBOS390_V6", "DB2UDBAS400_V4R5", - "ORACLE_V8", "INFORMIX_V92", "SYBASE_V1192", "MSSQLSERVER_V7", "MYSQL_V323" + "ORACLE_V8", "ORACLE_V9I", "INFORMIX_V92", "SYBASE_V1192", "MSSQLSERVER_V7", "MYSQL_V323" }; } } @@ -105,6 +107,9 @@ /** The classpath to the websphere classes. */ private Path wasClasspath = null; + /** The classpath to the websphere extensions. */ + private Path wasExtensionspath = null; + /** The DB Vendor name, the EJB is persisted against */ private String dbVendor; @@ -138,6 +143,12 @@ /** true- Use the WebSphere 3.5 compatible mapping rules */ private boolean use35MappingRules; + /** + * true- Run EJB Deployer using the current JDK instead + * of the WebSphere JDK + */ + private boolean useCurrentJdk = false; + /** the scratchdir for the ejbdeploy operation */ private String tempdir = "_ejbdeploy_temp"; @@ -158,6 +169,20 @@ } + /** Get the path to the websphere extensions */ + public Path createWASExtensionspath() { + if (wasExtensionspath == null) { + wasExtensionspath = new Path(getTask().getProject()); + } + return wasExtensionspath.createPath(); + } + + + public void setWASExtensionpath(Path wasExtensionspath) { + this.wasExtensionspath = wasExtensionspath; + } + + /** Sets the DB Vendor for the Entity Bean mapping ; optional. * Valid options are for example: * <ul> @@ -272,6 +297,16 @@ use35MappingRules = attr; } + /** + * Set using the JDK that is currently running this build, + * instead of the JDK installed with WebSphere 5.1. + * optional, default false, i.e. use the WebSphere 5.1 JDK. + * + * @param attr + */ + public void setUseCurrentJdk(boolean attr) { + useCurrentJdk = attr; + } /** * Set the rebuild flag to false to only update changes in the jar rather @@ -541,10 +576,20 @@ try { if (ejbdeploy) { Java javaTask = (Java) getTask().getProject().createTask("java"); + // Optionally switch over to the JVM being Part of WAS 5.1 + if (!useCurrentJdk) { + String javaCmd = JavaEnvUtils.getJdkExecutable(websphereHome + "/java/bin/java"); + javaTask.setJvm(javaCmd); + } + // Set the JvmArgs javaTask.createJvmarg().setValue("-Xms64m"); javaTask.createJvmarg().setValue("-Xmx128m"); - + if (wasExtensionspath != null) { + // WAS 5: Additional Extensions Path required + javaTask.createJvmarg().setValue("-Dws.ext.dirs=" + wasExtensionspath); + } + // Set the Environment variable Environment.Variable var = new Environment.Variable(); @@ -559,7 +604,6 @@ // Set the Java class name javaTask.setTaskName("ejbdeploy"); javaTask.setClassname("com.ibm.etools.ejbdeploy.EJBDeploy"); - javaTask.createArg().setValue(sourceJar.getPath()); javaTask.createArg().setValue(tempdir); javaTask.createArg().setValue(destJar.getPath());
--- ejb.html.orig 2004-10-28 16:50:34.647151500 +0200 +++ ejb.html 2004-10-28 17:01:58.016602500 +0200 @@ -21,6 +21,7 @@ <li>Cyrille Morvan (<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>)</li> <li>Greg Nelson (<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>)</li> <li>Rob van Oostrum(<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>)</li> + <li>Ralf Kretzschmar-Auer(<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>)</li> </ul> <p>Version @VERSION@<br> @@ -52,7 +53,7 @@ 4.5.1 through to 7.0 EJB servers</li> <li><a href="http://www.objectweb.org/jonas/" target="_top">JOnAS</a> 2.4.x and 2.5 Open Source EJB server</li> - <li><a href="http://www.ibm.com/websphere">IBM WebSphere</a> 4.0</li> + <li><a href="http://www.ibm.com/websphere">IBM WebSphere</a> 4.0 and 5.1</li> </ul> Over time we expect further optional tasks to support additional EJB Servers. </p> @@ -71,7 +72,7 @@ <tr><td><a href="#ejbjar_jboss">jboss</a></td><td>JBoss</td></tr> <tr><td><a href="#ejbjar_jonas">jonas</a></td><td>JOnAS 2.4.x and 2.5</td></tr> <tr><td><a href="#ejbjar_weblogic">weblogic</a></td><td>Weblogic 5.1 to 7.0</td></tr> - <tr><td><a href="#ejbjar_websphere">websphere</a></td><td>IBM WebSphere 4.0</td></tr> + <tr><td><a href="#ejbjar_websphere">websphere</a></td><td>IBM WebSphere 4.0 and 5.1</td></tr> <tr><td><a href="#wlrun">wlrun</a></td><td colspan="2">Weblogic 4.5.1 to 7.0</td></tr> <tr><td><a href="#wlstop">wlstop</a></td><td colspan="2">Weblogic 4.5.1 to 7.0</td></tr> @@ -542,7 +543,7 @@ <li>iPlanet Application Server 6.0</li> <li>JBoss 2.1 and above</li> <li>Weblogic 5.1/6.0 session/entity beans using the weblogic.ejbc tool</li> - <li>IBM WebSphere 4.0</li> + <li>IBM WebSphere 4.0 and 5.1</li> <li>TOPLink for WebLogic 2.5.1-enabled entity beans</li> <li><a href="http://www.objectweb.org/jonas/">JOnAS</a> 2.4.x and 2.5 Open Source EJB server</li> </ul> @@ -1271,8 +1272,7 @@ This step can be performed by the websphere element as part of the jar generation process. If the switch <code>ejbdeploy</code> is on, the ejbdeploy tool from the websphere toolset is called for every ejb-jar. Unfortunately, this step only works, if you use the ibm jdk. Otherwise, the rmic -(called by ejbdeploy) throws a ClassFormatError. Be sure to switch ejbdeploy off, if run ant with -sun jdk. +(called by ejbdeploy) throws a ClassFormatError. Therefore the ejbdeploy by default switches to the jdk beeing part of your WebSphere installation. </p> <p> @@ -1280,7 +1280,11 @@ classes, that are required to reflect the bean classes. For ejbdeploy to work, you must also provide the classpath of the ejbdeploy tool and set the <i>websphere.home</i> property (look at the examples below). </p> - +<p> +For WebSphere 5.1 you have to provide an additional extensions path. The example +shows the values that are provided by IBM's deployer to the rmic code +generator. +</p> <table border="1" cellpadding="2" cellspacing="0"> <tr> <td valign="top"><b>Attribute</b></td> @@ -1335,7 +1339,7 @@ <td valign="top">This option is passed to ejbdeploy. Valid options are for example: <ul> <li>SQL92</li> <li>SQL99</li> <li>DB2UDBWIN_V71</li> - <li>DB2UDBOS390_V6</li> <li>DB2UDBAS400_V4R5</li> <li>ORACLE_V8</li> + <li>DB2UDBOS390_V6</li> <li>DB2UDBAS400_V4R5</li> <li>ORACLE_V8</li> <li>ORACLE_V9I</li> <li>INFORMIX_V92</li> <li>SYBASE_V1192</li> <li>MYSQL_V323</li> <li>MSSQLSERVER_V7</li> </ul> @@ -1353,6 +1357,12 @@ <td valign="top" align="center">No</td> </tr> <tr> + <td valign="top">useCurrentJdk</td> + <td valign="top">Run ejbdelpoy using the current JDK instead of the JDK that's + installed with WebSphere.</td> + <td valign="top" align="center">No, defaults to false</td> + </tr> + <tr> <td valign="top">rmicOptions</td> <td valign="top">This option is passed to ejbdeploy and will be passed on to rmic.</td> @@ -1360,9 +1370,11 @@ </tr> </table> -<p>This example shows ejbjar being used to generate deployment jars for all deployment descriptors +<p>The examples show ejbjar being used to generate deployment jars for all deployment descriptors in the descriptor dir:</p> + +<h4>a) WebSphere 4</h4> <pre> <property name="webpshere.home" value="${was4.home}"/> <ejbjar srcdir="${build.class}" descriptordir="etc/ejb"> @@ -1388,6 +1400,38 @@ location="${lib}/dtd/ejb-jar_1_1.dtd"/> </ejbjar> </pre> +<h4>b) WebSphere 5.1 using EJB 2.0</h4> +<pre> <property name="webpshere.dir" value="${was4.dir}"/> + <ejbjar srcdir="${build.class}" descriptordir="etc/ejb"> + <include name="*-ejb-jar.xml"/> + <websphere dbvendor="ORACLE_V9I" + ejbdeploy="true" + keepgeneric="false" + quiet="true" + oldCMP="false" + tempdir="/tmp" + destdir="${dist.server}"> + <wasclasspath> + <pathelement path = "${websphere.dir}\deploytool\itp\batch.jar" /> + <pathelement path = "${websphere.dir}\deploytool\itp\batch_nl1.jar" /> + </wasclasspath> + <wasextensionspath> + <pathelement path = "${websphere.dir}\java\lib" /> + <pathelement path = "${websphere.dir}\classes" /> + <pathelement path = "${websphere.dir}\lib" /> + <pathelement path = "${websphere.dir}\lib\ext" /> + <pathelement path = "${websphere.dir}\web\help" /> + <pathelement path = "${websphere.dir}\deploytool\itp\plugins\com.ibm.etools.ejbdeploy\runtime" /> + <pathelement path = "${websphere.dir}\..\..\WebSphere MQ\java\lib" /> + </wasextensionspath> + </websphere> + <dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" + location="${lib}/dtd/ejb-jar_1_1.dtd"/> + <dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" + location="${lib}/dtd/ejb-jar_2_0.dtd"/> + </ejbjar> + +</pre> <h3><a name="ejbjar_iplanet">iPlanet Application Server (iAS) element</a></h3>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]