Topic
  • 6 replies
  • Latest Post - ‏2012-12-13T14:34:58Z by SystemAdmin
RajivKonkimalla
RajivKonkimalla
5 Posts

Pinned topic What is the best way to migrate from GLASSFISH 3.1 to WAS 8.0?

‏2011-07-28T13:39:11Z |
I have developed my application in Netbeans IDE and deployed in Glassfish 3.1. I would really appreciate if someone can show me the best method to port my source code to RAD/WAS 8.0 combination.
Updated on 2012-12-13T14:34:58Z at 2012-12-13T14:34:58Z by SystemAdmin
  • Scott Johnston
    Scott Johnston
    101 Posts

    Re: What is the best way to migrate from GLASSFISH 3.1 to WAS 8.0?

    ‏2011-08-03T14:29:57Z  
    I contacted members of the WAS development team and the method they suggested for migrating an application developed in NetBeans for Glassfish into WebSphere Application Server is as follows:

    The user in this case has to do at least 3 steps:
    1. Migrate the code from NetBeans to RAD manually using the correct New Project Wizards, like Dynamic Web Applications for Web Modules, EJB Applications for EJB Modules
    2. Fix the code and the classpath issues, if any.
    3. update the IBM ext files when necessary. If the user created the project as stated in #1 above, there will be visual panels that they can navigate, but if they just ported the application as only a Java Project, this step will be a lot harder.

    And then export and deploy to WAS.

    Another developer added...

    As part of Step #1 above, the user could use the EAR file produced from NetBeans and import the EAR into RAD. This might be the easiest way to get projects created. The user would still need to manually move the source. Eclipse has the option of exporting source with an EAR. NetBeans might have the same option, that might help.
    Lastly, although it won't help for the NetBeans and Glassfish scenario, others who want to migrate applications from WebLogic, JBoss or Oracle Application Servers can use the IBM WebSphere Application Server Migration Toolkit.

    The Application Migration Toolkit is available for download from the developerWorks website:
    http://www.ibm.com/developerworks/websphere/downloads/migtoolkit/compmig.html

    Regards,
    Scott Johnston
    WebSphere Application Server
    Install & Configuration User Experience Lead
  • RajivKonkimalla
    RajivKonkimalla
    5 Posts

    Re: What is the best way to migrate from GLASSFISH 3.1 to WAS 8.0?

    ‏2011-08-23T18:10:42Z  
    I contacted members of the WAS development team and the method they suggested for migrating an application developed in NetBeans for Glassfish into WebSphere Application Server is as follows:

    The user in this case has to do at least 3 steps:
    1. Migrate the code from NetBeans to RAD manually using the correct New Project Wizards, like Dynamic Web Applications for Web Modules, EJB Applications for EJB Modules
    2. Fix the code and the classpath issues, if any.
    3. update the IBM ext files when necessary. If the user created the project as stated in #1 above, there will be visual panels that they can navigate, but if they just ported the application as only a Java Project, this step will be a lot harder.

    And then export and deploy to WAS.

    Another developer added...

    As part of Step #1 above, the user could use the EAR file produced from NetBeans and import the EAR into RAD. This might be the easiest way to get projects created. The user would still need to manually move the source. Eclipse has the option of exporting source with an EAR. NetBeans might have the same option, that might help.
    Lastly, although it won't help for the NetBeans and Glassfish scenario, others who want to migrate applications from WebLogic, JBoss or Oracle Application Servers can use the IBM WebSphere Application Server Migration Toolkit.

    The Application Migration Toolkit is available for download from the developerWorks website:
    http://www.ibm.com/developerworks/websphere/downloads/migtoolkit/compmig.html

    Regards,
    Scott Johnston
    WebSphere Application Server
    Install & Configuration User Experience Lead
    Thanks for all your input. I have successfully deployed my application in WAS 8.0 and everything works fine. I have done the following steps:

    1) I sticked onto Netbeans and did not port my application to RAD. I have removed unnecessary xml files and at the end kept web.xml, persistenc.xml and sun-web.xml.

    2) I have used Jersey implementation for JAX-RS 1.1 and so included those jars in the lib folder.

    3) I have used eclipselink vendor for JPA 2.0. For this I needed to change persistence.xml to include the following items:
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <properties>
    <property name="eclipselink.target-server" value="WebSphere"/>
    <property name="eclipselink.logging.level" value="FINEST"/>
    </properties>

    4) I have placed eclipselink jars under lib folder of websphere (Appserver)

    5) Default transport protocol for glassfish is 8080 and so instead of changing the code I have configured WAS 8.0 to 8080 (from 9080).

    I did not want to go for RAD as Netbeans is doing my work and more over RAD has a different implementation for JAX-RS 1.1 and calling entities in the application for JPA. As, I don't want to change my code I am sticking onto netbeans. Also, the app can easily be deployed in weblogic.
  • Scott Johnston
    Scott Johnston
    101 Posts

    Re: What is the best way to migrate from GLASSFISH 3.1 to WAS 8.0?

    ‏2011-08-23T21:12:35Z  
    Thanks for all your input. I have successfully deployed my application in WAS 8.0 and everything works fine. I have done the following steps:

    1) I sticked onto Netbeans and did not port my application to RAD. I have removed unnecessary xml files and at the end kept web.xml, persistenc.xml and sun-web.xml.

    2) I have used Jersey implementation for JAX-RS 1.1 and so included those jars in the lib folder.

    3) I have used eclipselink vendor for JPA 2.0. For this I needed to change persistence.xml to include the following items:
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <properties>
    <property name="eclipselink.target-server" value="WebSphere"/>
    <property name="eclipselink.logging.level" value="FINEST"/>
    </properties>

    4) I have placed eclipselink jars under lib folder of websphere (Appserver)

    5) Default transport protocol for glassfish is 8080 and so instead of changing the code I have configured WAS 8.0 to 8080 (from 9080).

    I did not want to go for RAD as Netbeans is doing my work and more over RAD has a different implementation for JAX-RS 1.1 and calling entities in the application for JPA. As, I don't want to change my code I am sticking onto netbeans. Also, the app can easily be deployed in weblogic.
    It is great to hear of your success. Thank you for returning to the forum to share your experiences with us. Keep coming back and letting us know how things go.
    Regards,
    Scott Johnston
    WebSphere Application Server
    Install & Configuration User Experience Lead
  • RajivKonkimalla
    RajivKonkimalla
    5 Posts

    Re: What is the best way to migrate from GLASSFISH 3.1 to WAS 8.0?

    ‏2011-10-18T18:39:12Z  
    It is great to hear of your success. Thank you for returning to the forum to share your experiences with us. Keep coming back and letting us know how things go.
    Regards,
    Scott Johnston
    WebSphere Application Server
    Install & Configuration User Experience Lead
    I came across a medium problem in my application when restful web service, implemented using Jersey API, is throwing an user-defined error message.

    I have several custom user defined exceptions and interested in sending the mobile client the error code along with the custom defined error message. With the help of the forum, I could successfully do this when I deployed the application in Glassfish 3.1. Following forum thread gives the full information:

    http://www.java.net/forum/topic/glassfish/glassfish/how-send-user-defined-error-message-status-line-http-response-using-java-restful-web-services-0?force=151

    The problem came when app is deployed in the latest WAS 8.0. Now the client can only get the status code (what ever server sends) but not the error message, which always shows "Undefined". However, web client (browser) gives the correct information like
    "Error 520: The EmailId or Password you entered is incorrect."

    Following is the sample code that runs successfully in Glassfish 3.1 but fails in WAS 8.0

    ------EXCEPTION response------------

    public class UserNotFoundResponse implements Response.StatusType{

    @Override
    public int getStatusCode() { return 520; }

    @Override
    public Response.Status.Family getFamily() { return Response.Status.Family.SERVER_ERROR; }

    @Override
    public String getReasonPhrase() { return "The EmailId or Password you entered is incorrect."; }

    }

    -----calling the exception from restful web service---------------
    @GET
    @Produces("text/xml")
    public Advertisements getAdvertisements(.....) {
    try { //business logic }catch(UserNotFoundException ex) { throw new WebApplicationException(ex, Response.status(new UserNotFoundResponse()).build()); }catch(Exception ex) { ... }
    }


    I feel that some configuration change in WAS 8.0 would solve this problem as the same code works fine in Glassfish 3.1. I would really appreciate if some WAS team member looks into my problem.
  • RajivKonkimalla
    RajivKonkimalla
    5 Posts

    Re: What is the best way to migrate from GLASSFISH 3.1 to WAS 8.0?

    ‏2011-10-25T15:16:14Z  
    I contacted members of the WAS development team and the method they suggested for migrating an application developed in NetBeans for Glassfish into WebSphere Application Server is as follows:

    The user in this case has to do at least 3 steps:
    1. Migrate the code from NetBeans to RAD manually using the correct New Project Wizards, like Dynamic Web Applications for Web Modules, EJB Applications for EJB Modules
    2. Fix the code and the classpath issues, if any.
    3. update the IBM ext files when necessary. If the user created the project as stated in #1 above, there will be visual panels that they can navigate, but if they just ported the application as only a Java Project, this step will be a lot harder.

    And then export and deploy to WAS.

    Another developer added...

    As part of Step #1 above, the user could use the EAR file produced from NetBeans and import the EAR into RAD. This might be the easiest way to get projects created. The user would still need to manually move the source. Eclipse has the option of exporting source with an EAR. NetBeans might have the same option, that might help.
    Lastly, although it won't help for the NetBeans and Glassfish scenario, others who want to migrate applications from WebLogic, JBoss or Oracle Application Servers can use the IBM WebSphere Application Server Migration Toolkit.

    The Application Migration Toolkit is available for download from the developerWorks website:
    http://www.ibm.com/developerworks/websphere/downloads/migtoolkit/compmig.html

    Regards,
    Scott Johnston
    WebSphere Application Server
    Install & Configuration User Experience Lead
    I came across one more thing during the migration. I converted a Stateless EJB to WebService (soap) by adding @WebService at the class level. Glassfish created a WebService and gave the way to test the service with in the admin console. I am not sure how to test this service in WAS 8.0. I am not sure as how to get wsdl so that I can write a separate application to test the web service.
  • SystemAdmin
    SystemAdmin
    64 Posts

    Re: What is the best way to migrate from GLASSFISH 3.1 to WAS 8.0?

    ‏2012-12-13T14:34:58Z  
    Thanks for sharing all this information. AFAIK, the META-INF folder containing persistence.xml should be in WebContent of the web module. Is this correct?