Sunday, December 18, 2011

WebLogic SCA with WebLogic 12c and OEPE 12.1

Fusion Middleware Software like OSB or SOA Suite is not yet available on WebLogic 12c but this does not mean you can't develop SCA Applications. With the help of the Oracle Enterprise for Eclipse 12.1.1 ( OEPE ) we can build WebLogic SCA application and deploy it on WebLogic 12c. This allows you to write Java applications using POJOs and, through different protocols, expose components as SCA services and access other components via references. You do this using SCA semantics configured in a Spring application context. In SCA terms, a WebLogic Spring SCA application is a collection of POJOs plus a Spring SCA context file that wires the classes together with SCA services and references.

In this blogpost I will show you all the steps so you can try it yourself.

Before we start, we need to install WebLogic 12c, configure a new domain and startup the AdminServer.
The first step is to install the WebLogic SCA shared library and target it to the AdminServer.

Log in to the WebLogic Console and go to deployments windows.
Install this war  located at wlserver_12. 1\common\deployable-libraries\weblogic-sca-1.1.war as a shared library and target it to the AdminServer.

Next step is to download OEPE 12.1.1, extract it and create a new workspace.

In this workspace we need to create a new Dynamic Web Project.
Use wls 12 as Target runtime and also create an Ear project which will include the war.

Open the project options of your Dynamic Web Project and go to Project Facets.
Here we need to enable Oracle WebLogic SCA and Spring.
Click on Further configuration required.

Next step is to download the Spring library. Click on the download button and select Spring Framework 2.5.6 of Oracle.

Click on Next.

We need to add the WebLogic SCA Shared Library, this will be added to the weblogic.xml deployment descriptor of your Web Project.

You can open the weblogic.xml file of your Web project and in the Shared Libraries you should see the reference.

When you are in the Web Perspective then you can open the spring-context.xml in the beans section of the Spring Elements.

Or in the java perspective this is located in the jsca folder of the META-INF folder.

In the Spring-context.xml we will add some spring beans which have an EJB & Web Service SCA service and we also add some SCA references.

In this demo I will start with a SCA service with has a ws binding , this service has a target to a spring bean. This spring has a property to a SCA reference which an EJB binding.
The SCA reference calls a SCA Service which off course also has an EJB binding. The service target the next spring bean which the calls the last spring bean.

We start with the last spring bean and end with the first SCA service.
This the LoggerOutput class which just do a system out.
Because we want to expose the next spring bean as a SCA service we need to have an interface which we can use in the SCA service.
And now the implementation which calls the last spring bean LoggerOutput
Now we have everything to make our first SCA application. This is how the spring-context will look like.
This SCA service will be invoked in the second part of this blogpost where we will call this EJB from a web service. We can use the same ILoggerComponent interface for the SCA Service ( this time a web service ) and the SCA reference will call the already created EJB SCA service. We only need a new spring bean which pass on the message to the EJB. For this I use this LoggerPassThrough class.
Here is the total spring-context.xml
We are ready to deploy it and do a test run. Select your EAR project, right click and do run on Server.
Provide the details of your WebLogic 12c domain.

You can use soapUI to invoke the SCA Web Service http://localhost:7001/WebLogicSCA/LoggerService_Uri?WSDL
or invoke the SCA EJB Service
ILoggerComponent logEJB = (ILoggerComponent)context.lookup("LoggerService_EJB30_JNDI");

WebLogic also has an extension for WebLogic SCA , in the Console , go to the Preferences , Extensions and enable weblogic-sca-console.  You need to restart your WebLogic Server.

After this you can click on your SCA deployment and see your SCA Services and references.

Download the code at github


  1. Hi Edwin,

    Thanks for detailed instructions. After deploying, i am getting the following Error:

    Caused By: java.lang.ClassNotFoundException: weblogic.wsee.databinding.WsRuntime

    and in the weblogic sca console extension, i am seeing the following message:

    This is not a WebLogic SCA application or WebLogic SCA integration is not enabled.

    I checked multiple times, also copy pasted all xml files from your source repository to make sure my files are no different than your example.

    Using WLS

    Appreciate any clues.


    1. Here is the error stack:
      <User defined listen
      er failed: java.lang.NoClassDefFoun
      dError: Lweblogic/wsee/databinding/WsRuntime;.
      java.lang.NoClassDefFoundError: Lweblogic/wsee/databinding/WsRuntime;
      at java.lang.Class.getDeclaredFields0(Native Method)
      at java.lang.Class.privateGetDeclaredFields(
      at java.lang.Class.getDeclaredFields(
      at org.eclipse.persistence.jaxb.javamodel.reflection.JavaClassImpl.getDe
      Truncated. see log file for complete stacktrace
      Caused By: java.lang.ClassNotFoundException: weblogic.wsee.databinding.WsRuntime

      at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(Generic
      at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClass
      at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAw

      Truncated. see log file for complete stacktrace

    2. Hi,

      Did you deployed the shared library and add this as a reference in the weblogic.xml or weblogic-application.xml


    3. The web-service binding requires WebLogic Advanced Web Services feature; so this example won't work in a base WebLogic domain. You need to use the "WebLogic Advanced Web Services for JAX-WS Extension - [wlserver]" domain template to configure your domain.