Configure JDeveloper 11g to work with Spring 2.5 and AOP

In a recent article I described the interaction between JavaServer Faces (1.2) and Spring Framework (2.5.x): I created a JDeveloper 11g web application that I ran on the integrated WebLogic Server 11g (10..3.2). In this article I will explain the configuration steps I had to go through for making JDeveloper and WebLogic run my simple JSF/Spring application.

1. Create a new generic JDeveloper application; set the project name and add the JSF library

2. Install the JDeveloper Spring extension through the Check for Updates facility under Help in the main menu

this downloads all Spring Framework libraries to your disk, creates the Spring Library in JDeveloper, adds the XSDs for Spring configuration files and adds the option create New Spring Bean Configuration to the New Gallery.

Configure JDeveloper 11g to work with Spring 2.5 and AOP

The Spring 2.5 library has become available after installing the Spring Extension:

Configure JDeveloper 11g to work with Spring 2.5 and AOP


3. Create a new Spring Context from the New Gallery under Business Tier, Spring 2.5.6

4. Edit the empty Spring context configuration:

I removed what was created and pasted in:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
       xsi:schemaLocation=" ">

Before I made this change, I seemed to run into SAX parse errors complaining about the fact that the beans element could not be found.

5. Copy spring.jar to WEB-INF/lib – as there was either no version of Spring on the integrated WebLogic Server at all or the version that was there did no match the one I had used

(before I added the spring.jar, I had deployment errors like:

Unable to find class ‘org.springframework.web.jsf.el.SpringBeanFacesELResolver’


6. Update weblogic.xml in order to have WebLogic Server prefer the JARs provided in the application’s WEB-INF/lib over any libraries pre-installed on WLS:

<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app xmlns:xsi=""


7. Modify web.xml to make it initialize the Spring bean context


8. Modfy faces-config.xml to ensure that EL expressions will also recognize Spring beans as ‘managed beans’

<faces-config version="1.2" xmlns="">

9. Create the class MyBean; configure the Spring Bean for that class

package nl.amis.simplejsf;

public class MyBean {

  public StringBuffer getProperty() {
    return new StringBuffer("HelloWorld");

Add a bean configuration based on MyBean to the file my-other-managed-beans.xml in WEB-INF

<bean id="someBean" class="nl.amis.simplejsf.MyBean"/

10. Create the class Gotcha, configure a Spring Bean for it

package nl.amis.simplejsf.aop;

public class Gotcha  {

  public void reverseResult(StringBuffer result) {
     System.out.println("Original Return Value "+result);

Add bean configuration in my-other-managed-beans.xml:

<bean id="gotchaBean" class="nl.amis.simplejsf.aop.Gotcha"/>

11. Configure AOP: the after-returning advise on any method on any class that returns a StringBuffer result, based on the Gotcha class’s reverse method

  <!-- proxy-target-class forces the use of CGLIB proxies, which allows proxying classes in addition to interfaces.-->
  <aop:config proxy-target-class="true">
    <aop:pointcut id="someBeanPc" expression="bean(someBean)"/>
    <aop:aspect id="upperCaserAspect" ref="gotchaBean">
      <aop:after-returning pointcut="execution(java.lang.StringBuffer *(..))"
                           method="reverseResult" returning="result"

Note: in order to be able to successfullt use the aop namespace prefix, also modify the beans root element to:

<beans xmlns=""

10. In order to use these AOP facilities, we need to add the AspectJ library to the application

Download AspectJ from and download aspectj-1.6.6.jar (or whatever is the latest release at this moment).

Extract the file aspectjweaver.jar from the aspectj.jar that was downloaded, and copy it to WEB-INF/lib.

11. AspectJ has a dependency on CGLib (at least under special circumstances: this is necessary to proxy classes, rather than interfaces. CGLIB is used by default if a business object does not implement an interface. )

I first downloaded cglib.jar from and copied it to WEB-INF/lib. It turned out CGLib has its own dependenies when I tried to run the application:

java.lang.ClassNotFoundException: org.objectweb.asm.Type

There is a CGLib jar without dependencies, so I downloaded that one: cglib-nodeps.jar and added it to WEB-INF/lib. Then I removed cglib.jar.

12. Create simple JSF page with reference to someBean:

<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="" version="2.1"
  <jsp:output omit-xml-declaration="true" doctype-root-element="HTML" doctype-system="" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
  < contentType="text/html;charset=windows-1252"/>
        <meta http-equiv="Content-Type"
              content="text/html; charset=windows-1252"/>
          <h:outputText value="#{}"/>

13. Run the application on the integrated WebLogic Server.

Configure JDeveloper 11g to work with Spring 2.5 and AOP


Download – the entire JDeveloper 11g application with the required JARs.

Spring Framework Documentation:

AspectJ project site:

CGLib project site :

One Response

  1. Ashwin Almeida March 2, 2011