Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Application Server provides support for three Java EE web profile based specifications, which are namely Java Server Faces (JSF), Java Persistence API (JPA) and Java Transaction API (JTA).

JTA comes as an out-of-the box feature by inheriting the transaction management capabilities of the Carbon platform; while, JSF and JPA come as an additional feature that can be installed from the online Carbon p2 repository.

Name: WSO2 Carbon - J2EE Runtime Environment
Identifierorg.wso2.carbon.as.runtimes.j2ee.feature

If this feature is not bundled with the WSO2 product by default, you can install it using the instructions provided in the Feature Management section. 

J2EE (Java EE) class loading environments

Installation of the J2EE (Java EE) feature will create a directory named j2ee containing the required libraries for JSF and JPA  at the <PRODUCT_HOME>/lib/runtimes/library and update the <PRODUCT_HOME>/repository/conf/tomcat/webapp-classloading-environments.xml file by adding the new J2EE classloading environment.

Before proceeding any further with this documentation, we highly recommend that you go through the Webapp ClassLoading  section, to learn more on the Web App class loading environments.

Java Server Faces support

WSO2 Application Server uses Apache MyFaces as the JSF reference implementation. JSF based web applications can run on the libraries provided by the J2EE class loading environment, by adding the following entries to the
webapp-classloading.xml file of the JSF based web application.

<Classloading xmlns="http://wso2.org/projects/as/classloading">
   <Environments>J2EE</Environments>
</Classloading>

Java Persistence API support

WSO2 Application Server uses Apache OpenJPA as the persistence provider. Web applications can use the OpenJPA libraries provided by the J2EE class loading environment, by adding the following entries to the
webapp-classloading.xml file of the web application.

<Classloading xmlns="http://wso2.org/projects/as/classloading">
   <Environments>J2EE</Environments>
</Classloading>

For more information Apache OpenJPA, go to  http://openjpa.apache.org/builds/2.2.2/apache-openjpa/docs/main.html

Java Transaction API support

As mentioned earlier, JTA support for web applications is inherited from the Carbon platform; therefore, there is no need of installing the J2EE feature in this case.

Web applications that run on the Carbon class loading environment can have JTA facilities provided by the Carbon platform.

By default, the Carbon class loading environment is available for all web applications. However, if you put a webapp-classloading.xml file inside the META-INF folder, you will override the default settings and only the classloading environments defined in that XML file are exposed to the web application. As a result, make sure to put the Carbon classloading environment along with the other classloading environments inside the
META-INF/webapp-classloading.xml file.

For an example, if you want to use JTA with a CXF web application:

<Classloading xmlns="http://wso2.org/projects/as/classloading">
  <Environments>Carbon,CXF</Environments>
</Classloading>

WSO2 Carbon platform provides the javax.transaction.UserTransaction and the javax.transaction.TransactionManager object references as JNDI resources.

Web Applications can access them as mentioned below:

InitialContext initCtx = new InitialContext();
TransactionManager transactionManager = (TransactionManager) initCtx.lookup("java:comp/TransactionManager");
InitialContext initCtx = new InitialContext();
UserTransaction userTransaction= (UserTransaction) initCtx.lookup("java:comp/UserTransaction");
  • No labels