© 2009 ibm corporation ibm software group | education migration from jboss to was ce (hcl bancmate...
TRANSCRIPT
© 2009 IBM Corporation IBM Software Group | Education www.ibm.com/training/in
Migration from JBoss to WAS CE
(HCL BancMate Application )
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Agenda
Introduction to WAS CE What is migration? Why we need migration? Challenges faced in BancMate Migration Activity Migration by components web app session bean data source lookup entity bean MDB Walk through on WAS CE administration and Configuration
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Geronimo and WAS CE Assemblies
WAS CE
Geronimo
Geronimo• Two Java EE assemblies• Two web containers:
Tomcat / Jetty• Two web services providers:
Axis2 / CXF
Framework Server• Geronmo kernel• Core security• Transaction• Plugin installer
WAS CE• One Java EE assembly: - Tomcat/Axis2• IP Review• IBM JDK certification• Additional testing• Higher level of support• Supports Runtime Customization
Custom Assembly • Mix of desired open source packages• 3-rd party libraries• Customer-developed apps• Typically used to reduce server size, memory, and startup• Create using Console or scripts
CustomAssembly
Framework
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
WebSphere Application Server Community Edition v2.1 (WAS CE)
A lightweight JEE5 application server built on open source Apache Geronimo
technology
Small Foot Print
(~85MB download)JEE5
CompatibleNo Upfront
Costs
World-class Support Options
(2 tiers)
Built on Apache technology - The Gold Standard in Open Source
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
What is migration? Why we need migration?
Many vendors many implementaions DD different schemas
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Challenges faced in Banmate migration migration?
Operational Challenges Communication gap
On MDB design Java EE Packaging
Poor hardware
Architectural challenge No automated build system Whole project is simple Java project, not JEE project
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Migration Approach
Migration tool kit does not support migration to WAS CE. So we followed manual migration module by module Migration tool kit automates 90% of migration
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Steps for WAS CE Migration
Understand high level design and architecture of bancmate
●Set up code base of bancmate w/o errors●Run a simple demo of bancmate from the the code base which was set up in previous step●Create all server resources such as JDBC connection, Data sources, JMS queue in WAS CE which are identical to Jboss.●Test the connectivity to those objects whereever possible. ●Identify the application and migrate component by component in the following order. Easiest first, complicated later●Data source look up●Web components – Servlets, JSPs●Session Bean●Messaging Bean
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Creating DB pool
This contains the following 2 steps ●Adding MS SQL 2005 JDBC jar into WAS CE●Using Geronimo databese pool wizard to create data base pool
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Adding MS SQL 2005 JDBC jar to WAS CE
Click on add to repository. Browse the location of jar file and provide value to the following
●i)group : some group to MS SQL 2005 such as com.microsoft●ii)artifact id : optional something like mssql2005●iii)version : version number something like 9.7●iv)type : jar
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Create Data Base pool
Using Geronimo databese pool wizard to create data base pool
●After adding the jar next step is to create a database pool, click on the Using the Geronimo databese pool wizard these are the mandatory steps●pool name : jdbc/bancmate ●Database Type : MS SQL 2005●Select the jdbc Driver JAR from the driver jar that we added in the step "Add Archive to Repository"● DB UserName : aaaa●DB Password : bbbb●Confirm Password : bbbb
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Create Data Base pool
●JDBC Connect URL : jdbc:sqlserver://10.xx.x.xx:1433● databaseName=dbname●applicationName=BancMateCBS●Data Source name :jdbc/bancmate●Eg:DatabaseName “ jdbc:sqlserver://10.xx.x.xx:1433; databaseName=xxxx; applicationName=xxxxxx”
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Create Data Base pool
The same can be done by running admin command on the following database-plan file
Sample data base plan file<?xml version="1.0" encoding="UTF-8"?><connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-
1.2"> <dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dep:moduleId> <dep:groupId>console.dbpool</dep:groupId> <dep:artifactId>jdbc_bancmate</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>car</dep:type> </dep:moduleId> <dep:dependencies> <dep:dependency> <dep:groupId>com.microsoft.sqlserver.jdbc</dep:groupId> <dep:artifactId>sqljdbc</dep:artifactId>
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Testing DB connection
This can be done by clicking on test connection and also by executing some query against created data base pool.
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Data Source look up
Here is code to look up data source for WAS CE
else if (sAppServer.equalsIgnoreCase("wasce")) {logger.info("wasce data Connection found");ds = (DataSource)ctx.lookup("java:comp/env/jdbc/DataSource");}
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Migrating Servlets, JSPs
Migrating Web components is straight forward. Add WAS CE specific deployment descriptor and compile the war then deploy to WAS CE.
Sample geronimo-web.xml
<?xml version="1.0" encoding="UTF-8"?><web:web-app xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2"xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-2.0"xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pers="http://java.sun.com/xml/ns/persistence"xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"><dep:environment><dep:moduleId><dep:groupId>default</dep:groupId><dep:artifactId>BancMate.war</dep:artifactId><dep:version>1.0</dep:version><dep:type>car</dep:type>
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Migrating Session Bean
Here are the steps
● Fix any compilation erros on EJB source code if any● add open-ejb.jar.xml● build ejb jar● deploy ejb jar
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Migrating MDB
Here are the steps●Create queues●add dependencies wherever this queues are utlized●add entires in openejb-jar.xml
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Create JMS queue
To create a JMS queue and topic destinations, follow these steps:
1. In the JMS Resource Group -- Current Progress page, click Add Destination
2. In the JMS Resource Group -- Select Destination Type page, select javax.jms.Queue
as the JMS Destination Type and click Next. 3. In the JMS Resource Group -- Configure Destination page, set the Message
Destination Name to myQueue, set the PhysicalName to myQueue, and click Next.
4. In the JMS Resource Group -- Current Progress page, click Deploy Now to deploy the
JMS resource group to Community Edition.5. In the resulting JMS Resources page, verify that the myJMSResourceGroup group
exists with the connection factory and destination
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
ejb-jar.xml entries
ejb-jar.xml entries<enterprise-beans><ejb:message-driven><ejb:ejb-name>JmsReceiverDictMDB</ejb:ejb-name><name:resource-adapter> <name:resource-link>bancmateConnectionFactory</name:resource-link>
</name:resource-adapter>
<name:resource-env-ref><name:ref-name>jms/JmsReceiverDictMDB</name:ref-name><name:admin-object-link>JmsReceiverDictMDB</name:admin-object-link></name:resource-env-ref></ejb:message-driven>
<ejb:message-driven><ejb:ejb-name>AuditTrailMDB</ejb:ejb-name><name:resource-adapter><name:resource-link>bancmateConnectionFactory</name:resource-link></name:resource-adapter>
<name:resource-env-ref><name:ref-name>jms/AuditTrailQueue</name:ref-name><name:admin-object-link>AuditTrailQueue</name:admin-object-link></name:resource-env-ref></ejb:message-driven></enterprise-beans>
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Changes in EJB source code i)FOR JmsReceiverDictMDB
package bancmate.common.ejbserver class JmsReceiverDictMDB Code: @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "JmsReceiverDictMDB") })
ii) For JmsMessageReceiverMDB
package bancmate.audittrail.ejbserver class JmsMessageReceiverMDB
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "AuditTrailQueue") },name="AuditTrailMDB")
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
JMS look up code
try {qConFactory = (QueueConnectionFactory)
context.lookup("java:comp/env/bancmateConnectionFactory");}
Code: 1) try {queue = (Queue) context.lookup("java:comp/env/jms/AuditTrailQueue");}2) sendMessage("java:comp/env/jms/BMProcessQueue","interest Posting");3) public void sendMessage(String queueName, String msg)try {qConFactory = (QueueConnectionFactory)
context.lookup("java:comp/env/bancmateConnectionFactory");}4) public void sendMessageToDict(String queueName, String msg1, String msg2,String msg3) { try {qConFactory = (QueueConnectionFactory)context.lookup("java:comp/env/bancmateConnectionFactory");}
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Technical challenges faced
context root was not getting displayed We added same context root in application.xml as well as web.xml
EJB Home is not getting looked up
As per WAS CE specification, we need to append JNDI name with RemoteHome for accesing remote home of an EJB.
After the following modification it was working
public Object getObject(String sLookUp) { if (BMConfig.getProperty("ApplicationServer").equalsIgnoreCase("wasce")) { ref = jndiContext.lookup(sLookUp + "RemoteHome"); } else { ref = jndiContext.lookup(sLookUp); }
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Technical challenges faced
Web application is not able to utilise JMS queue We need to add the following entries in web.xml in order for web module to access the JMS
<resource-ref><res-ref-name>bancmateConnectionFactory</res-ref-name><res-type>javax.jms.ConnectionFactory</res-type><res-auth>Container</res-auth><res-sharing-scope>Shareable</res-sharing-scope></resource-ref> <message-destination-ref> <message-destination-ref-name>jms/JmsReceiverDictMDB</message-destination-ref-name> <message-destination-type>javax.jms.Queue</message-destination-type> <message-destination-usage>Produces</message-destination-usage> <message-destination-link>JmsReceiverDictMDB</message-destination-link></message-destination-ref>
www.ibm.com/training/in© 2011 IBM Corporation IBM Software Group | Education www.ibm.com/training/
in
Maximize the value of your WebSphere investment
Renewing your IBM Software Subscription and Support is the best way to ensure you get continuous and maximum value
Protect your investment
Leap ahead of competitors
Get up and running faster
Download the latest enhancements
of entitled WebSphere middleware
at no extra charge
Enhance your business. Stay current. Renew your software subscription.
WebSphere Subscription and Support http://www-01.ibm.com/software/websphere/subscriptionandsupport/
The technology you need, when you need it
Access to WebSphereFeature Packs
Award-winningIBM SupportPortal