You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2011/07/10 07:36:21 UTC
svn commit: r1144778 [12/13] - /openejb/site/trunk/content/
Added: openejb/site/trunk/content/testing-transactions-example.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/testing-transactions-example.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/testing-transactions-example.cwiki (added)
+++ openejb/site/trunk/content/testing-transactions-example.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,79 @@
+h1. Overview
+
+Testing an EntityManager that uses the default, PersistenceContextType.TRANSACTION, can be challenging due to Entities detaching around transaction boundaries. If you were to take the [Injection of EntityManager Example] which uses an EXTENDED persistence context and switch it to a TRANSACTION persistence context making no other changes, you'd find that the test would fail. This would be because of the detach.
+
+Generally, when using an EntityManager with TRANSACTION persistence context, your transaction should surround your use of the Entities themselves, not just the use of the EntityManager. Using a [transaction in your unit test|Unit Testing Transactions] can make testing these scenarios possible.
+
+This example shows use of @PersistenceContext to have an *EntityManager* with an *TRANSACTION* persistence context injected into a *@Stateful* bean using the *@TransactionAttribute* annotation and a TestCase that runs test code in a JTA *Transaction*. An EJB 3 @Entity bean is used with the EntityManager to create, persist and merge data to a database.
+
+_The source for this example is in the "testing-transactions" directory located in the [openejb-examples.zip|OPENEJB:Download] available on the download page._
+
+h1. The Code
+
+{snippet:id=code|url=openejb3/examples/testing-transactions/src/main/java/org/superbiz/injection/tx/MoviesImpl.java|lang=java}
+
+In the above bean code we see that the transaction attribute for all method of the bean has been changed the default, which is TransactionAttributeType.REQUIRED, to TransactionAttributeType.MANDATORY. The MANDATORY transaction attribute is similar to REQUIRED in that the bean method is guaranteed to be executed in a transaction, but with the added restriction that if a transaction isn't started by the client before calling the method, an exception will be thrown.
+
+The benefit of MANDATORY in this example is that it is impossible for the client to get detached Entity issues. The client either has a transaction and therefore gets Entities which are still attached and persistent, or the client would get an exception stating that the use of a transaction is mandatory.
+
+See the [Transaction Annotations] page for a full description of the available transaction attributes.
+
+h1. Writing a unit test for the example
+
+The magic in the TestCase below is the *TransactionBean* @Stateless bean which is tucked away as an inner class of the TestCase itself. With this bean, we can call our test code within the scope of a container controlled transaction. This allows our test code to use the EntityManager and the Entities in the scope of a transaction, avoid any detach issues and satisfying the TransactionAttributeType.MANDATORY requirement of our MoviesImpl @Stateful bean.
+
+{snippet:id=code|url=openejb3/examples/testing-transactions/src/test/java/org/superbiz/injection/tx/MoviesTest.java|lang=java}
+
+Curious on the InitialContext parameters used? See the [Injection of DataSource Example] for an explanation of how any Resource can be configured via properties in the TestCase itself or via an openejb.xml file.
+
+h1. Running
+
+Running the example is fairly simple. In the "testing-transactions" directory of the [examples zip|OPENEJB:Download], just run:
+
+$ mvn clean install
+
+Which should create output like the following.
+
+{noformat}
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running org.superbiz.injection.tx.MoviesTest
+Apache OpenEJB 3.0 build: 20080408-04:13
+http://openejb.apache.org/
+INFO - openejb.home = /Users/dblevins/work/openejb-3.0/examples/testing-transactions
+INFO - openejb.base = /Users/dblevins/work/openejb-3.0/examples/testing-transactions
+INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
+INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
+INFO - Configuring Service(id=movieDatabaseUnmanaged, type=Resource, provider-id=Default JDBC Database)
+INFO - Configuring Service(id=movieDatabase, type=Resource, provider-id=Default JDBC Database)
+INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
+INFO - Found EjbModule in classpath: /Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes
+INFO - Found EjbModule in classpath: /Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes
+INFO - Configuring app: /Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes
+INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
+INFO - Auto-creating a container for bean TransactionBean: Container(type=STATELESS, id=Default Stateless Container)
+INFO - Loaded Module: /Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes
+INFO - Configuring app: /Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes
+INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
+INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL, id=Default Stateful Container)
+INFO - Configuring PersistenceUnit(name=movie-unit)
+INFO - Loaded Module: /Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes
+INFO - Assembling app: /Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes
+INFO - Jndi(name=TransactionBeanLocal) --> Ejb(deployment-id=TransactionBean)
+INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean, container=Default Stateless Container)
+INFO - Deployed Application(path=/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes)
+INFO - Assembling app: /Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes
+INFO - PersistenceUnit(name=movie-unit, provider=org.apache.openjpa.persistence.PersistenceProviderImpl)
+ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which
+ requires a JavaAgent. See http://openejb.apache.org/3.0/javaagent.html
+INFO - Jndi(name=MoviesLocal) --> Ejb(deployment-id=Movies)
+INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful Container)
+INFO - Deployed Application(path=/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes)
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.25 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+{noformat}
+
Propchange: openejb/site/trunk/content/testing-transactions-example.cwiki
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/site/trunk/content/testing-transactions-example.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/testing-transactions-example.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/testing-transactions-example.mdtext (added)
+++ openejb/site/trunk/content/testing-transactions-example.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,146 @@
+Title: Testing Transactions Example
+<a name="TestingTransactionsExample-Overview"></a>
+# Overview
+
+Testing an EntityManager that uses the default,
+PersistenceContextType.TRANSACTION, can be challenging due to Entities
+detaching around transaction boundaries. If you were to take the [Injection of EntityManager Example](injection-of-entitymanager-example.html)
+ which uses an EXTENDED persistence context and switch it to a TRANSACTION
+persistence context making no other changes, you'd find that the test would
+fail. This would be because of the detach.
+
+Generally, when using an EntityManager with TRANSACTION persistence
+context, your transaction should surround your use of the Entities
+themselves, not just the use of the EntityManager. Using a [transaction in your unit test](unit-testing-transactions.html)
+ can make testing these scenarios possible.
+
+This example shows use of @PersistenceContext to have an *EntityManager*
+with an *TRANSACTION* persistence context injected into a *@Stateful* bean
+using the *@TransactionAttribute* annotation and a TestCase that runs test
+code in a JTA *Transaction*. An EJB 3 @Entity bean is used with the
+EntityManager to create, persist and merge data to a database.
+
+_The source for this example is in the "testing-transactions" directory
+located in the [openejb-examples.zip](openejb:download.html)
+ available on the download page._
+
+<a name="TestingTransactionsExample-TheCode"></a>
+# The Code
+
+{snippet:id=code|url=openejb3/examples/testing-transactions/src/main/java/org/superbiz/injection/tx/MoviesImpl.java|lang=java}
+
+In the above bean code we see that the transaction attribute for all method
+of the bean has been changed the default, which is
+TransactionAttributeType.REQUIRED, to TransactionAttributeType.MANDATORY.
+The MANDATORY transaction attribute is similar to REQUIRED in that the bean
+method is guaranteed to be executed in a transaction, but with the added
+restriction that if a transaction isn't started by the client before
+calling the method, an exception will be thrown.
+
+The benefit of MANDATORY in this example is that it is impossible for the
+client to get detached Entity issues. The client either has a transaction
+and therefore gets Entities which are still attached and persistent, or the
+client would get an exception stating that the use of a transaction is
+mandatory.
+
+See the [Transaction Annotations](transaction-annotations.html)
+ page for a full description of the available transaction attributes.
+
+<a name="TestingTransactionsExample-Writingaunittestfortheexample"></a>
+# Writing a unit test for the example
+
+The magic in the TestCase below is the *TransactionBean* @Stateless bean
+which is tucked away as an inner class of the TestCase itself. With this
+bean, we can call our test code within the scope of a container controlled
+transaction. This allows our test code to use the EntityManager and the
+Entities in the scope of a transaction, avoid any detach issues and
+satisfying the TransactionAttributeType.MANDATORY requirement of our
+MoviesImpl @Stateful bean.
+
+{snippet:id=code|url=openejb3/examples/testing-transactions/src/test/java/org/superbiz/injection/tx/MoviesTest.java|lang=java}
+
+Curious on the InitialContext parameters used? See the [Injection of DataSource Example](injection-of-datasource-example.html)
+ for an explanation of how any Resource can be configured via properties in
+the TestCase itself or via an openejb.xml file.
+
+<a name="TestingTransactionsExample-Running"></a>
+# Running
+
+Running the example is fairly simple. In the "testing-transactions"
+directory of the [examples zip](openejb:download.html)
+, just run:
+
+$ mvn clean install
+
+Which should create output like the following.
+
+
+ -------------------------------------------------------
+ T E S T S
+ -------------------------------------------------------
+ Running org.superbiz.injection.tx.MoviesTest
+ Apache OpenEJB 3.0 build: 20080408-04:13
+ http://openejb.apache.org/
+ INFO - openejb.home =
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions
+ INFO - openejb.base =
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions
+ INFO - Configuring Service(id=Default Security Service,
+type=SecurityService, provider-id=Default Security Service)
+ INFO - Configuring Service(id=Default Transaction Manager,
+type=TransactionManager, provider-id=Default Transaction Manager)
+ INFO - Configuring Service(id=movieDatabaseUnmanaged, type=Resource,
+provider-id=Default JDBC Database)
+ INFO - Configuring Service(id=movieDatabase, type=Resource,
+provider-id=Default JDBC Database)
+ INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory,
+type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
+ INFO - Found EjbModule in classpath:
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes
+ INFO - Found EjbModule in classpath:
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes
+ INFO - Configuring app:
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes
+ INFO - Configuring Service(id=Default Stateless Container, type=Container,
+provider-id=Default Stateless Container)
+ INFO - Auto-creating a container for bean TransactionBean:
+Container(type=STATELESS, id=Default Stateless Container)
+ INFO - Loaded Module:
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes
+ INFO - Configuring app:
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes
+ INFO - Configuring Service(id=Default Stateful Container, type=Container,
+provider-id=Default Stateful Container)
+ INFO - Auto-creating a container for bean Movies: Container(type=STATEFUL,
+id=Default Stateful Container)
+ INFO - Configuring PersistenceUnit(name=movie-unit)
+ INFO - Loaded Module:
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes
+ INFO - Assembling app:
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes
+ INFO - Jndi(name=TransactionBeanLocal) -->
+Ejb(deployment-id=TransactionBean)
+ INFO - Created Ejb(deployment-id=TransactionBean, ejb-name=TransactionBean,
+container=Default Stateless Container)
+ INFO - Deployed
+Application(path=/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/test-classes)
+ INFO - Assembling app:
+/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes
+ INFO - PersistenceUnit(name=movie-unit,
+provider=org.apache.openjpa.persistence.PersistenceProviderImpl)
+ ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested
+installation of a ClassFileTransformer which
+ requires a JavaAgent. See
+http://openejb.apache.org/3.0/javaagent.html
+ INFO - Jndi(name=MoviesLocal) --> Ejb(deployment-id=Movies)
+ INFO - Created Ejb(deployment-id=Movies, ejb-name=Movies, container=Default
+Stateful Container)
+ INFO - Deployed
+Application(path=/Users/dblevins/work/openejb-3.0/examples/testing-transactions/target/classes)
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.25 sec
+
+ Results :
+
+ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+
Added: openejb/site/trunk/content/tomcat-detailed-instructions.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat-detailed-instructions.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/tomcat-detailed-instructions.cwiki (added)
+++ openejb/site/trunk/content/tomcat-detailed-instructions.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,259 @@
+{composition-setup}
+
+h1. {anchor:detailed instructions} Detailed Installation Instructions
+
+These instructions assume you have a standard Tomcat installation running on port 8080. If you do not have an existing Tomcat installation, or want to start with a fresh installation for OpenEJB, the [Tomcat Installation] will show you how to setup and verify a Tomcat installation.
+
+h2. Add openejb.war to Tomcat
+
+The OpenEJB plugin for Tomcat is distributed as a standalone war file containing all of the necessary files and an installer Servlet. The war can be obtained from the [OpenEJB download page|OPENEJB:download]. Once downloaded, simply copy the file into the Tomcat webapps directory.
+
+{deck:id=Copy openejb.war}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>copy openejb.war apache-tomcat-6.0.14\webapps\openejb.war
+ 1 file(s) copied.
+
+C:\>dir apache-tomcat-6.0.14\webapps
+ Volume in drive C has no label.
+ Volume Serial Number is 0000-0000
+
+ Directory of C:\apache-tomcat-6.0.14\webapps
+
+09/20/2007 03:03 PM <DIR> .
+09/20/2007 03:03 PM <DIR> ..
+09/20/2007 03:02 PM <DIR> docs
+09/20/2007 03:01 PM <DIR> examples
+09/20/2007 03:01 PM <DIR> host-manager
+09/20/2007 03:03 PM <DIR> manager
+09/19/2007 09:31 AM 13,394,733 openejb.war
+09/20/2007 03:01 PM <DIR> ROOT
+ 1 File(s) 13,394,733 bytes
+ 7 Dir(s) 5,100,126,208 bytes free
+{noformat}{card}
+{card:label=Unix}{noformat:nopanel=true}
+$ cp openejb.war apache-tomcat-6.0.14/webapps/openejb.war
+
+$ ls apache-tomcat-6.0.14/webapps/
+ROOT/ docs/ examples/ host-manager/ manager/ openejb.war
+{noformat}{card}
+{deck}
+
+h2. Run Installer Servlet
+
+The OpenEJB Plugin for Tomcat contains an installer servlet which adds the OpenEJB listener and JavaAgent to the Tomcat installation. To run the installer, you must first start Tomcat.
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>set JRE_HOME=C:\Program Files\Java\jre1.5.0_06
+
+C:\>cd apache-tomcat-6.0.14\bin
+
+C:\apache-tomcat-6.0.14\bin>startup.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+{noformat}{card}
+{card:label=Unix}{noformat:nopanel=true}
+$ cd apache-tomcat-6.0.14/bin
+
+apache-tomcat-6.0.14/bin$ chmod u+x *.sh
+
+apache-tomcat-6.0.14/bin$ ./startup.sh
+Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+Using JRE_HOME: /your/java/installation
+{noformat}{card}
+{deck}
+
+*NOTE:* Your output will be different from the example above due to differences in installation locations.
+
+It is a good idea to wait a 5-60 seconds (depending on the speed of your computer) for Tomcat to fully start. Once Tomcat is fully started, simply visit [http://localhost:8080/openejb/installer] and click the 'install' button to run the installer. The installer should report that the installation was successful. If it didn't work click [OPENEJB:here|#problems].
+
+{warning}
+The installer servlet adds the OpenEJB JavaAgent declaration to the catalina.sh and catalina.bat files. If you are using an IDE or some other mechanism to start Tomcat, you will need to [manually|Manual Installation#javaagent] add the JavaAgent declaration to the Java VM options of the launcher you are using.
+{warning}
+
+h2. Restart Tomcat
+
+OpenEJB uses OpenJPA for persistence and OpenJPA currently requires a JavaAgent to function. Unfortunately, there is no way to install a JavaAgent at runtime, so you will have to restart Tomcat to enable the JavaAgent. Simply execute the shutdown command, wait 5-60 seconds (depending on the speed of your computer) for Tomcat to fully stop, and run the startup command to restart Tomcat.
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>cd apache-tomcat-6.0.14\bin
+
+C:\apache-tomcat-6.0.14\bin>shutdown.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+
+C:\apache-tomcat-6.0.14\bin>startup.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+{noformat}{card}
+{card:label=Unix}{noformat:nopanel=true}
+$ cd apache-tomcat-6.0.14/bin
+
+apache-tomcat-6.0.14/bin$ ./shutdown.sh
+Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+Using JRE_HOME: /your/java/installation
+
+apache-tomcat-6.0.14/bin$ ./startup.sh
+Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+Using JRE_HOME: /your/java/installation
+{noformat}{card}
+{deck}
+
+*NOTE:* Your output will be different from the example above due to differences in installation locations.
+
+Once Tomcat is fully started, simply visit [http://localhost:8080/openejb/installer] to verify the installation is complete.
+
+h1. Examples, Tutorials and Tests
+
+h2. ejb-examples.war
+
+Download the [ejb-examples.war|http://people.apache.org/~dain/openejb-temp/examples], copy it into the Tomcat webapps directory, and visit [http://localhost:8080/ejb-examples].
+
+h2. OpenEJB iTests
+
+OpenEJB uses a large test suite to verify the final server assembly, and you can use this to verify your OpenEJB installation. Simply download the [openejb-itests.war and openejb-standalone-client.jar|http://people.apache.org/~dain/openejb-temp/itests] and copy it the war into the Tomcat webapps directory. It will take a bit to load the application because it contains a huge number of EJBs. Finally, run the test client executable jar.
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>java -jar openejb-itests-standalone-client.jar tomcat
+_________________________________________________
+|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
+
+Running EJB compliance tests on HTTP/Tomcat Server
+_________________________________________________
+WARNING: No test suite configuration file specified, assuming system properties contain all
+needed information. To specify a test suite configuration file by setting its location using
+the system property "openejb.testsuite.properties"
+test server = org.apache.openejb.test.TomcatRemoteTestServer
+entry = java.naming.provider.url:http://127.0.0.1:8080/openejb/ejb
+entry = java.naming.factory.initial:org.apache.openejb.client.RemoteInitialContextFactory
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+............................
+Time: 20.644
+
+OK (889 tests)
+
+
+_________________________________________________
+CLIENT JNDI PROPERTIES
+java.naming.provider.url = http://127.0.0.1:8080/openejb/ejb
+java.naming.factory.initial = org.apache.openejb.client.RemoteInitialContextFactory
+_________________________________________________
+{noformat}{card}
+{card:label=Unix}{noformat:nopanel=true}
+$ java -jar openejb-itests-standalone-client.jar tomcat
+_________________________________________________
+|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
+
+Running EJB compliance tests on HTTP/Tomcat Server
+_________________________________________________
+WARNING: No test suite configuration file specified, assuming system properties contain all
+needed information. To specify a test suite configuration file by setting its location using
+the system property "openejb.testsuite.properties"
+test server = org.apache.openejb.test.TomcatRemoteTestServer
+entry = java.naming.provider.url:http://127.0.0.1:8080/openejb/ejb
+entry = java.naming.factory.initial:org.apache.openejb.client.RemoteInitialContextFactory
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+............................
+Time: 12.186
+
+OK (889 tests)
+
+
+_________________________________________________
+CLIENT JNDI PROPERTIES
+java.naming.provider.url = http://127.0.0.1:8080/openejb/ejb
+java.naming.factory.initial = org.apache.openejb.client.RemoteInitialContextFactory
+_________________________________________________
+{noformat}{card}
+{deck}
+
+{tip:title=Failures}The tests should completely pass the first time they are run. If you execute the test client a second time, 21 tests fail for some unknown reason.{tip}
+
+h1. {anchor:problems} Problems?
+
+h2. HTTP Status 403
+
+Did you get a "HTTP Status 403" error page containing the description "Access to the specified resource () has been forbidden." when visiting [http://localhost:8080/openejb]?
+
+The openejb.war is protected by a Tomcat valve that restricts access to the application to the computer on which Tomcat is running. If your browser is running on the same computer as Tomcat, try accessing OpenEJB using this link instead [http://127.0.0.1:8080/openejb].
+
+If you want to access the openejb.war from another computer, you will need to either remove the valve, or modify the IP list in the valve declaration. The easiest way to remove the valve it to simply delete the webapps/openejb/META-INF/context.xml file and and the webapps/openejb.war file *while Tomcat is stopped*. The openejb.war file must be removed because some versions of Tomcat will use the context.xml file packed in the openejb.war file regardless of what is in the unpacked directory.
+
+h2. Other Issues
+
+If you are having problems with the installation, please send a message to the OpenEJB users [mailing list|OPENEJB:mailing lists] containing any error message(s) and the following information:
+
+* OpenEJB Version
+* Tomcat Version
+* Java Version (execute java -version)
+* Operating System Type and Version
+
+
+h1. Limitations
+
+ *Tomcat 6.x* - Currently, only Tomcat 6.x is supported due to API difference between 5.5.x and 6.x. It is expected that 5.5 will be supported in the future, but there are no plans to support 5.0.x due to the lack of annotation support in 5.0.x.
+
+ *Security* - Unfortunately, at this time security with Tomcat/OpenEJB is not integrated, but is being worked on.
+
+ *EAR Files* - The integration only supports war (and collapsed-ear) files. EAR, EJB Jar, and RAR files will be supported in a future release.
+
+ *JavaAgent* - OpenEJB uses OpenJPA to provide JPA and CMP persistence, and OpenJPA currently requires a JavaAgent to function properly. This requirement is something that the OpenJPA project is working on removing. Once removed, the OpenEJB plugin for Tomcat will no longer need to modify the startup shell scripts and you will not need to restart Tomcat after the OpenEJB installation.
+
+h1. Misc
+
+This document is a starting point for using OpenEJB in Tomcat and will evolve based on user contributions. If you wish to contribute to this document, feel very welcome to click the 'Edit' link in the upper right and make changes and add new HOWTO's and other docs.
+
Propchange: openejb/site/trunk/content/tomcat-detailed-instructions.cwiki
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/site/trunk/content/tomcat-detailed-instructions.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat-detailed-instructions.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/tomcat-detailed-instructions.mdtext (added)
+++ openejb/site/trunk/content/tomcat-detailed-instructions.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,343 @@
+Title: Tomcat Detailed Instructions
+{composition-setup}
+
+<a name="TomcatDetailedInstructions-{anchor:detailedinstructions}DetailedInstallationInstructions"></a>
+# {anchor:detailed instructions} Detailed Installation Instructions
+
+These instructions assume you have a standard Tomcat installation running
+on port 8080. If you do not have an existing Tomcat installation, or want
+to start with a fresh installation for OpenEJB, the [Tomcat Installation](tomcat-installation.html)
+ will show you how to setup and verify a Tomcat installation.
+
+<a name="TomcatDetailedInstructions-Addopenejb.wartoTomcat"></a>
+## Add openejb.war to Tomcat
+
+The OpenEJB plugin for Tomcat is distributed as a standalone war file
+containing all of the necessary files and an installer Servlet. The war
+can be obtained from the [OpenEJB download page](openejb:download.html)
+. Once downloaded, simply copy the file into the Tomcat webapps directory.
+
+{deck:id=Copy openejb.war}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>copy openejb.war apache-tomcat-6.0.14\webapps\openejb.war
+ 1 file(s) copied.
+
+C:\>dir apache-tomcat-6.0.14\webapps
+ Volume in drive C has no label.
+ Volume Serial Number is 0000-0000
+
+ Directory of C:\apache-tomcat-6.0.14\webapps
+
+09/20/2007 03:03 PM <DIR> .
+09/20/2007 03:03 PM <DIR> ..
+09/20/2007 03:02 PM <DIR> docs
+09/20/2007 03:01 PM <DIR> examples
+09/20/2007 03:01 PM <DIR> host-manager
+09/20/2007 03:03 PM <DIR> manager
+09/19/2007 09:31 AM 13,394,733 openejb.war
+09/20/2007 03:01 PM <DIR> ROOT
+ 1 File(s) 13,394,733 bytes
+ 7 Dir(s) 5,100,126,208 bytes free
+
+ {card:label=Unix}{noformat:nopanel=true}
+ $ cp openejb.war apache-tomcat-6.0.14/webapps/openejb.war
+
+ $ ls apache-tomcat-6.0.14/webapps/
+ ROOT/ docs/ examples/ host-manager/ manager/
+openejb.war
+
+{deck}
+
+<a name="TomcatDetailedInstructions-RunInstallerServlet"></a>
+## Run Installer Servlet
+
+The OpenEJB Plugin for Tomcat contains an installer servlet which adds the
+OpenEJB listener and JavaAgent to the Tomcat installation. To run the
+installer, you must first start Tomcat.
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>set JRE_HOME=C:\Program Files\Java\jre1.5.0_06
+
+C:\>cd apache-tomcat-6.0.14\bin
+
+C:\apache-tomcat-6.0.14\bin>startup.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+
+ {card:label=Unix}{noformat:nopanel=true}
+ $ cd apache-tomcat-6.0.14/bin
+
+ apache-tomcat-6.0.14/bin$ chmod u+x *.sh
+
+ apache-tomcat-6.0.14/bin$ ./startup.sh
+ Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+ Using JRE_HOME: /your/java/installation
+
+{deck}
+
+*NOTE:* Your output will be different from the example above due to
+differences in installation locations.
+
+It is a good idea to wait a 5-60 seconds (depending on the speed of your
+computer) for Tomcat to fully start. Once Tomcat is fully started, simply
+visit [http://localhost:8080/openejb/installer](http://localhost:8080/openejb/installer)
+ and click the 'install' button to run the installer. The installer should
+report that the installation was successful. If it didn't work click [OPENEJB:here|#problems]
+.
+
+{warning}
+The installer servlet adds the OpenEJB JavaAgent declaration to the
+catalina.sh and catalina.bat files. If you are using an IDE or some other
+mechanism to start Tomcat, you will need to [manually](manual-installation#javaagent.html)
+ add the JavaAgent declaration to the Java VM options of the launcher you
+are using.
+{warning}
+
+<a name="TomcatDetailedInstructions-RestartTomcat"></a>
+## Restart Tomcat
+
+OpenEJB uses OpenJPA for persistence and OpenJPA currently requires a
+JavaAgent to function. Unfortunately, there is no way to install a
+JavaAgent at runtime, so you will have to restart Tomcat to enable the
+JavaAgent. Simply execute the shutdown command, wait 5-60 seconds
+(depending on the speed of your computer) for Tomcat to fully stop, and run
+the startup command to restart Tomcat.
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>cd apache-tomcat-6.0.14\bin
+
+C:\apache-tomcat-6.0.14\bin>shutdown.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+
+C:\apache-tomcat-6.0.14\bin>startup.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+
+ {card:label=Unix}{noformat:nopanel=true}
+ $ cd apache-tomcat-6.0.14/bin
+
+ apache-tomcat-6.0.14/bin$ ./shutdown.sh
+ Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+ Using JRE_HOME: /your/java/installation
+
+ apache-tomcat-6.0.14/bin$ ./startup.sh
+ Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+ Using JRE_HOME: /your/java/installation
+
+{deck}
+
+*NOTE:* Your output will be different from the example above due to
+differences in installation locations.
+
+Once Tomcat is fully started, simply visit [http://localhost:8080/openejb/installer](http://localhost:8080/openejb/installer)
+ to verify the installation is complete.
+
+<a name="TomcatDetailedInstructions-Examples,TutorialsandTests"></a>
+# Examples, Tutorials and Tests
+
+<a name="TomcatDetailedInstructions-ejb-examples.war"></a>
+## ejb-examples.war
+
+Download the [ejb-examples.war](http://people.apache.org/~dain/openejb-temp/examples)
+, copy it into the Tomcat webapps directory, and visit [http://localhost:8080/ejb-examples]
+.
+
+<a name="TomcatDetailedInstructions-OpenEJBiTests"></a>
+## OpenEJB iTests
+
+OpenEJB uses a large test suite to verify the final server assembly, and
+you can use this to verify your OpenEJB installation. Simply download the [openejb-itests.war and openejb-standalone-client.jar](http://people.apache.org/~dain/openejb-temp/itests)
+ and copy it the war into the Tomcat webapps directory. It will take a bit
+to load the application because it contains a huge number of EJBs.
+Finally, run the test client executable jar.
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>java -jar openejb-itests-standalone-client.jar tomcat
+_________________________________________________
+<table>
+<tr><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td><td>_</td></tr>
+</table>
+
+Running EJB compliance tests on HTTP/Tomcat Server
+_________________________________________________
+WARNING: No test suite configuration file specified, assuming system
+properties contain all
+needed information. To specify a test suite configuration file by setting
+its location using
+the system property "openejb.testsuite.properties"
+test server = org.apache.openejb.test.TomcatRemoteTestServer
+entry = java.naming.provider.url:http://127.0.0.1:8080/openejb/ejb
+entry =
+java.naming.factory.initial:org.apache.openejb.client.RemoteInitialContextFactory
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+.........................................
+............................
+Time: 20.644
+
+OK (889 tests)
+
+
+_________________________________________________
+CLIENT JNDI PROPERTIES
+java.naming.provider.url = http://127.0.0.1:8080/openejb/ejb
+java.naming.factory.initial =
+org.apache.openejb.client.RemoteInitialContextFactory
+_________________________________________________
+
+ {card:label=Unix}{noformat:nopanel=true}
+ $ java -jar openejb-itests-standalone-client.jar tomcat
+ _________________________________________________
+ |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
+
+ Running EJB compliance tests on HTTP/Tomcat Server
+ _________________________________________________
+ WARNING: No test suite configuration file specified, assuming system
+properties contain all
+ needed information. To specify a test suite configuration file by setting
+its location using
+ the system property "openejb.testsuite.properties"
+ test server = org.apache.openejb.test.TomcatRemoteTestServer
+ entry = java.naming.provider.url:http://127.0.0.1:8080/openejb/ejb
+ entry =
+java.naming.factory.initial:org.apache.openejb.client.RemoteInitialContextFactory
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ .........................................
+ ............................
+ Time: 12.186
+
+ OK (889 tests)
+
+
+ _________________________________________________
+ CLIENT JNDI PROPERTIES
+ java.naming.provider.url = http://127.0.0.1:8080/openejb/ejb
+ java.naming.factory.initial =
+org.apache.openejb.client.RemoteInitialContextFactory
+ _________________________________________________
+
+{deck}
+
+{tip:title=Failures}The tests should completely pass the first time they
+are run. If you execute the test client a second time, 21 tests fail for
+some unknown reason.{tip}
+
+<a name="TomcatDetailedInstructions-{anchor:problems}Problems?"></a>
+# {anchor:problems} Problems?
+
+<a name="TomcatDetailedInstructions-HTTPStatus403"></a>
+## HTTP Status 403
+
+Did you get a "HTTP Status 403" error page containing the description
+"Access to the specified resource () has been forbidden." when visiting [http://localhost:8080/openejb](http://localhost:8080/openejb)
+?
+
+The openejb.war is protected by a Tomcat valve that restricts access to the
+application to the computer on which Tomcat is running. If your browser is
+running on the same computer as Tomcat, try accessing OpenEJB using this
+link instead [http://127.0.0.1:8080/openejb](http://127.0.0.1:8080/openejb)
+.
+
+If you want to access the openejb.war from another computer, you will need
+to either remove the valve, or modify the IP list in the valve declaration.
+ The easiest way to remove the valve it to simply delete the
+webapps/openejb/META-INF/context.xml file and and the webapps/openejb.war
+file *while Tomcat is stopped*. The openejb.war file must be removed
+because some versions of Tomcat will use the context.xml file packed in the
+openejb.war file regardless of what is in the unpacked directory.
+
+<a name="TomcatDetailedInstructions-OtherIssues"></a>
+## Other Issues
+
+If you are having problems with the installation, please send a message to
+the OpenEJB users [mailing list](openejb:mailing-lists.html)
+ containing any error message(s) and the following information:
+
+* OpenEJB Version
+* Tomcat Version
+* Java Version (execute java -version)
+* Operating System Type and Version
+
+
+<a name="TomcatDetailedInstructions-Limitations"></a>
+# Limitations
+
+ *Tomcat 6.x* - Currently, only Tomcat 6.x is supported due to API
+difference between 5.5.x and 6.x. It is expected that 5.5 will be
+supported in the future, but there are no plans to support 5.0.x due to the
+lack of annotation support in 5.0.x.
+
+ *Security* - Unfortunately, at this time security with Tomcat/OpenEJB is
+not integrated, but is being worked on.
+
+ *EAR Files* - The integration only supports war (and collapsed-ear) files.
+ EAR, EJB Jar, and RAR files will be supported in a future release.
+
+ *JavaAgent* - OpenEJB uses OpenJPA to provide JPA and CMP persistence, and
+OpenJPA currently requires a JavaAgent to function properly. This
+requirement is something that the OpenJPA project is working on removing.
+Once removed, the OpenEJB plugin for Tomcat will no longer need to modify
+the startup shell scripts and you will not need to restart Tomcat after the
+OpenEJB installation.
+
+<a name="TomcatDetailedInstructions-Misc"></a>
+# Misc
+
+This document is a starting point for using OpenEJB in Tomcat and will
+evolve based on user contributions. If you wish to contribute to this
+document, feel very welcome to click the 'Edit' link in the upper right and
+make changes and add new HOWTO's and other docs.
+
Added: openejb/site/trunk/content/tomcat-ejb-refs.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat-ejb-refs.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/tomcat-ejb-refs.cwiki (added)
+++ openejb/site/trunk/content/tomcat-ejb-refs.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,24 @@
+h1. Via @EJB Annotation
+
+Which an be as simple as adding this to your Servlet, Filter, or Listener:
+
+{code}
+@EJB
+private HelloLocal helloLocal;
+{code}
+
+See the [@EJB Injection Example|Injection of other EJBs Example] for a running example. The example uses one ejb to refer to another ejb, but the same rules apply for servlets.
+
+h1. Adding ejb-ref in your web.xml
+
+Or on the older xml-style:
+
+{code:xml}
+<ejb-ref>
+ <description> EJB Reference to the bean deployed to OpenEJB </description>
+ <ejb-ref-name>ejb/hello</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.acme.HelloHome</home>
+ <remote>org.acme.Hello</remote>
+</ejb-ref>
+{code}
Propchange: openejb/site/trunk/content/tomcat-ejb-refs.cwiki
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/site/trunk/content/tomcat-ejb-refs.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat-ejb-refs.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/tomcat-ejb-refs.mdtext (added)
+++ openejb/site/trunk/content/tomcat-ejb-refs.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,29 @@
+Title: Tomcat ejb-refs
+<a name="Tomcatejb-refs-Via@EJBAnnotation"></a>
+# Via @EJB Annotation
+
+Which an be as simple as adding this to your Servlet, Filter, or Listener:
+
+
+ @EJB
+ private HelloLocal helloLocal;
+
+
+See the [@EJB Injection Example](injection-of-other-ejbs-example.html)
+ for a running example. The example uses one ejb to refer to another ejb,
+but the same rules apply for servlets.
+
+<a name="Tomcatejb-refs-Addingejb-refinyourweb.xml"></a>
+# Adding ejb-ref in your web.xml
+
+Or on the older xml-style:
+
+
+ <ejb-ref>
+ <description> EJB Reference to the bean deployed to OpenEJB </description>
+ <ejb-ref-name>ejb/hello</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.acme.HelloHome</home>
+ <remote>org.acme.Hello</remote>
+ </ejb-ref>
+
Added: openejb/site/trunk/content/tomcat-installation.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat-installation.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/tomcat-installation.cwiki (added)
+++ openejb/site/trunk/content/tomcat-installation.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,141 @@
+{composition-setup}
+{composition-setup}
+
+h1. Overview
+
+Tomcat installation is very simple, and can be describes as "Unpack and Run". These instructions were written using Tomcat 6.0.14 but any recent 6.x version should work. If you are comfortable with the CLI, these the following quick instructions will get you going ASAP; otherwise skip to the [OPENEJB:Download Tomcat|#download] section.
+
+# Download Tomcat zip or tar.gz
+# Unpack archive
+# Platform specific setup
+** \[OPENEJB:Unix\] If zip was unpacked, {{chmod u+x bin/*.sh}}
+** \[OPENEJB:Windows\] {{set JAVA_HOME =C:\your\java\installation}}
+# Run bin/startup.sh or bin/startup.bat
+# Visit http://localhost:8080/
+# Run bin/shutdown.sh or bin/shutdown.bat
+
+h1. {anchor:download} Download Tomcat
+
+Download Tomcat 6 zip file from [here|http://tomcat.apache.org/download-60.cgi#6.0.14].
+
+h1. Unpack Tomcat
+
+Unpack the Tomcat zip file which will create a new directory containing the complete Tomcat installation.
+
+{deck:id=unpack tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>jar -xvf apache-tomcat-6.0.14.zip
+ created: apache-tomcat-6.0.14/
+ created: apache-tomcat-6.0.14/bin/
+ created: apache-tomcat-6.0.14/conf/
+...snip...
+
+C:\>dir apache-tomcat-6.0.14
+ Volume in drive C has no label.
+ Volume Serial Number is 0000-0000
+
+ Directory of C:\apache-tomcat-6.0.14
+
+09/20/2007 09:14 PM <DIR> .
+09/20/2007 09:14 PM <DIR> ..
+09/20/2007 09:15 PM <DIR> bin
+09/20/2007 09:15 PM <DIR> conf
+09/20/2007 09:15 PM <DIR> lib
+07/20/2007 04:20 AM 11,560 LICENSE
+09/20/2007 09:14 PM <DIR> logs
+07/20/2007 04:20 AM 556 NOTICE
+07/20/2007 04:20 AM 6,656 RELEASE-NOTES
+07/20/2007 04:20 AM 5,829 RUNNING.txt
+09/20/2007 09:14 PM <DIR> temp
+09/20/2007 09:14 PM <DIR> webapps
+09/20/2007 09:14 PM <DIR> work
+ 4 File(s) 24,601 bytes
+ 9 Dir(s) 5,085,085,696 bytes free
+{noformat}{card}
+{card:label=Unix}{noformat:nopanel=true}
+$ jar -xvf apache-tomcat-6.0.14.zip
+ created: apache-tomcat-6.0.14/
+ created: apache-tomcat-6.0.14/bin/
+ created: apache-tomcat-6.0.14/conf/
+...snip...
+
+$ ls apache-tomcat-6.0.14/
+LICENSE RELEASE-NOTES bin/ lib/ temp/ work/
+NOTICE RUNNING.txt conf/ logs/ webapps/
+{noformat}{card}
+{deck}
+
+h1. \[OPENEJB:Windows\] Set JAVA_HOME environment variable
+
+For Windows users, the Tomcat shell scripts must know the location of the Java installation, and this is done with environment variables. The following command will set the JAVA_HOME environment variable:
+
+{deck:id=unpack tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>set JAVA_HOME =C:\your\java\installation
+{noformat}{card}
+{deck}
+
+h1. \[OPENEJB:Unix\] Make shell scripts executable
+
+For Unix users, the shell scripts in the Tomcat installation are not executable by default, so in order to execute them, you must set mark them as executable. If you unpacked the Tomcat tar.gz file, the scripts are already executable. The following command will make all shell scripts executable:
+
+{deck:id=unpack tomcat}
+{card:label=Unix}{noformat:nopanel=true}
+apache-tomcat-6.0.14$ chmod u+x bin/*.sh
+{noformat}{card}
+{deck}
+
+h1. Start Tomcat
+
+Execute the following command to start the Tomcat server:
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>cd apache-tomcat-6.0.14\bin
+
+C:\apache-tomcat-6.0.14\bin>startup.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+{noformat}{card}
+{card:label=Unix}{noformat:nopanel=true}
+$ cd apache-tomcat-6.0.14/bin
+
+apache-tomcat-6.0.14/bin$ ./startup.sh
+Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+Using JRE_HOME: /your/java/installation
+{noformat}{card}
+{deck}
+
+*NOTE:* Your output will be different from the example above due to differences in installation location.
+
+h1. Verify Tomcat is Running
+
+Visit [http://localhost:8080/] and you should see the Tomcat welcome page.
+
+
+h1. Stop Tomcat
+
+Shutdown Tomcat by executing the following command:
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\apache-tomcat-6.0.14\bin>shutdown.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+{noformat}{card}
+{card:label=Unix}{noformat:nopanel=true}
+apache-tomcat-6.0.14/bin$ ./shutdown.sh
+Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+Using JRE_HOME: /your/java/installation
+{noformat}{card}
+{deck}
+
+*NOTE:* Your output will be different from the example above due to differences in installation locations.
Propchange: openejb/site/trunk/content/tomcat-installation.cwiki
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/site/trunk/content/tomcat-installation.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat-installation.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/tomcat-installation.mdtext (added)
+++ openejb/site/trunk/content/tomcat-installation.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,168 @@
+Title: Tomcat Installation
+{composition-setup}
+{composition-setup}
+
+<a name="TomcatInstallation-Overview"></a>
+# Overview
+
+Tomcat installation is very simple, and can be describes as "Unpack and
+Run". These instructions were written using Tomcat 6.0.14 but any recent
+6.x version should work. If you are comfortable with the CLI, these the
+following quick instructions will get you going ASAP; otherwise skip to the [OPENEJB:Download Tomcat](#download.html)
+ section.
+
+1. Download Tomcat zip or tar.gz
+1. Unpack archive
+1. Platform specific setup
+** \[OPENEJB:Unix\](openejb:unix\.html)
+ If zip was unpacked, *chmod u+x bin/*.sh*
+** \[OPENEJB:Windows\](openejb:windows\.html)
+ *set JAVA_HOME =C:\your\java\installation*
+1. Run bin/startup.sh or bin/startup.bat
+1. Visit http://localhost:8080/
+1. Run bin/shutdown.sh or bin/shutdown.bat
+
+<a name="TomcatInstallation-{anchor:download}DownloadTomcat"></a>
+# {anchor:download} Download Tomcat
+
+Download Tomcat 6 zip file from [here](http://tomcat.apache.org/download-60.cgi#6.0.14)
+.
+
+<a name="TomcatInstallation-UnpackTomcat"></a>
+# Unpack Tomcat
+
+Unpack the Tomcat zip file which will create a new directory containing
+the complete Tomcat installation.
+
+{deck:id=unpack tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>jar -xvf apache-tomcat-6.0.14.zip
+ created: apache-tomcat-6.0.14/
+ created: apache-tomcat-6.0.14/bin/
+ created: apache-tomcat-6.0.14/conf/
+...snip...
+
+C:\>dir apache-tomcat-6.0.14
+ Volume in drive C has no label.
+ Volume Serial Number is 0000-0000
+
+ Directory of C:\apache-tomcat-6.0.14
+
+09/20/2007 09:14 PM <DIR> .
+09/20/2007 09:14 PM <DIR> ..
+09/20/2007 09:15 PM <DIR> bin
+09/20/2007 09:15 PM <DIR> conf
+09/20/2007 09:15 PM <DIR> lib
+07/20/2007 04:20 AM 11,560 LICENSE
+09/20/2007 09:14 PM <DIR> logs
+07/20/2007 04:20 AM 556 NOTICE
+07/20/2007 04:20 AM 6,656 RELEASE-NOTES
+07/20/2007 04:20 AM 5,829 RUNNING.txt
+09/20/2007 09:14 PM <DIR> temp
+09/20/2007 09:14 PM <DIR> webapps
+09/20/2007 09:14 PM <DIR> work
+ 4 File(s) 24,601 bytes
+ 9 Dir(s) 5,085,085,696 bytes free
+
+ {card:label=Unix}{noformat:nopanel=true}
+ $ jar -xvf apache-tomcat-6.0.14.zip
+ created: apache-tomcat-6.0.14/
+ created: apache-tomcat-6.0.14/bin/
+ created: apache-tomcat-6.0.14/conf/
+ ...snip...
+
+ $ ls apache-tomcat-6.0.14/
+ LICENSE RELEASE-NOTES bin/ lib/ temp/
+work/
+ NOTICE RUNNING.txt conf/ logs/ webapps/
+
+{deck}
+
+h1. \[OPENEJB:Windows\](openejb:windows\.html)
+ Set JAVA_HOME environment variable
+
+For Windows users, the Tomcat shell scripts must know the location of the
+Java installation, and this is done with environment variables. The
+following command will set the JAVA_HOME environment variable:
+
+{deck:id=unpack tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>set JAVA_HOME =C:\your\java\installation
+
+ {deck}
+
+ h1. \[OPENEJB:Unix\]
+ Make shell scripts executable
+
+ For Unix users, the shell scripts in the Tomcat installation are not
+executable by default, so in order to execute them, you must set mark them
+as executable. If you unpacked the Tomcat tar.gz file, the scripts are
+already executable. The following command will make all shell scripts
+executable:
+
+ {deck:id=unpack tomcat}
+ {card:label=Unix}{noformat:nopanel=true}
+ apache-tomcat-6.0.14$ chmod u+x bin/*.sh
+
+{deck}
+
+<a name="TomcatInstallation-StartTomcat"></a>
+# Start Tomcat
+
+Execute the following command to start the Tomcat server:
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\>cd apache-tomcat-6.0.14\bin
+
+C:\apache-tomcat-6.0.14\bin>startup.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+
+ {card:label=Unix}{noformat:nopanel=true}
+ $ cd apache-tomcat-6.0.14/bin
+
+ apache-tomcat-6.0.14/bin$ ./startup.sh
+ Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+ Using JRE_HOME: /your/java/installation
+
+{deck}
+
+*NOTE:* Your output will be different from the example above due to
+differences in installation location.
+
+<a name="TomcatInstallation-VerifyTomcatisRunning"></a>
+# Verify Tomcat is Running
+
+Visit [http://localhost:8080/](http://localhost:8080/)
+ and you should see the Tomcat welcome page.
+
+
+<a name="TomcatInstallation-StopTomcat"></a>
+# Stop Tomcat
+
+Shutdown Tomcat by executing the following command:
+
+{deck:id=Start Tomcat}
+{card:label=Windows}{noformat:nopanel=true}
+C:\apache-tomcat-6.0.14\bin>shutdown.bat
+Using CATALINA_BASE: C:\apache-tomcat-6.0.14
+Using CATALINA_HOME: C:\apache-tomcat-6.0.14
+Using CATALINA_TMPDIR: C:\apache-tomcat-6.0.14\temp
+Using JRE_HOME: C:\your\java\installation
+
+ {card:label=Unix}{noformat:nopanel=true}
+ apache-tomcat-6.0.14/bin$ ./shutdown.sh
+ Using CATALINA_BASE: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_HOME: /your/tomcat/installation/apache-tomcat-6.0.14
+ Using CATALINA_TMPDIR: /your/tomcat/installation/apache-tomcat-6.0.14/temp
+ Using JRE_HOME: /your/java/installation
+
+{deck}
+
+*NOTE:* Your output will be different from the example above due to
+differences in installation locations.
Added: openejb/site/trunk/content/tomcat-objectfactory.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat-objectfactory.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/tomcat-objectfactory.cwiki (added)
+++ openejb/site/trunk/content/tomcat-objectfactory.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1 @@
+{include:Tomcat Object Factory}
\ No newline at end of file
Propchange: openejb/site/trunk/content/tomcat-objectfactory.cwiki
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/site/trunk/content/tomcat-objectfactory.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat-objectfactory.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/tomcat-objectfactory.mdtext (added)
+++ openejb/site/trunk/content/tomcat-objectfactory.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,2 @@
+Title: Tomcat ObjectFactory
+{include:Tomcat Object Factory}
Modified: openejb/site/trunk/content/tomcat.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat.cwiki?rev=1144778&r1=1144777&r2=1144778&view=diff
==============================================================================
--- openejb/site/trunk/content/tomcat.cwiki (original)
+++ openejb/site/trunk/content/tomcat.cwiki Sun Jul 10 05:36:12 2011
@@ -1 +1,86 @@
-{include:OPENEJBx30:Tomcat}
\ No newline at end of file
+h1. Introduction
+
+The OpenEJB plugin for Tomcat makes all of the OpenEJB features available to Servlets, including:
+
+ * @Annotations
+ ** @Resource
+ ** @PersistenceUnit
+ ** @PersistenceContext
+ ** @EJB
+ * JPA - Java Persistence Architecture
+ * JMS - Java Messaging Service
+ * JTA - Transaction Processing
+ ** TransactionManager
+ ** Container Managed Transactions
+ ** XA Support
+ * JavaMail
+
+In addition, WAR files can contain EJB modules and JPA persistence units eliminating the annoying construction of .ear files. Adding EJBs and JPA Persistence beans to your application is as simple as adding the @Stateless, @Stateful, @MessageDriven or @Entity to a class. The packaging is refered to as [OPENEJB:Collapsed EAR] style as the war file, ejb jar, and persistence unit files are merged into one archive and share the same classloader.
+
+*Requirements:*
+ * OpenEJB 3.x
+ * Tomcat 6.x or 5.5
+ * Java 1.5 or 1.6
+
+h1. {anchor:quick instructions}Installation for the Impatient
+
+Assuming you have a [normal working Tomcat 6.x or 5.5 installation|Tomcat Installation]:
+
+# Download [openejb.war|OPENEJB:download]
+# Copy openejb.war to $\{catalina.base\}/webapps/openejb.war (Note: the file *must* be named openejb.war)
+# Start Tomcat if it is not already running
+# (optional) Visit [http://localhost:8080/openejb/installer] and click the 'install' button
+
+h1. Examples, Tutorials and Tests
+
+h2. ejb-examples.war
+
+See the webapps/ejb-examples/ directory in the [openejb-examples zip|OPENEJB:Download].
+
+h1. {anchor:problems} Problems?
+
+h2. HTTP Status 403
+
+Did you get a "HTTP Status 403" error page containing the description "Access to the specified resource () has been forbidden." when visiting [http://localhost:8080/openejb]?
+
+The openejb.war is protected by a Tomcat valve that restricts access to the application to the computer on which Tomcat is running. If your browser is running on the same computer as Tomcat, try accessing OpenEJB using this link instead [http://127.0.0.1:8080/openejb].
+
+If you want to access the openejb.war from another computer, you will need to either remove the valve, or modify the IP list in the valve declaration.
+
+The easiest way to remove the valve it to simply delete the webapps/openejb/META-INF/context.xml file and the webapps/openejb.war file *while Tomcat is stopped*. Warning that Tomcat keeps a copy of all context.xml files under conf/Catalina/localhost/<appname>.xml, so you may need to delete the conf/Catalina/localhost/openejb.xml file as well. The openejb.war file must be removed because some versions of Tomcat will use the context.xml file packed in the openejb.war file regardless of what is in the unpacked directory.
+
+h2. DuplicateDeploymentIdException:
+If you try to deploy the same ejb in two different web applications, then you will get the following exception (in conf/openejb.log):
+{code}
+org.apache.openejb.DuplicateDeploymentIdException: Application cannot be deployed as it contains deployment-ids which are in use:
+{code}
+To fix the issue, do the following:
+# Create a file named system.properties under the conf directory
+# Add the following to the system.properties file and save
+{code}
+openejb.deploymentId.format={moduleId}/{ejbName}
+{code}
+
+h2. java.lang.OutOfMemoryError: PermGen space
+By default, the JVM starts with a small PermGen. Tomcat does not increase this limit, so you may encounter this exception by the time Tomcat deploys and executes your application. If you get this exception, you should consider increasing the PermGen allocation for the Tomcat JVM. You can achieve this by adding "-XX:MaxPermSize=256m" to the CATALINA_OPTS environment variable before starting Tomcat.
+
+h2. Other Issues
+
+If you are having problems with the installation, please send a message to the OpenEJB users [mailing list|OPENEJB:mailing lists] containing any error message(s) and the following information:
+
+* OpenEJB Version
+* Tomcat Version
+* Java Version (execute java -version)
+* Operating System Type and Version
+
+
+h1. Limitations
+
+ *JavaAgent* - OpenEJB uses OpenJPA to provide JPA and CMP persistence, and OpenJPA currently requires a JavaAgent to function properly. This requirement is something that the OpenJPA project is working on removing. Once removed, the OpenEJB plugin for Tomcat will no longer need to modify the startup shell scripts and you will not need to restart Tomcat after the OpenEJB installation.
+
+h1. Misc
+
+This document is a starting point for using OpenEJB in Tomcat and will evolve based on user contributions. If you wish to contribute to this document, feel very welcome to click the 'Edit' link in the lower right and make changes and add new HOWTO's and other docs.
+
+h1. JSF Injection Support
+Now you can inject EJB's into JSF managed beans. Currently we have tested with JSF 1.2 RI (Mojarra) and MyFaces v1.2.3 . We would definitely appreciate any feedback on other JSF implementations.
\ No newline at end of file
Modified: openejb/site/trunk/content/tomcat.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/tomcat.mdtext?rev=1144778&r1=1144777&r2=1144778&view=diff
==============================================================================
--- openejb/site/trunk/content/tomcat.mdtext (original)
+++ openejb/site/trunk/content/tomcat.mdtext Sun Jul 10 05:36:12 2011
@@ -1,2 +1,143 @@
Title: Tomcat
-{include:OPENEJBx30:Tomcat}
+<a name="Tomcat-Introduction"></a>
+# Introduction
+
+The OpenEJB plugin for Tomcat makes all of the OpenEJB features available
+to Servlets, including:
+
+ * @Annotations
+ ** @Resource
+ ** @PersistenceUnit
+ ** @PersistenceContext
+ ** @EJB
+ * JPA - Java Persistence Architecture
+ * JMS - Java Messaging Service
+ * JTA - Transaction Processing
+ ** TransactionManager
+ ** Container Managed Transactions
+ ** XA Support
+ * JavaMail
+
+In addition, WAR files can contain EJB modules and JPA persistence units
+eliminating the annoying construction of .ear files. Adding EJBs and JPA
+Persistence beans to your application is as simple as adding the
+@Stateless, @Stateful, @MessageDriven or @Entity to a class. The packaging
+is refered to as [OPENEJB:Collapsed EAR](openejb:collapsed-ear.html)
+ style as the war file, ejb jar, and persistence unit files are merged into
+one archive and share the same classloader.
+
+*Requirements:*
+ * OpenEJB 3.x
+ * Tomcat 6.x or 5.5
+ * Java 1.5 or 1.6
+
+<a name="Tomcat-{anchor:quickinstructions}InstallationfortheImpatient"></a>
+# {anchor:quick instructions}Installation for the Impatient
+
+Assuming you have a [normal working Tomcat 6.x or 5.5 installation](tomcat-installation.html)
+:
+
+1. Download [openejb.war](openejb:download.html)
+1. Copy openejb.war to $\{catalina.base\}/webapps/openejb.war (Note: the
+file *must* be named openejb.war)
+1. Start Tomcat if it is not already running
+1. (optional) Visit [http://localhost:8080/openejb/installer](http://localhost:8080/openejb/installer)
+ and click the 'install' button
+
+<a name="Tomcat-Examples,TutorialsandTests"></a>
+# Examples, Tutorials and Tests
+
+<a name="Tomcat-ejb-examples.war"></a>
+## ejb-examples.war
+
+See the webapps/ejb-examples/ directory in the [openejb-examples zip](openejb:download.html)
+.
+
+<a name="Tomcat-{anchor:problems}Problems?"></a>
+# {anchor:problems} Problems?
+
+<a name="Tomcat-HTTPStatus403"></a>
+## HTTP Status 403
+
+Did you get a "HTTP Status 403" error page containing the description
+"Access to the specified resource () has been forbidden." when visiting [http://localhost:8080/openejb](http://localhost:8080/openejb)
+?
+
+The openejb.war is protected by a Tomcat valve that restricts access to the
+application to the computer on which Tomcat is running. If your browser is
+running on the same computer as Tomcat, try accessing OpenEJB using this
+link instead [http://127.0.0.1:8080/openejb](http://127.0.0.1:8080/openejb)
+.
+
+If you want to access the openejb.war from another computer, you will need
+to either remove the valve, or modify the IP list in the valve declaration.
+
+The easiest way to remove the valve it to simply delete the
+webapps/openejb/META-INF/context.xml file and the webapps/openejb.war file
+*while Tomcat is stopped*. Warning that Tomcat keeps a copy of all
+context.xml files under conf/Catalina/localhost/<appname>.xml, so you may
+need to delete the conf/Catalina/localhost/openejb.xml file as well. The
+openejb.war file must be removed because some versions of Tomcat will use
+the context.xml file packed in the openejb.war file regardless of what is
+in the unpacked directory.
+
+<a name="Tomcat-DuplicateDeploymentIdException:"></a>
+## DuplicateDeploymentIdException:
+If you try to deploy the same ejb in two different web applications, then
+you will get the following exception (in conf/openejb.log):
+
+ org.apache.openejb.DuplicateDeploymentIdException: Application cannot be
+deployed as it contains deployment-ids which are in use:
+
+To fix the issue, do the following:
+1. Create a file named system.properties under the conf directory
+1. Add the following to the system.properties file and save
+
+ openejb.deploymentId.format={moduleId}/{ejbName}
+
+
+<a name="Tomcat-java.lang.OutOfMemoryError:PermGenspace"></a>
+## java.lang.OutOfMemoryError: PermGen space
+By default, the JVM starts with a small PermGen. Tomcat does not increase
+this limit, so you may encounter this exception by the time Tomcat deploys
+and executes your application. If you get this exception, you should
+consider increasing the PermGen allocation for the Tomcat JVM. You can
+achieve this by adding "-XX:MaxPermSize=256m" to the CATALINA_OPTS
+environment variable before starting Tomcat.
+
+<a name="Tomcat-OtherIssues"></a>
+## Other Issues
+
+If you are having problems with the installation, please send a message to
+the OpenEJB users [mailing list](openejb:mailing-lists.html)
+ containing any error message(s) and the following information:
+
+* OpenEJB Version
+* Tomcat Version
+* Java Version (execute java -version)
+* Operating System Type and Version
+
+
+<a name="Tomcat-Limitations"></a>
+# Limitations
+
+ *JavaAgent* - OpenEJB uses OpenJPA to provide JPA and CMP persistence, and
+OpenJPA currently requires a JavaAgent to function properly. This
+requirement is something that the OpenJPA project is working on removing.
+Once removed, the OpenEJB plugin for Tomcat will no longer need to modify
+the startup shell scripts and you will not need to restart Tomcat after the
+OpenEJB installation.
+
+<a name="Tomcat-Misc"></a>
+# Misc
+
+This document is a starting point for using OpenEJB in Tomcat and will
+evolve based on user contributions. If you wish to contribute to this
+document, feel very welcome to click the 'Edit' link in the lower right and
+make changes and add new HOWTO's and other docs.
+
+<a name="Tomcat-JSFInjectionSupport"></a>
+# JSF Injection Support
+Now you can inject EJB's into JSF managed beans. Currently we have tested
+with JSF 1.2 RI (Mojarra) and MyFaces v1.2.3 . We would definitely
+appreciate any feedback on other JSF implementations.
Added: openejb/site/trunk/content/transaction-annotations.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/transaction-annotations.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/transaction-annotations.cwiki (added)
+++ openejb/site/trunk/content/transaction-annotations.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,164 @@
+h1. Transaction Annotations
+
+_also see [Testing Transactions|Testing Transactions Example] for an example of how to use and test EJB transaction attributes_
+
+The *javax.ejb.TransactionAttribute* annotation (@TransactionAttribute) can be applied to a bean class or it's methods.
+
+Usage of the @TransactionAttribute requires you to specify one of six different transaction attribute types defined via the javax.ejb.TransactionAttributeType enum.
+
+ - TransactionAttributeType.*MANDATORY*
+ - TransactionAttributeType.*REQUIRED*
+ - TransactionAttributeType.*REQUIRES_NEW*
+ - TransactionAttributeType.*SUPPORTS*
+ - TransactionAttributeType.*NOT_SUPPORTED*
+ - TransactionAttributeType.*NEVER*
+
+Per EJB 3.0 the default transaction attribute for all EJB 3.0 applications is *REQUIRED*. The default transaction attribute for EJB 2.1, 2.0 and 1.1 applications is vendor specific. In OpenEJB EJB 2.1, 2.0 and 1.1 applications also use *REQUIRED* as the default.
+
+h2. Attribute Types summary
+
+A simplistic way to visualize the transaction attributes is as follows.
+
+| || Failing || Correcting || No Change ||
+|| Transacted | MANDATORY | REQUIRED, REQUIRES_NEW | SUPPORTS |
+|| Not Transacted | NEVER | NOT_SUPPORTED | SUPPORTS |
+
+The "*Transacted*" and "*Not Transacted*" categories represent the container guarantee, i.e. if the bean method will or will not be invoked in a transaction. The "*Failing*", "*Correcting*", and "*No Change*" categories represent the action take by the container to achieve that guarantee.
+
+For example, *Never* and *Mandatory* are categorized as "*Failing*" and will cause the container to throw an exception to the caller if there is (Tx Never) or is not (Tx Mandatory) a transaction in progress when the method is called. The attributes *Required*, *RequiresNew*, and *NotSupported* are categorized as "*Correcting*" as they will cause the container to adjust the transactional state automatically as needed to match the desired state, rather than blocking the invocation by throwing an exception.
+
+h3. Detailed description of each Attribute
+
+h4. MANDATORY
+
+A _MANDATORY_ method is guaranteed to always be executed in a transaction. However, it's the caller's job to take care of suppling the transaction. If the caller attempts to invoke the method *outside* of a transaction, then the container will block the call and throw them an *exception*.
+
+h4. REQUIRED
+
+A _REQUIRED_ method is guaranteed to always be executed in a transaction. If the caller attempts to invoke the method *outside* of a transaction, the container will *start* a transaction, execute the method, then *commit* the transaction.
+
+h4. REQUIRES_NEW
+
+A _REQUIRES_NEW_ method is guaranteed to always be executed in a transaction. If the caller attempts to invoke the method *inside or outside* of a transaction, the container will still *start* a transaction, execute the method, then *commit* the transaction. Any transaction the caller may have in progress will be *suspended* before the method execution then *resumed* afterward.
+
+h4. NEVER
+
+A _NEVER_ method is guaranteed to never be executed in a transaction. However, it's the caller's job to ensure there is no transaction. If the caller attempts to invoke the method *inside* of a transaction, then the container will block the call and throw them an *exception*.
+
+h4. NOT_SUPPORTED
+
+A _NOT_SUPPORTED_ method is guaranteed to never be executed in a transaction. If the caller attempts to invoke the method *inside* of a transaction, the container will *suspend* the caller's transaction, execute the method, then *resume* the caller's transaction.
+
+h4. SUPPORTS
+
+A _SUPPORTS_ method is guaranteed to adopt the exact transactional state of the caller. These methods can be invoked by caller's *inside or outside* of a transaction. The container will do nothing to change that state.
+
+
+h2. On Methods
+
+{code}
+@Stateless
+public static class MyBean implements MyBusinessInterface {
+
+ @TransactionAttribute(TransactionAttributeType.MANDATORY)
+ public String codeRed(String s) {
+ return s;
+ }
+
+ public String codeBlue(String s) {
+ return s;
+ }
+}
+{code}
+
+- _codeRed_ will be invoked with the attribute of _MANDATORY_
+- _codeBlue_ will be invoked with the default attribute of _REQUIRED_
+
+h2. On Classes
+
+{code}
+@Stateless
+@TransactionAttribute(TransactionAttributeType.MANDATORY)
+public static class MyBean implements MyBusinessInterface {
+
+ public String codeRed(String s) {
+ return s;
+ }
+
+ public String codeBlue(String s) {
+ return s;
+ }
+}
+{code}
+
+- _codeRed_ and _codeBlue_ will be invoked with the attribute of _MANDATORY_
+
+h2. Mixed on classes and methods
+
+{code}
+@Stateless
+@TransactionAttribute(TransactionAttributeType.SUPPORTS)
+public static class MyBean implements MyBusinessInterface {
+
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public String codeRed(String s) {
+ return s;
+ }
+
+ public String codeBlue(String s) {
+ return s;
+ }
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ public String codeGreen(String s) {
+ return s;
+ }
+}
+{code}
+
+- _codeRed_ will be invoked with the attribute of _NEVER_
+- _codeBlue_ will be invoked with the attribute of _SUPPORTS_
+- _codeGreen_ will be invoked with the attribute of _REQUIRED_
+
+h1. Illegal Usage
+
+Generally, transaction annotationss cannot be made on AroundInvoke methods and most callbacks.
+
+The following usages of @TransactionAttribute have no effect.
+
+{code}
+@Stateful
+public class MyStatefulBean implements MyBusinessInterface {
+
+ @PostConstruct
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public void constructed(){
+
+ }
+
+ @PreDestroy
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public void destroy(){
+
+ }
+
+ @AroundInvoke
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public Object invoke(InvocationContext invocationContext) throws Exception {
+ return invocationContext.proceed();
+ }
+
+ @PostActivate
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public void activated(){
+
+ }
+
+ @PrePassivate
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public void passivate(){
+
+ }
+}
+{code}
+
Propchange: openejb/site/trunk/content/transaction-annotations.cwiki
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/site/trunk/content/transaction-annotations.mdtext
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/transaction-annotations.mdtext?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/transaction-annotations.mdtext (added)
+++ openejb/site/trunk/content/transaction-annotations.mdtext Sun Jul 10 05:36:12 2011
@@ -0,0 +1,220 @@
+Title: Transaction Annotations
+<a name="TransactionAnnotations-TransactionAnnotations"></a>
+# Transaction Annotations
+
+_also see [Testing Transactions](testing-transactions-example.html)
+ for an example of how to use and test EJB transaction attributes_
+
+The *javax.ejb.TransactionAttribute* annotation (@TransactionAttribute) can
+be applied to a bean class or it's methods.
+
+Usage of the @TransactionAttribute requires you to specify one of six
+different transaction attribute types defined via the
+javax.ejb.TransactionAttributeType enum.
+
+ - TransactionAttributeType.*MANDATORY*
+ - TransactionAttributeType.*REQUIRED*
+ - TransactionAttributeType.*REQUIRES_NEW*
+ - TransactionAttributeType.*SUPPORTS*
+ - TransactionAttributeType.*NOT_SUPPORTED*
+ - TransactionAttributeType.*NEVER*
+
+Per EJB 3.0 the default transaction attribute for all EJB 3.0 applications
+is *REQUIRED*. The default transaction attribute for EJB 2.1, 2.0 and 1.1
+applications is vendor specific. In OpenEJB EJB 2.1, 2.0 and 1.1
+applications also use *REQUIRED* as the default.
+
+<a name="TransactionAnnotations-AttributeTypessummary"></a>
+## Attribute Types summary
+
+A simplistic way to visualize the transaction attributes is as follows.
+
+<table>
+<tr><td> </th><th> Failing </th><th> Correcting </th><th> No Change </th></tr>
+<tr><th> Transacted </td><td> MANDATORY </td><td> REQUIRED, REQUIRES_NEW </td><td> SUPPORTS </td></tr>
+<tr><th> Not Transacted </td><td> NEVER </td><td> NOT_SUPPORTED </td><td> SUPPORTS </td></tr>
+</table>
+
+The "*Transacted*" and "*Not Transacted*" categories represent the
+container guarantee, i.e. if the bean method will or will not be invoked in
+a transaction. The "*Failing*", "*Correcting*", and "*No Change*"
+categories represent the action take by the container to achieve that
+guarantee.
+
+For example, *Never* and *Mandatory* are categorized as "*Failing*" and
+will cause the container to throw an exception to the caller if there is
+(Tx Never) or is not (Tx Mandatory) a transaction in progress when the
+method is called. The attributes *Required*, *RequiresNew*, and
+*NotSupported* are categorized as "*Correcting*" as they will cause the
+container to adjust the transactional state automatically as needed to
+match the desired state, rather than blocking the invocation by throwing an
+exception.
+
+<a name="TransactionAnnotations-DetaileddescriptionofeachAttribute"></a>
+### Detailed description of each Attribute
+
+<a name="TransactionAnnotations-MANDATORY"></a>
+#### MANDATORY
+
+A _MANDATORY_ method is guaranteed to always be executed in a transaction.
+However, it's the caller's job to take care of suppling the transaction.
+If the caller attempts to invoke the method *outside* of a transaction,
+then the container will block the call and throw them an *exception*.
+
+<a name="TransactionAnnotations-REQUIRED"></a>
+#### REQUIRED
+
+A _REQUIRED_ method is guaranteed to always be executed in a transaction.
+If the caller attempts to invoke the method *outside* of a transaction, the
+container will *start* a transaction, execute the method, then *commit* the
+transaction.
+
+<a name="TransactionAnnotations-REQUIRES_NEW"></a>
+#### REQUIRES_NEW
+
+A _REQUIRES_NEW_ method is guaranteed to always be executed in a
+transaction. If the caller attempts to invoke the method *inside or
+outside* of a transaction, the container will still *start* a transaction,
+execute the method, then *commit* the transaction. Any transaction the
+caller may have in progress will be *suspended* before the method execution
+then *resumed* afterward.
+
+<a name="TransactionAnnotations-NEVER"></a>
+#### NEVER
+
+A _NEVER_ method is guaranteed to never be executed in a transaction.
+However, it's the caller's job to ensure there is no transaction. If the
+caller attempts to invoke the method *inside* of a transaction, then the
+container will block the call and throw them an *exception*.
+
+<a name="TransactionAnnotations-NOT_SUPPORTED"></a>
+#### NOT_SUPPORTED
+
+A _NOT_SUPPORTED_ method is guaranteed to never be executed in a
+transaction. If the caller attempts to invoke the method *inside* of a
+transaction, the container will *suspend* the caller's transaction, execute
+the method, then *resume* the caller's transaction.
+
+<a name="TransactionAnnotations-SUPPORTS"></a>
+#### SUPPORTS
+
+A _SUPPORTS_ method is guaranteed to adopt the exact transactional state of
+the caller. These methods can be invoked by caller's *inside or outside*
+of a transaction. The container will do nothing to change that state.
+
+
+<a name="TransactionAnnotations-OnMethods"></a>
+## On Methods
+
+
+ @Stateless
+ public static class MyBean implements MyBusinessInterface {
+
+ @TransactionAttribute(TransactionAttributeType.MANDATORY)
+ public String codeRed(String s) {
+ return s;
+ }
+
+ public String codeBlue(String s) {
+ return s;
+ }
+ }
+
+
+- _codeRed_ will be invoked with the attribute of _MANDATORY_
+- _codeBlue_ will be invoked with the default attribute of _REQUIRED_
+
+<a name="TransactionAnnotations-OnClasses"></a>
+## On Classes
+
+
+ @Stateless
+ @TransactionAttribute(TransactionAttributeType.MANDATORY)
+ public static class MyBean implements MyBusinessInterface {
+
+ public String codeRed(String s) {
+ return s;
+ }
+
+ public String codeBlue(String s) {
+ return s;
+ }
+ }
+
+
+- _codeRed_ and _codeBlue_ will be invoked with the attribute of
+_MANDATORY_
+
+<a name="TransactionAnnotations-Mixedonclassesandmethods"></a>
+## Mixed on classes and methods
+
+
+ @Stateless
+ @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+ public static class MyBean implements MyBusinessInterface {
+
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public String codeRed(String s) {
+ return s;
+ }
+
+ public String codeBlue(String s) {
+ return s;
+ }
+
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ public String codeGreen(String s) {
+ return s;
+ }
+ }
+
+
+- _codeRed_ will be invoked with the attribute of _NEVER_
+- _codeBlue_ will be invoked with the attribute of _SUPPORTS_
+- _codeGreen_ will be invoked with the attribute of _REQUIRED_
+
+<a name="TransactionAnnotations-IllegalUsage"></a>
+# Illegal Usage
+
+Generally, transaction annotationss cannot be made on AroundInvoke methods
+and most callbacks.
+
+The following usages of @TransactionAttribute have no effect.
+
+
+ @Stateful
+ public class MyStatefulBean implements MyBusinessInterface {
+
+ @PostConstruct
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public void constructed(){
+
+ }
+
+ @PreDestroy
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public void destroy(){
+
+ }
+
+ @AroundInvoke
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public Object invoke(InvocationContext invocationContext) throws
+Exception {
+ return invocationContext.proceed();
+ }
+
+ @PostActivate
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public void activated(){
+
+ }
+
+ @PrePassivate
+ @TransactionAttribute(TransactionAttributeType.NEVER)
+ public void passivate(){
+
+ }
+ }
+
+
Added: openejb/site/trunk/content/understanding-callbacks.cwiki
URL: http://svn.apache.org/viewvc/openejb/site/trunk/content/understanding-callbacks.cwiki?rev=1144778&view=auto
==============================================================================
--- openejb/site/trunk/content/understanding-callbacks.cwiki (added)
+++ openejb/site/trunk/content/understanding-callbacks.cwiki Sun Jul 10 05:36:12 2011
@@ -0,0 +1,75 @@
+The rules here are pretty hard to follow without examples.
+
+When they say one AroundInvoke per class they mean that in the most literal sense as in one individual java class definition, not including it's parent class or classes, may exactly one AroundInvoke method. The bean or interceptor class may have an AroundInvoke method, its parent class may have an AroundInvoke method, the parent's parent class may have an AroundInvoke method and so on.
+
+So the following is legal.
+
+{code}
+ public class Plant {
+ @AroundInvoke
+ public Object a(InvocationContext ctx) throws Exception {
+ return ctx.proceed();
+ }
+ }
+
+ public class Fruit extends Plant {
+ @AroundInvoke
+ public Object b(InvocationContext ctx) throws Exception {
+ return ctx.proceed();
+ }
+ }
+
+ @Stateless
+ public class Apple extends Fruit implements AppleLocal {
+ @AroundInvoke
+ public Object c(InvocationContext ctx) throws Exception {
+ return ctx.proceed();
+ }
+
+ public String grow(){
+ return "ready to pick";
+ }
+ }
+
+ public interface AppleLocal {
+ public String grow();
+ }
+{code}
+
+The result is that when the "grow" method on AppleLocal (and consequently on Apple) is invoked, the container will first invoke the following AroundInvoke methods in this order; a, b, c.
+
+What the ejb spec doesn't do such a good job at stating is that there are ways to effectively shut off the callbacks, including AroundInvoke, of a parent class by simply overriding the method. We can shut off the "a" around invoke with a slightly different version of Apple as follows:
+
+{code}
+ @Stateless
+ public class Apple extends Fruit implements AppleLocal {
+
+ // This will now never be called.
+ public Object a(InvocationContext ctx) throws Exception {
+ return null;
+ }
+
+ @AroundInvoke
+ public Object c(InvocationContext ctx) throws Exception {
+ return ctx.proceed();
+ }
+
+ public String grow(){
+ return "ready to pick";
+ }
+ }
+{code}
+
+The result of this is that when the "grow" method on AppleLocal is invoked, the container will first invoke the AroundInvoke methods "b" then "c" skipping "a" completely.
+
+When they say that an AroundInvoke method cannot be a business method, they mean that they cannot be exposed to clients through a local or remote interface. The following would be illegal.
+
+{code}
+ public interface AppleLocal {
+ public String grow();
+
+ // This is an AroundInvoke method in the bean class, not a legal business method!
+ public Object c(InvocationContext ctx) throws Exception;
+ }
+{code}
+
Propchange: openejb/site/trunk/content/understanding-callbacks.cwiki
------------------------------------------------------------------------------
svn:eol-style = native