WebLogic + OEPE + Maven + Primefaces 2.2RC

Markus Eisele
The new WebLogic is there since a few days and we are right in front of another new release of another component: Primefaces 2.2 has RC state at the moment and we are all waiting for a final release happening hopefully the next time. If you are willing to give the existing RC a test drive you can follow this short blog in which I try to shortly summarize the steps necessary to take to get one of my favorite development setups up an running with WebLogic and Primefaces.

What you need
You need the latest WebLogic, Maven 3.0 and Primefaces 2.2RC. The first two get installed by the WebLogic installer and you can head over to install the m2eclipse plugin next. You also should install m2eclipse Extras which makes live a lot easier if you are working with web apps and maven. Everything is finished by restarting the OEPE. Now go and grep Apache Maven and install it to a location of your choice.

Creating and configuring your project
Fire up the OEPE. Go to preferences and add your Maven installation to the configured Maven / Installations. Right click "New > Other", select "Maven > Maven Project". Click "Next >". Select the "org.apache.maven.archetypes.maven-archetype-webapp". Click "Next". Enter a valid Group Id, Artifact Id and a package. Click "Finish". You now have a Dynamic Webproject in your Workspace (thanks to m2eclipse Extras). Open the pom and add two repositories:

<name>Prime Technology Maven Repository</name>
<name>Java.net Repository for Maven</name>

After that you have to add the following two dependencies:

Done with maven. Next is to configure the webapplication. Oben the WEB-INF/web.xml and add the jsf servlet:

<servlet-name>Faces Servlet</servlet-name>
<servlet-name>Faces Servlet</servlet-name>

Now create a WEB-INF/weblogic.xml and add the JSF 2.0 library references to your project.


Creating and configuring your WebLogic Domain
Go ahead and configure your local WebLogic Server instance with OEPE. Goto "Server View" and select "New". Select the Oracle WebLogic Server 11gR1 PatchSet 3 server adapter and select or add a Server runtime environment. Click "Next >". Select an existing or create a new Domain Directory. Right click the server entry and "Start" the server. Visit http://localhost:7001/console, select "Deployments > Install". Navigate to WL_HOME/wlserver_10.3/common/deployable-libraries and select the jsf-2.0.war. Click "Next". Accept the "Install this deployment as a library" selection and click "Next". review the settings (nothing to do here for us today) and click "Finish". Now you should see a jsf(2.0, deployed on your instance. Fine. Done.

Writing some code
Create an index.xhtml file in your WebContent folder and add some functionality:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
<title>Facelet Title</title>
<p:panel header="Hello From">
<p:button outcome="test" value="Next"/>

Fine. Don't forget to add another page called test.xhtml with some more content, if you are copying this example :)
Now build and install your application. If you are using the WebLogic Maven Plug-In for Deployment simply type mvn weblogic:deploy to get your primefaces app up and running (or better use m2eclipse ;) and define a new Run as... target).
And that's what the nice stuff is looking like:

What's left?
If you are running without any further changes, you probably see some warnings in your logfiles about missing mime-types like the following.
<Notice> <StdErr> <BEA-000000>: com.sun.faces.context.ExternalContextImpl getMimeType
WARNING: JSF1091: No mime type could be found for file skins/sam/images/ui-default.png. To
resolve this, add a mime-type mapping to the applications web.xml.

In order to avoid this, you have to add the mime type mapping to your web.xml configuration.


Thats's all. Now your are running the latest Primefaces 2.2RC on you JSF 2.0 based WebLogic Server. Congratulations!
For those of you, interested: Here is the complete primefaces.zip (4KB) with the configuration. Have fun ...

Post a Comment


  1. I wonder, if Primefaces may become RI for the next JSF release? (likely 2.1) especially after Apache Foundation has left the JCP to a large extent.

  2. Hi Werner,

    thanks for the comment. I can't speak for Cagatay but I expect them to not invest into another RI. Even if Apache left the JCP they will stick to MyFaces, at last for the near future and the Mojarra is there and will be there.


  3. I cant create this example. The file web.xml does not exists (maven not create it).

  4. @Jassa:

    Try generating the archetype from the cmd line:
    mvn archetype:generate
    - select 110
    - select 5
    - enter properties (groupid, artifactiId) of your choice
    - enter Y

    And look at artifactiId\src\main\webapp\WEB-INF\ there you can find your web.xml


  5. Hi Markus

    I presume that the steps are same for primefaces 3.1 with WLS 10.3.4.

  6. Another question I have is do I need to have the following jars inside WEB-INF/lib folder?


  7. Hi Jacob,

    not exactly. you need to use the JSF 2.0 shared library (jsf-2.0.war).


  8. Again hi Jacob,

    you only need the primefaces-3.1 dependency (which in fact is packaged by maven to your WEB-INF/lib directory). So, you don't have to add nothing else. Let maven do the work and keep the fingers away from the js*.jars. They are contained with the shared library.


  9. Hi
    Could you be kind enough to suggest how to create new Run as target using m2eclipse?


  10. Hi Jacob,

    please look here: http://kb.sonatype.org/entries/20900471.html


Post a Comment