Enterprise JavaBean projects (EJB 2.0 to EJB 2.1)
The J2EE Migration Wizard supports the migration of enterprise bean deployment descriptors from the J2EE 1.3 specification level EJB resource to J2EE 1.4. Stateless session beans and message-driven beans are migrated to J2EE 1.4.
Migrating session beans
The J2EE Migration Wizard migrates stateless session beans that are defined as service endpoint interfaces (SEI) in the webservices.xml descriptor of an EJB project in J2EE 1.3 to the J2EE 1.4 specification level by setting the service endpoint interfaces on the stateless session bean.The J2EE 1.4 specification requires a SEI be defined on a stateless session bean if the session bean is to be used as a Web services endpoint. During the migration of an EJB JAR file, all session beans in the EJB project get the service endpoint set to the name used in the webservices.xml descriptor of the EJB project. The following is an example of how the metadata of an EJB project looks before and after migration to the J2EE 1.4 specification level.
EJB project in J2EE 1.3: webservices.xml descriptor with a stateless session bean used as a Web service endpoint interface before migration
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE webservices PUBLIC "-//IBM Corporation, Inc.//DTD J2EE Web services 1.0//EN" "http://www.ibm.com/webservices/dtd/j2ee_web_services_1_0.dtd"> <webservices id="WebServices_1084831328093"> <webservice-description id="WebServiceDescription_1084831328093"> <webservice-description-name>EchoEJBService</webservice-description-name> <wsdl-file>META-INF/wsdl/EchoEJB.wsdl</wsdl-file> <jaxrpc-mapping-file>META-INF/EchoEJB_mapping.xml</jaxrpc-mapping-file> <port-component id="PortComponent_1084831328103"> <port-component-name>EchoEJB</port-component-name> <wsdl-port id="WSDLPort_1084831328103"> <namespaceURI>http://test</namespaceURI> <localpart>EchoEJB</localpart> </wsdl-port> <service-endpoint-interface>test.EchoEJB</service-endpoint-interface> <service-impl-bean id="ServiceImplBean_1084831328103"> <ejb-link>EchoEJB</ejb-link> </service-impl-bean> </port-component> </webservice-description> </webservices>The <service-endpoint-interface> and <service-impl-bean> tags in the preceding example define stateless session bean "EchoEJB" as a service endpoint in the webservices descriptor at the J2EE 1.3 specification level prior to migration.EJB project in J2EE 1.4: EJB deployment descriptor for the same stateless session bean "EchoEJB" with service endpoint interface created by the migration process
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ejb-jar> <ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"> <display-name> EchoEJBProject</display-name> <enterprise-beans> <session id="EchoEJB"> <ejb-name>EchoEJB</ejb-name> <home>test.EchoEJBHome</home> <remote>test.EchoEJB</remote> <service-endpoint>test.EchoEJB</service-endpoint> <ejb-class>test.EchoEJBBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session> </enterprise-beans> </ejb-jar>The<service-endpoint> tag in the preceding example defines "EchoEJB" as a service endpoint in the J2EE 1.4 specification level after migration.
Migrating message-driven beans
The J2EE Migration Wizard supports the migration of EJB 2.0 to EJB 2.1 message-driven beans.Message-driven beans were introduced in EJB 2.0 to support the processing of asynchronous messages from a Java™ Message Service (JMS). The EJB 2.1 specification expands the definition of the message-driven bean so that it can support any messaging system, not just JMS.
Note: Message-driven beans that have been migrated from the EJB 2.0 specification level to EJB 2.1 and are deployed to WebSphere® Application Server v6 must be deployed against a Java Connector Architecture (JCA) 1.5 resource adapter instead of a listener port (as in WAS version 5). You must use the Deployment Descriptor Editor to change the WebSphere Bindings settings for the EJB 2.1 message-driven beans to use a JCA adapter. See Configuring an EJB 2.1 message-driven bean to use a JCA adapter.
The EJB 2.0 message-driven bean artifacts migrated are:
Some of the EJB 2.0 message-driven bean elements are replaced with activation-config properties. The property names and values used in the activation-config property to describe the messaging service will vary depending on the type of message service used. However, EJB 2.1 defines a set of fixed properties for JMS-based message-driven beans.
- acknowledgeMode
- messageSelector
- destinationType
- subscriptionDurablity
The following example compares the elements of a sample bean in EJB 2.0 with how the elements appear in EJB 2.1.
An example of message-driven bean elements in EJB 2.0:
<message-driven id="Mdb20"> <ejb-name>Mdb</ejb-name> <ejb-class>ejbs.MdbBean</ejb-class> <transaction-type>Bean</transaction-type> <message-selector>mdbMessage</message-selector> <acknowledge-mode>Auto-acknowledge</acknowledge-mode> <message-driven-destination> <destination-type>javax.jms.Topic</destination-type> <subscription-durability>Durable</subscription-durability> </message-driven-destination> </message-driven>An example of message-driven bean elements in EJB 2.1:
<message-driven id="Mdb21"> <ejb-name>Foo/ejb-name> <ejb-class>ejbs.FooBean</ejb-class> <messaging-type>javax.jms.MessageListener</messaging-type> <transaction-type>Bean/transaction-type> <message-destination-type>javax.jms.Topic</message-destination-type> <activation-config> <activation-config-property> <activation-config-property-name>destinationType</activation-config-property-name> <activation-config-property-value>javax.jms.Topic</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>subscriptionDurability</activation-config-property-name> <activation-config-property-value>Durable</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>acknowledgeMode</activation-config-property-name> <activation-config-property-value>AutoAcknowledge</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>messageSelector</activation-config-property-name> <activation-config-property-value>fooSelector</activation-config-property-value> </activation-config-property> </activation-config> </message-driven>
Related tasks
Configuring an EJB 2.1 message-driven bean to use a JCA adapter