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.
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 Tomcat, Carbon 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 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:
Shown below is the
webapp-classloading.xmlfile configuration to specify CXF as the runtime environment:
Code Block language html/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.xmlfile. The following example specifies both CXF and Carbon as the runtime environments:
Code Block language html/xml
<Classloading xmlns="http://wso2.org/projects/as/classloading"> <Environments>Spring,Carbon</Environments> </Classloading>
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
tomee.xmlfile located in the
In this file, you can configure the Datasources, Resources etc. See the following example where the "myDerbyDatasource" datasource is configured as a resource.
<Resource id="myDerbyDatasource" type="DataSource" classpath="/path/to/driver.jar"> . . . . <Resource>
See the documentation on Apache TomEE configurations for more examples on how to configure the
Setting the jvm system properties that will be used by TomEE
system.propertiesfile located in the
<AS_HOME>/repository/conf/tomee/directory. 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 Tomcat, Carbon 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