Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WSO2 AS leverages a concept called runtime environments to separately maintain different runtimes for loading the relevant classes for your web applications. The WSO2 web application management feature provides the capability to load classes from different locations to your applications.

Info

From AS 5.3.0 onwards, JavaEE6 Web Profile support is available as a feature, which allows you to enable the Javaee runtime environment, in addition to TomcatCarbon and CXF runtime environments. With the Javaee runtime environment, you can now deploy Javaee web applications (that uses Apache TomEE) in WSO2 AS.

Most web applications that are deployed in production environments depend on external, third-party libraries for different functionality. Through the WSO2 Application Server's runtime environment, you can control class loading per server or application. The following runtimes that are available with WSO2 AS are sufficient for most users, but you can also define your own runtimes. There are four default runtime environments available in AS 5.3.0, which are as follows:

...

To configure class loading, you should add the class loading configuration in a file named webapp-classloading.xml and place it in the META-INF directory folder of a web application. All the This folder should be created inside the src/main/webapp folder of you web application. All the artifacts related to a web application are saved in the following directory: <PRODUCT_HOME>/repository/deployment/server/<Web_Application_Type>/<Web_Application_Name>. For example: <PRODUCT_HOME>/repository/deployment/server/webapps/SampleApp.

...

  • Shown below is the webapp-classloading.xml file configuration to specify CXF as the runtime environment:

    Code Block
    languagehtml/xml
    <Classloading xmlns="http://wso2.org/projects/as/classloading">
       <Environments>CXF</Environments>
    </Classloading>
  • Shown below is the configuration to specify 'Javaee' as the runtime environment. The support for Javaee is provided along with Apache TomEE. If you use the Javaee runtime, then TomEE should also be configured in AS as explained here.

    Code Block
    languagehtml/xml
    <Classloading xmlns="http://wso2.org/projects/as/classloading">
       <Environments>Javaee</Environments>
    </Classloading>
  • You might want to access some Carbon features in a CXF application. To achieve this, specify a comma-separated list of environments in in the webapp-classloading.xml file. The following example specifies both CXF and Carbon as the runtime environments:

    Code Block
    languagehtml/xml
    <Classloading xmlns="http://wso2.org/projects/as/classloading">
       <Environments>Spring,Carbon</Environments>
    </Classloading>

Configuring TomEE

The following configurations are required if the Javaee runtime is enabled for your AS as explained above. There are two Apache TomEE configurations:

  • Setting the default Tomee configurations: 

    1. Open the tomee.xml file located in the <AS_HOME>/repository/conf/tomee/ directory.

    2.  In this file, you can configure the Datasources, Resources etc. See the following example where the "myDerbyDatasource" datasource is configured as a resource.

      Code Block
      <Resource id="myDerbyDatasource" type="DataSource" classpath="/path/to/driver.jar">
       . . . .
      <Resource>
    3. See the documentation on Apache TomEE configurations for more examples on how to configure the tomee.xml file.

  • Setting the jvm system properties that will be used by TomEE:

    1. Open the system.properties file located in the <AS_HOME>/repository/conf/tomee/ directory. 

    2. Update the required properties. For a comprehensive list of system properties, see http://tomee.apache.org/properties-listing.html.

  • From AS 5.3.0 onwards, Java EE 6 Web Profile support is available as a feature, which allows you to enable the Javaee runtime environment, in addition to TomcatCarbon and CXF runtime environments. See the topic on enabling Java EE 6 Web Profile for step-by-step instructions on configuring the Java EE runtime.

Extending the runtime environments

...