9 Deploying WebLogic Spring SCA Applications

This chapter tells how to deploy WebLogic Spring SCA applications to Oracle WebLogic Server:

Note:

Support for using WebLogic Spring SCA applications as components in SCA composites is available as a Technical Preview in the current release of Oracle SOA Suite. However, documentation for that feature is not yet available in Oracle SOA Suite.

Preparing Deployment Units

WebLogic SCA Runtime supports Enterprise Archive (EAR) and Web Archive (WAR) formats as deployment units.

A typical WebLogic SCA application bundles the Spring application context file in the META-INF/jsca/ directory, along with the application's POJO classes.

The organization of a sample WebLogic Spring SCA application EAR archive is shown in Example 9-1:

Example 9-1 Sample WebLogic Spring SCA application EAR

META-INF/application.xml
META-INF/weblogic-application.xml
META-INF/jsca/spring-context.xml
MyEJBApp.jar
MyWebApp.war
APP-INF/lib/MyScaClasses.jar
            META-INF/jsca/spring-context.xml
APP-INF/classes/MyScaPojo.class

The organization of a sample WebLogic Spring SCA application WAR archive is shown in Example 9-2:

Example 9-2 Sample WebLogic Spring SCA application WAR

WEB-INF/web.xml
WEB-INF/weblogic.xml
WEB-INF/lib/MyScaClasses.jar
            META-INF/jsca/spring-context.xml
            MyScaPojo1.class
            MyScaPojo2.class

Configuring the Deployment Descriptor

You must add a <library-ref> element to the deployment descriptor for a application.

When referring to a shared Web application library, you can also add an optional <context-root> element to declare the context root of the library module. This ensures that the context root is set to the configured value and will not conflict with other WebLogic SCA applications deployed on the same server and referring to the same shared library.

Note:

Oracle recommends that you provide a unique <context-root> for each WebLogic Spring SCA application. When multiple applications are deployed into a single server or a cluster, each application has its own library reference to weblogic-sca-1.0.war. Not specifying different context roots for each application will result in a context root conflict, because every WebLogic SCA application uses the default context root specified in weblogic-sca-1.0.war.

Example 9-3 shows an example of <library-ref> and <context-root> in an EAR's weblogic-application.xml descriptor, and Example 9-4 shows an example of <library-ref> and <context-root> in a WAR's weblogic.xml descriptor.

Example 9-3 library-ref Element in weblogic-application.xml

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
  <library-ref>
  <library-name>weblogic-sca</library-name>
    <context-root>weblogic-sca-ctx-root1</context-root>
  </library-ref>
</weblogic-application>

Example 9-4 library-ref Element in weblogic.xml

<?xml version="1.0" encoding="UTF-8859-1"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
  <library-ref>
  <library-name>weblogic-sca</library-name>
    <context-root>weblogic-sca-ctx-root1</context-root>
  </library-ref>
</weblogic-application>

Bundling Libraries

WebLogic Spring SCA applications must bundle spring.jar under APP-INF/lib for EARs and under WEB-INF/lib for WARs). Spring has a dependency on commons-logging, therefore, that jar must also be bundled with the application.

WebLogic SCA supports Spring 2.0.6 or later. Spring 2.5.3 is recommended.

Deploying in a Cluster

A WebLogic Spring SCA application can be deployed in a homogenous clustered environment. Cluster deployment deploys the application to every node, and since most request processing is stateless (stateful ones use the database for storing their state), a load balancer or a plug-in can route the request to any node.

Deploying WebLogic Spring SCA Applications Using Other Tools

You can also deploy WebLogic Spring SCA applications in standalone WebLogic Server using Oracle Enterprise Pack for Eclipse (OEPE) and Oracle JDeveloper. See Chapter 3, "Tools Support," for more about WebLogic SCA support in those tools.

Runtime

When a WebLogic Spring SCA application is deployed, its services are exposed by the appropriate binding component implementations. For a service defined with binding.ws, the Web Service binding component implementation publishes a Web Services endpoint. For a service defined with binding.ejb, the EJB binding component makes the EJB available in JNDI.

If multiple Spring application context files are used during a deploy within the same application, WebLogic SCA Runtime wires the matching services and references, ignoring the bindings for internal wiring. This requires use of the optional default attribute in an sca:reference element. See sca:reference Element, for more information.

Note:

A WebLogic Spring SCA application with two or more Spring application context files can be nested into other composites only in Oracle SOA, since this requires an enclosing SCDL file.