« ADF in Action: Prepare Yourself for JDeveloper 11g | Main | Nice JDev 11g Feature: EAR Packaging »

ADF in Action: Migrating to JDeveloper 11.1.1

Since JDeveloper 11.1.1 has been released on OTN, a number of posts have done on the new features of JDev 11g. We will use all these blogs to complete our task...

Why migrate? Can't we stick with the old 11g?

When a new production release is available it is better to migrate to this release as long as it makes sense. With JDeveloper 11.1.1 this makes perfect sense, because all previous version where just technical previews and not intended for production. Many of us hit one or the other problem and sometimes nearly all of our work was lost. For this reason we happily migrate to the production release.

Start the Migration

Stop, hold it. Not so quick! Before we start migrating, we make a backup copy of the complete application directory. Just in case we want to return to our old version.

Now, we are ready to start. Since migration from Technical Previews to Production Releases is not supported, we take the JDeveloper 10.1.3 version of the project and copy it to the 11g directory. To get the application workspace into JDeveloper we open it with Open Application ... in the Application Navigator. JDeveloper will tell us that the project files will be migrated. This what we want. Great, go ahead. A quick scan through all the projects looks pretty promising. OK, let us continue.

The Database Project

This is easiest project. We can check the database connection from Application Resources -> Connections -> Database -> survey. On my copy the login details where gone. This is a security measure and acceptable. After supplying the necessary details, the connection to the database should work like a charm. If you do not have your database up and running, restart it.

The ModelTopLink Project

OK, move on to the ModelTopLink project. Nearly everything is fine here. But we have to check the libraries and the client must be changed a bit. To change the libraries open the Project Properties (double-click on the ModelTopLink project), select Libraries and Classpath. You need only the libraries Oracle XML Parser v2, EJB 3.0, TopLink, Java EE 1.5 API, and WebLogic 10.3 Remote-Client. Everything else should be removed.

Finally we need to adjust the code of the SurveySessionClient a bit.

1. The parameter for the context.lookup() has to be changed to

(SurveySession)context.lookup("SurveySessionBean#demo.survey.model.toplink.SurveySession");

2. The method getInitialContext() needs some extra settings to connect to the integrated WebLogic server:

private static Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
// WebLogic Server 10.x connection details
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://127.0.0.1:7101");
return new InitialContext(env);
}

To avoid problems while testing, click on the ModelEJB30 project, open the Context Menu and choose Remove from OnlineSurvey.jws. Click on the SurveySessionBean, open the Context Menu and select Run. When you see [Application OnlineSurvey deployed to Server Instance DefaultServer] in the Running: Default Server - Log window, click on the SurveySessionClient, open the Context Menu and select Run. The output should show that the client is working.

The ModelEJB30 Project

This project is similar to the ModelTopLink project: we have to check the libraries and the client must be changed a bit. If the ModelEJB30 project is not in your OnlineSurvey application, go to the Application Menu left to the OnlineSurvey name and select Open Project ..., in the Open Project file selector navigate to the ModelEJB30 directory and select the ModelEJB30.jpr file.

To change the libraries open the Project Properties (double-click on the ModelEJB30 project), select Libraries and Classpath. You need only the libraries Oracle XML Parser v2, EJB 3.0, TopLink, Java EE 1.5 API, and WebLogic 10.3 Remote-Client. Everything else should be removed.

Finally we need to adjust the code of the SurveySessionClient a bit.

1. The parameter for the context.lookup() has to be changed to

(SurveySession)context.lookup("SurveySessionBean#demo.survey.model.ejb30.SurveySession");

2. The method getInitialContext() needs some extra settings to connect to the integrated WebLogic server:

private static Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
// WebLogic Server 10.x connection details
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://127.0.0.1:7101");
return new InitialContext(env);
}

To avoid problems while testing, click on the ModelTopLink project, open the Context Menu and choose Remove from OnlineSurvey.jws. Click on the SurveySessionBean, open the Context Menu and select Run. When you see [Application OnlineSurvey deployed to Server Instance DefaultServer] in the Running: Default Server - Log window, click on the SurveySessionClient, open the Context Menu and select Run. The output should show that the client is working.

The ModelBC Project

Finally, the ModelBC project. You will notice that you have a second ModelBC0.jpx file in the Application Navigator. This will be used in the future. Everything is fine so far and no further actions are to be done.

Exercise

Because the creation of the database is quite a tedious task, create an Ant file to drop the old schema, create the tablespace, create the user, and create the tables of the schema. It might be necessary to change the some of the SQL files.

Coming Up Next

The next post will start building the UI part of the application.

About This Entry

This page contains a single entry from the blog posted on October 23, 2008 9:49 AM.

The previous post in this blog was ADF in Action: Prepare Yourself for JDeveloper 11g.

The next post in this blog is Nice JDev 11g Feature: EAR Packaging.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle