Categories

Duncan Mills

Syndicate this blog

A Rough Guide to

Installing and Setting up WebLogic 10.3 Production for Running ADF Applications

The process of setting up and running WebLogic Server to handle ADF 11g applications appears to be causing some confusion so this blog entry documents the basic steps required to setup and configure WebLogic (both and Admin server and a Managed server) for ADF Applications.
This is not the official documentation, but rather it's the basic steps I followed this evening to set up a configuration from scratch. So it's rough but it does work.

  1. As prerequisites I’m using WebLogic 10.3 downloaded from OTN and the latest version of JDeveloper (11.1.1.0.1 build 5188)
  2. Install WebLogic into a new BEA home. I’m doing this on M/S Windows and my home directory will be C:\builds\WLS10_3
  3. While installing you can go for a custom install and deselect the following which you won’t need:
    • Workshop
    • Web 2.0 http pub-sub server
    • Weblogic Web Server Plugins
    • UDDI and Xquery Support
    • Server Examples
  4. Select the JVM that you want to use. Here I’m just using JRockit
  5. Don’t bother to install the node manager service. If you use it to start a managed server then ADF apps will not run because the classpath is somehow not set up correctly - so you need to start the admin server and managed servers from the command line.
  6. Complete the install sticking to the defaults, but uncheck the Quickstart option on the last screen
  7. Now run the JDeveloper install on the target machine
  8. Choose existing middleware home in the home type and select the home that you just created for the server install (e.g. C:\builds\WLS10_3 in my case)
  9. On the product selection screen make sure that both JDeveloper Studio and ADF Runtime are installed.
  10. Run the install.
  11. Now run the Configuration Wizard from the start menu
  12. Create a new WebLogic domain
  13. Choose the first option on the next screen to pre-configure the domain with both WebLogic Server and ADF
  14. Create the admin user as weblogic / weblogic (or whatever). As we’re trying to emulate a production instance here choose production mode and JRockit as the VM
  15. On the next screen you can choose to customize things like the ports - so choose yes there so we can reassign out server to use ports 80 and 81
  16. Just choose next on the RDBMS security store page
  17. On the configure the Admin Server page set the port to 81
  18. On the next page Add one managed server called ManagedServer and set the port to 80
  19. No need for clustering in this simple case so next through the cluster page
  20. Create a machine on the next screen. If you are using a machine with a known DNS name and fixed IP address use that. or just create a arbitrary name such as LocalMachine if this is all for local testing
  21. Next through to the summary screen
  22. In the Create WebLogic Domain screen change the name of the domain to ADFDomain and press create.
  23. Finish the wizard.
  24. Now from the command line start the AdminServer with the script (in my case): C:\builds\WLS10_3\user_projects\domains\ADFDomain\bin\startWeblogic.cmd
  25. You need to specify the username and password if you defined the Domain in production mode.
  26. Once the AdminServer is started run the console at http://localhost:81/console
  27. Log in.
  28. In the console, click deployments in the Domain Structure tree You should see the following Deployments:
    • adf.oracle.domain(1.0,11.1.1.0.0)
    • jsf(1.2,1.2.7.1)
    • jstl(1.2,1.2.0.1)
  29. Press Lock and edit in the change center box at the top left of the screen.
  30. Drill down through each of the Deployments and select the Targets tab. For each one check the checkbox for both the ManagedServer and the AdminServer
  31. Save each deployment change as you make it
  32. Finally press the Activate Changes button when they are all done.
  33. Now to start the ManagedServer - use the command line for this: “C:\builds\WLS10_3\user_projects\domains\ADFDomain\bin\startManagedWeblogic.cmd ManagedServer http://localhost:80”
  34. Now we can run ADF applications on both servers
  35. Now from JDeveloper you will be able to create a Server connection when you deploy the application using port 81 (the AdminServer) and the domain name of ADFDomain.
  36. When you deploy an app it should prompt to deploy to either the AdminServer or the managed server.

Programmatic Login From Faces with WLS

A while back I was having a lot of errm "fun", with trying to square the worlds of container managed security in OC4J with JSF based login screens. I won't bore you with the details, it was painful and never satisfactory as it either involved verbatim tags or fancy re-directs.
Anyway now that we've switched over to WebLogic for JDeveloper / ADF 11g it was time to look again and thankfully it's simple. Hurrah!
I'm working on a fuller sample for the forthcoming book but for now all you need this little snippet:

import weblogic.security.SimpleCallbackHandler;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.FailedLoginException;
import javax.security.auth.login.LoginException;

...

public String performLogin() {
  String un = getUsername();
  byte[] pw = getPassword().getBytes();
  FacesContext ctx = FacesContext.getCurrentInstance();
  HttpServletRequest request =
    (HttpServletRequest)ctx.getExternalContext().getRequest();
  CallbackHandler handler = new SimpleCallbackHandler(un, pw);
  try {
    Subject mySubject =
      weblogic.security.services.Authentication.login(handler);
    weblogic.servlet.security.ServletAuthentication.runAs(mySubject, request);
  }
  catch (FailedLoginException fle) {
    FacesMessage msg =
      new FacesMessage(FacesMessage.SEVERITY_ERROR, "Incorrect Username or Password",
          "An incorrect Username or Password was specified");
      ctx.addMessage(null, msg);
    }
  catch (LoginException le) {
    System.out.println("Some other problem on login " + le.toString());
  }
  return null;
}

This lives in a request scope managed bean with the usual username and password attributes bound to your UI fields in JSF.
This works nicely with both Java EE Container and ADF (JAAS based) security.

Bindings Presentation

I've posted my data-bindings presentation here. Enjoy!

Oracle Openworld Ahead

It's been a hectic week with a quick trip across the pond "nach Deutschland" and the usual last minute scrabble to get everything ready for OpenWorld. Kudos goes to my team and Shay in particular who do all the really hard work. My broad literary is as follows:

  • Sunday briefing day for the Oracle Technology Network ACE directors where we give them the scoop, followed by the OTDUG Fusion Symposium where Clemens Utschig-Utschig and I are giving a fun session on the essence of Fusion development.
  • Monday We have Ted Farrell's Oracle develop keynote in the Marriot. Really cool demos in that one and maybe an announcement or two....;-). If you're interested in ADF and custom Fusion development, you should also make it to the 1pm session in Marriot Salon 7 where one of our early adopters will be showcasing what they have been up to. Unfortunately, at the same time (of course) there's a cool session on using Maps in ADF Apps - decisions, decisions...
  • Tuesday I start the day with a quick podcast with Justin Kestelyn for OTN, followed by some customer meetings, a spell on the DemoGrounds between 11 and 2pm and in the afternoon my Bindings Internals paper (Marriot Salon 5 @ 2:30). I do overlap with Thomas Kurian's keynote on that one.
  • Wednesday is a series of analyst briefings and a cameo appearance in an Hyperion Essbase session (Marriot Salon 4) where I'll be showing the new Essbase Data control for ADF. Oh and Larry speaks in the afternoon of course (although not at my session)
  • Thursday I'll be in the Tools faceoff Session in the Marriot Nob Hill room @9am, followed by another bunch of analyst stuff.

Throughout the week I'll be twittering from the sessions, assuming we have connectivity. I've switched to the Twitteriffic client on the iPhone so we'll see how that goes. It would be cool if the location stuff works accurately indoors but I doubt it. See if you can track me.

Duncan's Hints and rules for the conference:

  1. Bring a power strip and share an outlet!
  2. Eating is for wimps - if you remember to have lunch you're not talking enough
  3. Given the choice of two sessions you'll pick the wrong one, so swap. Ah but then... oh nevermind
  4. Never ever "just go shopping instead" (OK you're allowed a single trip to the Apple Store to geek, but that's it Understand??)

Remember - I will demo for Coffee... See you there.

Using ORDIMAGE in R11

At the moment there seem to be a few glitches in ORDIMAGE support with JDeveloper 11 and some traffic on the forum. Just as a hint here's a snippet using af:media to display a image stored in an OrdImage attribute. note that I've had to expand the servlet reference out (that's the W/A for the current bug. Also if you've used this in 10.1.3, note that the expression for the Mime type is slightly different (excuse the wrapping in the source value):

<af:media source="/ordDeliverMedia?appModID=TuhraServiceDataControl&
                viewObjectName=TuhraService.AllImages1&
                contentCol=Image&
                rowKey=#{bindings.AllImages1Iterator.currentRowKeyString}"
           player="windows"
           autostart="true"
           contentType="#{bindings.Image.inputValue.mimeType}"/>

:: Next Page >>