Previous versions of the JOnAS EjbJar Ant task have some limitations—especially when you are developing webservices.
In previous versions of JOnAS, jonas-ejb-jar constructed the JAR for you, using information gathered from the ejb-jar.xml and from the classes themselves (dependencies using BCEL). But if you have a Session Bean exposed as a webservice, you want to have more files in your archive (webservices.xml, JAX-RPC mapping file, WSDL + imported WSDL definitions + imported XML Schema).
The older task did not package these files inside the archive, and therefore, when GenIC loaded the descriptors, some dependencies were missing, causing GenIC to throw an exception.
The solution is to let the developer create the JAR file, so that the exact content of the file can be controlled.
The file should have at least the following content:
META-INF/ejb-jar.xml
META-INF/jonas-ejb-jar.xml
**/*.class
Notice that webservices files are optional.
The genic task supports most attributes of the jonas-ejb-jar task.
Differences:
Removed destdir: JAR files are directly modified
Removed classpath: classpath is now set as inner element
Removed novalidation: validation attribute is used now
Removed keepgeneric: not meaningful (input JAR is already specific)
Removed suffix: not meaningful (no JAR generated)
Removed nogenic: not meaningful (we want to run GenIC)
Attribute | Description | Required |
---|---|---|
jonasroot | The root directory for JOnAS. | Yes (Can be read from project properties if not set) |
jonasbase | The base directory for JOnAS. If omitted, it defaults to jonasroot. | No |
keepgenerated | true if the intermediate Java source files generated by GenIC must not be deleted. If omitted, it defaults to false. | No |
nocompil | true if the generated source files must not be compiled via the Java and RMI compilers. If omitted, it defaults to false. | No |
validation | true if the XML deployment descriptors must be parsed with validation. If omitted, it defaults to true. | No |
javac | Java compiler to use. If omitted, it defaults to the value of build.compiler property. | No |
javacopts | Options to pass to the Java compiler. | No |
protocols | Comma-separated list of protocols (chosen from jeremie, jrmp, iiop, cmi) for which stubs should be generated. Default is jrmp,jeremie. | No |
rmicopts | Options to pass to the RMI compiler. | No |
verbose | Indicates whether or not to use -verbose switch. If omitted, it defaults to false. | No |
additionalargs | Add additional arguments to GenIC. | No |
jvmopts | Additional arguments to pass to the GenIC JVM. | No |
jvmdebug | Indicates whether you want to debug the forked JVM; it defaults to false. The JVM will be suspended and waiting a connection on port 12345. | No |
Nested Element | Description | Required |
---|---|---|
classpath | The additional classpath entries used when generating EJB stubs and skeletons. | No |
fileset | Points out the ejb-jars that will be processed by GenIC. Note that you can add as many filesets as you want (useful if your JARs are in different directories). | Yes (at least 1) |
First, define this new task:
<taskdef name="genic" classname="org.objectweb.jonas.ant.GenICTask" classpath="${jonas.root}/lib/common/ow_jonas_ant.jar" /> |
Then use it:
Create the JAR file.
<jar destfile="${temp.ejbjars.dir}/my-ejbjar.jar"> <metainf dir="${etc.dir}/META-INF" /> <fileset dir="${classes.dir}"> <include name="org/objectweb/jonas/myejbjar/*.class" /> </fileset> </jar> |
Process this JAR with the GenIC task.
<genic keepgenerated="true" protocols="${protocols.names}"> <fileset dir="${temp.dir}"> <include name="ejbjars/my-ejbjar.jar" /> </fileset> </genic> |
Example 27-1. Example