This is an automated email from the ASF dual-hosted git repository. rzo1 pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 37fdaf55be6892d2b17aa103a95dd3edc7d89d48 Author: Richard Zowalla <[email protected]> AuthorDate: Fri May 22 15:25:52 2026 +0200 docs: remove obsolete pages and clean up documentation index Delete pages that document removed features or are no longer relevant for TomEE 11: - jakartaee-9/ - 2020 work-in-progress notes on the Jakarta EE 8->9 namespace migration (contained TBD/??? placeholders) - manual-installation.adoc - manual OpenEJB-on-Tomcat-6 install walkthrough - spring.adoc, spring-and-openejb-3.0.adoc, spring-ejb-and-jpa.adoc - the OpenEJB Spring integration module and its examples were removed - advanced/tomee-embedded/foo.ado - empty stray file Update documentation.adoc to drop the Spring section and the nav entries pointing to pages that no longer exist. --- docs/advanced/tomee-embedded/foo.ado | 0 docs/documentation.adoc | 14 +- docs/jakartaee-9/eclipse-transformer.adoc | 122 --------------- docs/jakartaee-9/index.adoc | 38 ----- docs/manual-installation.adoc | 148 ------------------- docs/spring-and-openejb-3.0.adoc | 238 ------------------------------ docs/spring-ejb-and-jpa.adoc | 197 ------------------------- docs/spring.adoc | 139 ----------------- 8 files changed, 2 insertions(+), 894 deletions(-) diff --git a/docs/advanced/tomee-embedded/foo.ado b/docs/advanced/tomee-embedded/foo.ado deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/docs/documentation.adoc b/docs/documentation.adoc index 3a07c77ecf..8cd3b6e0e8 100644 --- a/docs/documentation.adoc +++ b/docs/documentation.adoc @@ -5,16 +5,14 @@ :jbake-status: published -See also the link:examples-trunk/index.html[examples page] for -downloadable, executable and code-focused view of Java EE and TomEE. You +See also the link:https://github.com/apache/tomee/tree/main/examples[examples] for +a downloadable, executable and code-focused view of Jakarta EE and TomEE. You can also find us on IRC freenode.org #openejb and #tomee == IDE * link:tomee-and-intellij.html[Get started with Intellij] * link:contrib/debug/debug-intellij.html[Debugging in Intellij] * link:tomee-and-eclipse.html[Get started with Eclipse (WTP)] -* link:getting-started-with-eclipse-and-webby.html[Get started with Eclipse -(m2e-Webby)] * link:tomee-and-netbeans.html[Get started with Netbeans] == General Information @@ -53,9 +51,6 @@ PersistenceUnits in Tests] Tests] * link:configuring-logging-in-tests.html[Configuring Logging in Tests] * link:alternate-descriptors.html[Alternate Descriptors] -* link:unit-testing-transactions.html[Unit Testing Transactions] -* link:testcase-with-testbean-inner-class.html[TestCase with TestBean -inner-class] * link:local-client-injection.html[TestCase Injection (`@LocalClient`)] == Discovery and Failover @@ -74,11 +69,6 @@ Layout] * link:deploy-tool.html[Deploy Tool] * link:properties-tool.html[Properties Tool] -== Spring -* link:spring-and-openejb-3.0.html[Spring and OpenEJB 3.0] -* link:spring.html[Spring and OpenEJB 3.1 and later] -* link:spring-ejb-and-jpa.html[Spring, EJB and JPA example] - == Arquillian * link:arquillian-getting-started.html[Arquillian Primer - What you need to know] diff --git a/docs/jakartaee-9/eclipse-transformer.adoc b/docs/jakartaee-9/eclipse-transformer.adoc deleted file mode 100644 index ea22b3fcac..0000000000 --- a/docs/jakartaee-9/eclipse-transformer.adoc +++ /dev/null @@ -1,122 +0,0 @@ -:index-group: Jakarta EE 9 Work -:jbake-date: 2020-04-17 -:jbake-type: page -:jbake-status: published - - -= Eclipse Transformer - -The Eclipse Transformer provides translation from javax to jakarta on various artifacts, including Java source source, compiled Java classes, along with jar, war and ear files. - -== Building - -The Transformer is a project at the Eclipse Foundation, and is built using Gradle. To check out and build from source, do the following: - -[source,bash] ----- -git clone https://github.com/tbitonti/jakartaee-prototype -cd jakartaee-prototype -./gradlew assembleDist ----- - -This will produce a tar and a zip in the `transformer/build/distributions` directory. - -== Running - -Unzip the resulting zip file, and add the `bin` directory to your `PATH` variable, and you should be able to run the transformer using the `transformer` script. - -Running `transformer -u` will provide the usage information: - -[source,bash] ----- -usage: org.eclipse.transformer.Transformer input [ output ] [ options ] -Options: - -d,--dryrun Dry run - -h,--help Display help - -i,--invert Invert transformation rules - -lf,--logFile <arg> Logging file - -ll,--logLevel <arg> Logging level - -ln,--logName <arg> Logger name - -lp,--logProperty <arg> Logging property - -lpf,--logPropertyFile <arg> Logging properties file - -o,--overwrite Overwrite - -q,--quiet Display quiet output - -t,--type <arg> Input file type - -tb,--bundles <arg> Transformation bundle updates URL - -td,--direct <arg> Transformation direct string replacements - -tf,--xml <arg> Map of XML filenames to property files - -tr,--renames <arg> Transformation package renames URL - -ts,--selection <arg> Transformation selections URL - -tv,--versions <arg> Transformation package versions URL - -u,--usage Display usage - -v,--verbose Display verbose output -Actions: - [ NULL ] - [ CLASS ] - [ MANIFEST ] - [ FEATURE ] - [ SERVICE_LOADER_CONFIG ] - [ XML ] - [ ZIP ] - [ JAR ] - [ WAR ] - [ RAR ] - [ EAR ] - [ JAVA ] - [ DIRECTORY ] -Logging Properties: - [ org.slf4j.simpleLogger.logFile ] - [ org.slf4j.simpleLogger.cacheOutputStream ] - [ org.slf4j.simpleLogger.defaultLogLevel ] - [ org.slf4j.simpleLogger.log.a.b.c ] - [ org.slf4j.simpleLogger.levelInBrackets ] - [ org.slf4j.simpleLogger.showDateTime ] - [ org.slf4j.simpleLogger.dateTimeFormat ] - [ org.slf4j.simpleLogger.showThreadName ] - [ org.slf4j.simpleLogger.showLogName ] - [ org.slf4j.simpleLogger.showShortLogName ] - [ org.slf4j.simpleLogger.warnLevelString ] - ----- - -With an already built and extracted TomEE server, we can do some experimentation. - -Rename the lib folder: - -[source,bash] ----- -mv lib javaee-lib ----- - -Create a Jakarta EE lib folder: - -[source,bash] ----- -mkdir jakartaee-lib ----- - -Translate each of the jars in the javaee-lib folder: - -[source,bash] ----- -cd javaee-lib - -for f in *; do transformer $f ../jakartaee-lib/$f -tr <path/to/rules/file>; done ----- - -See the rules section below for the rules file. - -Symlink jakartaee-lib folder to lib: - -[source,bash] ----- -cd .. -ln -s jakartaee-lib lib ----- - -You should now be able to start a Jakarta-ized version of TomEE. (Expect errors - these can be discussed on the list) - - -== Rules - -The current rules for package renames are in the `transformer/jakarta-renames.properties` file in the main TomEE source repository. diff --git a/docs/jakartaee-9/index.adoc b/docs/jakartaee-9/index.adoc deleted file mode 100644 index e68c873419..0000000000 --- a/docs/jakartaee-9/index.adoc +++ /dev/null @@ -1,38 +0,0 @@ -:index-group: Jakarta EE 9 Work -:jbake-date: 2020-04-17 -:jbake-type: page -:jbake-status: published - - -= Jakarta EE 9 Work - -This page is something of a work-in-progress, but attempts to serve as an entrypoint for anyone looking to get involved with this work. - -== Challenge - -Jakarta EE 9 removes a very small number of specifications, and doesn't introduce functional changes to the specifications. It does, however, introduce a package -rename, which will have a very wide impact. Not only do the specification jars and implementations in the server need to change their namespaces, user applications -will need to change any references as well. - -== Goals - -* Try and maintain a single codebase for javax and jakarta. It's tempting to fork master and embark on a massive renaming exercise. That's complex as we'd need to do that for various dependencies as well, who may also have other branches and timelines. Having two code-bases also means that any changes need to be applied twice, and with renamed packages, it's unlikely the git merging or cherry-picking will work. - -* Be backwards compatible - One goal I had in my mined, is that if you have an application that uses javax, you'd probably like to be able to run it on a new Jakarta EE server. There are some options here - I quite like the idea of running the Transformer as a javaagent, so any applications deployed using the old namespaces are converted on the fly at the bytecode level. - -* Tooling - I wonder what tooling we could potentially provide? One thought I had was a Maven plugin that can transform a war/ear file for you as part of a build. - - -== Approaches - -* Eclipse Transformer - -Investigate the use of the Eclipse Transformer (link:https://projects.eclipse.org/projects/technology.transformer[https://projects.eclipse.org/projects/technology.transformer]) to translate the server, and the example applications to the Jakarta namespace. - -link:eclipse-transformer.html[Building and running the Eclipse Transformer] - -* ??? - -== Tasks Tracker - -TBD: something will appear here soon diff --git a/docs/manual-installation.adoc b/docs/manual-installation.adoc deleted file mode 100644 index 02b5487617..0000000000 --- a/docs/manual-installation.adoc +++ /dev/null @@ -1,148 +0,0 @@ -= Manual Installation -:index-group: OpenEJB Standalone Server -:jbake-date: 2018-12-05 -:jbake-type: page -:jbake-status: published - - -== Overview - -The manual installation process is significantly harder than the -link:tomcat.html[automatic installation] which we normally recommend. In -this installation process you will do the following: - -[arabic] -. Install openejb.war -. Download openejb.war from the -http://tomee.apache.org/downloads.html[download page] -. Make webapps/openejb directory -. Change to new webapps/openejb directory -. Unpack the openejb.war file in the new directory -. Add the OpenEJB listener the conf/server.xml file -. Update the non-compliant Tomcat annotations-api.jar -. Add the OpenEJB JavaAgent to the bin/catalina.bat or bin/catalina.bat -script - -== Install openejb.war - -Once Tomcat has been link:tomcat-installation.html[installed] , the -OpenEJB plugin for Tomcat can be installed. The war can be obtained from -the http://tomee.apache.org/downloads.html[download page] - -The commands in this example are executed from within the Tomcat -installation directory. - -== Unpack OpenEJB Tomcat plugin in Tomcat webapps directory - -Be careful, this is the most error-prone step. A web application does -not contain a root directory, so if you unpack it in the wrong -directory, it is difficult to undo. Please, follow this step closely, -and most importantly make sure you execute the unpack command from -within the new webapps/openejb directory - -Due to the structure of war files, you must create a new directory for -OpenEJB, change to the new directory and execute the unpack command from -within the new directory. If you get this wrong, it is difficult to -undo, so follow the steps closely. - -== Add the OpenEJB listener to Tomcat - -All Tomcat listener classes must be available in the Tomcat common class -loader, so the openejb-loader jar must be copied into the Tomcat lib -directory. - -[source,java] ----- - C:\apache-tomcat-6.0.14>copy webapps\openejb\lib\openejb-loader-3.0.0-SNAPSHOT.jar lib\openejb-loader.jar - 1 file(s) copied. - - apache-tomcat-6.0.14$ cp webapps/openejb/lib/openejb-loader-*.jar lib/openejb-loader.jar ----- - -Add the following -`<Listener className="org.apache.openejb.loader.OpenEJBListener" />` to -your conf/server.xml file to load the OpenEJB listener: - -The snippet is shown below - -[source,xml] ----- -<!-- Note: A "Server" is not itself a "Container", so you may not -define subcomponents such as "Valves" at this -level. -Documentation at /docs/config/server.html - --> - -<Server port="8005" shutdown="SHUTDOWN"> -<!-- OpenEJB plugin for tomcat --> -<Listener -className="org.apache.openejb.loader.OpenEJBListener" /> - -<!--APR library loader. Documentation at /docs/apr.html --> -<Listener -className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> ----- - -== Update the Tomcat annotations-api.jar file - -Tomcat contains an old non-compliant version of the jakarta.annotation -classes and these invalid classes must be updated so OpenEJB can process -annotations. Simply, replace the annotations-api.jar in the Tomcat lib -directory with the updated annotations-api.jar in the OpenEJB war. - -== Add OpenEJB javaagent to Tomcat startup - -OpenJPA, the Java Persistence implementation used by OpenEJB, currently -must enhance persistence classes to function properly, and this -requires the installation of a javaagent into the Tomcat startup -process. - -First, copy the OpenEJB JavaAgent jar into the lib directory. - -Simply, add the snippet marked below in bin/catalina.bat (Windows) or -bin/catalina.sh (Unix) file to enable the OpenEJB javaagent: - -[source,properties] ----- -if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuli -set JAVA_OPTS=%JAVA_OPTS% --Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager --Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties" -:noJuli - - # Start of Snippet to add - rem Add OpenEJB javaagent if not exist - "%CATALINA_BASE%\webapps\openejb\lib\openejb-javaagent.jar" goto - noOpenEJBJavaagent set - JAVA_OPTS="-javaagent:%CATALINA_BASE%\webapps\openejb\lib\openejb-javaagent.jar" - %JAVA_OPTS% :noOpenEJBJavaagent - # End of Snippet to add - - -rem ----- Execute The Requested Command ---------------------------------------- -echo Using CATALINA_BASE: %CATALINA_BASE% -echo Using CATALINA_HOME: %CATALINA_HOME% - - - -# Set juli LogManager if it is present -if [OPENEJB: -r "$CATALINA_BASE"/conf/logging.properties ](openejb:--r-"$catalina_base"/conf/logging.properties-.html) -; then -JAVA_OPTS="$JAVA_OPTS -"-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" -"-Djava.util.logging.config.file="$CATALINA_BASE/conf/logging.properties" -fi - - #Start of Snippet to add - if [OPENEJB: -r "$CATALINA_BASE"/webapps/lib/openejb-javaagent.jar ](openejb:--r-"$catalina_base"/webapps/lib/openejb-javaagent.jar-.html) -; then -JAVA_OPTS=""-javaagent:$CATALINA_BASE/lib/openejb-javaagent.jar" -$JAVA_OPTS" -fi -#End of Snippet to add ----- - -== Note: The example above is an excerpt from the middle of the -bin/catalina.sh file. Search for this section and add the snippet -shown diff --git a/docs/spring-and-openejb-3.0.adoc b/docs/spring-and-openejb-3.0.adoc deleted file mode 100644 index 6df9234181..0000000000 --- a/docs/spring-and-openejb-3.0.adoc +++ /dev/null @@ -1,238 +0,0 @@ -= Spring and OpenEJB 3.0 -:index-group: Spring -:jbake-date: 2018-12-05 -:jbake-type: page -:jbake-status: published - - -NOTE: OpenEJB 3.1 and later users should refer to the link:spring.html[Spring] -page. - -= Bootstrapping OpenEJB in Spring - -If you wish to use OpenEJB inside Spring you can do so pretty easily. -Include OpenEJB and its dependencies in your classpath as you would in a -plain embedded scenario then add a custom factory like the following: - -[source,java] ----- -public class OpenEjbFactoryBean implements org.springframework.beans.factory.FactoryBean { - - private Properties properties = new Properties(); - - public OpenEjbFactoryBean() { - properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); - } - - public Properties getJndiEnvironment() { - return properties; - } - - public void setJndiEnvironment(Properties properties) { - this.properties.putAll(properties); - } - - public Object getObject() { - try { - return new InitialContext(properties); - } catch (NamingException e) { - throw new RuntimeException(e); - } - } - - public Class getObjectType(){ - return Context.class; - } - - boolean isSingleton() { - return true; - } -} ----- - -And include that at the top of your spring xml file as follows: - -[source,xml] ----- -<bean id="OpenEjbContext" class="org.acme.OpenEjbFactoryBean"> - <property name="jndiEnvironment"> - <props> - <prop key="myDs">new://Resource?type=DataSource</prop> - <prop key="myDs.JdbcDriver">com.mysql.jdbc.Driver</prop> - <prop key="myDs.JdbcUrl">jdbc:mysql://localhost/midastest?createDatabaseIfNotExist=true</prop> - <prop key="myDs.UserName">root</prop> - <prop key="myDs.Password"></prop> - </props> - </property> -</bean> ----- - -The value of is meant to be illustrative of the kinds of properties you -can pass into OpenEJB. It's possible to create any number of -datasources, topics, queues, containers and more this way. - -Just as with Unit Testing, OpenEJB will find and automatically deploy -all the EJB beans it [finds in the classpath|Application discovery via -the classpath]. You can then expose any of these things to other Spring -components with custom factory beans. - -== Injecting OpenEJB-created resources into Spring components - -If you want to have any of the Topics, Queues, DataSources, -EntityManagers or more that OpenEJB creates injected into components -that Spring creates, here's one technique.... - -Let's say you have a persistence unit called "_OrangeUnit_" declared in -a `persistence.xml` file. One way to get the related _EntityManager_ -created by OpenEJB is to do as follows. Create an `@Stateless` bean with -an `@PersistenceContext` ref in it, then use a factory bean to look it up, -pull the EntityManager out and return it - -OrangeUnitBean.java - -[source,java] ----- -/* - * OpenEJB will automatically find this bean. Just put it in the same jar - * that your META-INF/persistence.xml file is located in and make sure that - * that same jar file also has a META-INF/ejb-jar.xml file. The ejb-jar.xml - * need only contain the text "<ejb-jar/>" at minimum. - */ -@Stateless -public class OrangeUnitBean implements OrangeUnitLocal { - - @PersistenceContext(unitName="OrangeUnit") - private EntityManager entityManager; - - public EntityManager getEntityManager() { - return entityManager; - } -} ----- - -OrangeUnitLocal.java - -[source,java] ----- -/** - * The local interface for the OrangeUnitBean - */ -public interface OrangeUnitLocal { - public EntityManager getEntityManager(); -} ----- - -OrangeUnitFactoryBean.java - -[source,java] ----- -/** - * This factory bean will lookup the OrangeUnitBean using the javax.naming.Context - * that is created via the OpenEjbFactoryBean above. It will simply grab the EntityManager - * from that bean and hand it over to Spring. Anyone in Spring-land can then easily get - * a reference to the EntityManager by simply referencing this factory bean. - */ -public class OrangeUnitFactoryBean implements org.springframework.beans.factory.FactoryBean { - private Context context; - - public Context getContext() { - return context; - } - - public void setContext(Context context) { - this.context = context; - } - - public Object getObject() { - try { - ResourceLocal bean = (ResourceLocal) context.lookup("OrangeUnitBeanLocal"); - return bean.getEntityManager(); - } catch (NamingException e) { - throw new RuntimeException(e); - } - } - - public Class getObjectType(){ - return EntityManager.class; - } - - boolean isSingleton() { - return true; - } -} ----- - -The factory bean would then be declared in your spring xml file as -follows: - -[source,xml] ----- -<bean id="OrangeUnit" class="org.acme.OrangeUnitFactoryBean"> - <property name="context" ref="OpenEjbContext"> -</bean> ----- - -The EntityManager can then easily be consumed by a spring bean. - -[source,java] ----- -public class SomePojo { - - private EntityManager entityManager; - - public void setEntityManager(EntityManager entityManager) { - this.entityManager = entityManager; - } - - ... -} ----- - -In the spring xml - -[source,xml] ----- -<bean id="SomePojo" class="org.acme.SomePojo"> - <property name="entityManager" ref="OrangeUnit"> -</bean> ----- - -Here's what all three declarations would look like together in your -spring xml: - -Spring bean definitions combined - -[source,xml] ----- -<bean id="OpenEjbContext" class="org.acme.OpenEjbFactoryBean"> - <property name="jndiEnvironment"> - <props> - <prop key="myDs">new://Resource?type=DataSource</prop> - <prop key="myDs.JdbcDriver">com.mysql.jdbc.Driver</prop> - <prop key="myDs.JdbcUrl">jdbc:mysql://localhost/midastest?createDatabaseIfNotExist=true</prop> - <prop key="myDs.UserName">root</prop> - <prop key="myDs.Password"></prop> - </props> - </property> -</bean> - -<bean id="OrangeUnit" class="org.acme.OrangeUnitFactoryBean"> - <property name="context" ref="OpenEjbContext"> -</bean> - -<bean id="SomePojo" class="org.acme.SomePojo"> - <property name="entityManager" ref="OrangeUnit"> -</bean> ----- - -[NOTE] -==== -Here is a bunch of links suggested -by a user. If anybody has time to go through them and write a doc, that -would be great. These links explain how to make available spring -components to openejb. - -- http://twasink.net/blog/archives/2007/01/using_spring_wi.html -- http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/ejb/interceptor/SpringBeanAutowiringInterceptor.html -- http://wiki.netbeans.org/MavenSpringEJBsOnGlassfish -==== diff --git a/docs/spring-ejb-and-jpa.adoc b/docs/spring-ejb-and-jpa.adoc deleted file mode 100644 index 68528e8073..0000000000 --- a/docs/spring-ejb-and-jpa.adoc +++ /dev/null @@ -1,197 +0,0 @@ -= Spring EJB and JPA -:index-group: Spring -:jbake-date: 2018-12-05 -:jbake-type: page -:jbake-status: published - -\{note}OpenEJB 3.1 or later required\{note} This example shows -how to combine Spring, OpenEJB and Hibernate using the integration code -provided by OpenEJB. Here, OpenEJB is used as an embeddable EJB -container inside of Spring. See the link:spring.html[Spring] page for -details. - -We use the basic Movie example and expand it to include more objects to -demonstrate both Spring beans, EJB Session beans, and JPA persistent -objects in one application. The premise of the example is a Cineplex -that has a number of Theaters (viewing screens), each playing a number -of Movies. The basic object layout is as follows: - -Object - -Type - -Description - -http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/CineplexImpl.java[CineplexImpl] - -@Stateless - -Shows the use of `@Resource` to have Spring beans injected. Specifically, -the _Theaters_ Spring bean - -http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Theaters.java[Theaters] - -Spring bean - -Simple wrapper object injected into _CineplexImpl_ - -http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Theater.java[Theater] - -Spring bean - -Shows that EJBs can be injected into Spring beans. Uses both the -_Movies_ EJB and the _Movie_ JPA objects - -http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/MoviesImpl.java[MoviesImpl] - -@Stateful - -Wraps a JPA EntityManager and provides transactional access to the -persistent _Movie_ objects - -http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/Movie.java[Movie] - -@Entity - -Basic JPA bean that is used both by Spring beans and EJBs. The same -_Movie_ object as in all the other persistence related examples. - -http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration/src/main/java/org/superbiz/spring/AvailableMovies.java[AvailableMovies] - -Spring bean - -Simple object used as a clever way to seed the EntityManager (and -really, the database) with persistent _Movie_ objects - -= Required jars - -To set up the integration you'll need: - -[arabic] -. The standard OpenEJB 3.1 libraries -. The -https://repository.apache.org/content/groups/public/org/apache/openejb/openejb-spring/3.1.2/openejb-spring-3.1.2.jar[openejb-spring-3.1.jar] -or later -. Spring 2.5 or other (any version should work) - -In Maven2 this can be done by adding the following dependencies to your -pom.xml -\{snippet:id=required|url=openejb3/examples/spring-integration/pom.xml|lang=xml} -For other environments, you can simply link:downloads.html[download an -openejb-3.1.zip] or later and include all the jars under the lib/ -directory in your classpath. Then download and add the -[openejb-spring-3.1.jar|http://people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/openejb/openejb-spring/3.1/openejb-spring-3.1.jar] -along with your Spring jars. - -= The Spring xml - -Bootstrapping and Configuring OpenEJB is fairly simple. -\{snippet:id=bootstrapping|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} -As well, you can optionally declare any resources or containers. -Anything declarable as a or in the openejb.xml can instead be declared -in the Spring xml file as shown here. -\{snippet:id=resources|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} -And finally our Spring beans. -\{snippet:id=pojos|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} -{title= Don't forget} -\{snippet:id=annotations|url=openejb3/examples/spring-integration/src/main/resources/movies.xml|lang=xml} -It allows various annotations to be detected in bean classes: Spring's -@Required and `@Autowired`, as well as JSR 250's `@PostConstruct`, -@PreDestroy and `@Resource` (if available), JAX-WS's `@WebServiceRef` (if -available), EJB3's `@EJB` (if available), and JPA's `@PersistenceContext` -and `@PersistenceUnit` (if available). Alternatively, you may choose to -activate the individual BeanPostProcessors for those annotations. -\{note} - -= The Code - -In efforts to keep the example page somewhat short, we'll show just -three beans, each demonstrating a particular relationship. - -The first is the CineplexImpl EJB which shows EJB -> Spring. -\{snippet:id=code|url=openejb3/examples/spring-integration/src/main/java/org/superbiz/spring/CineplexImpl.java|lang=java} - -The second is the Theater Spring bean which shows Spring -> EJB. -\{snippet:id=code|url=openejb3/examples/spring-integration/src/main/java/org/superbiz/spring/Theater.java|lang=java} - -The last is the AvailableMovies Spring bean which Shows Spring -> EJB -> -JPA -\{snippet:id=code|url=openejb3/examples/spring-integration/src/main/java/org/superbiz/spring/AvailableMovies.java|lang=java} - -= The TestCase - -The JUnit TestCase uses a ClassPathXmlApplicationContext to load the -Spring ApplicationContext. Anything that loads your Spring xml file -should work fine. The following code would work a plain java app as -well. - -\{snippet:id=code|url=openejb3/examples/spring-integration/src/test/java/org/superbiz/spring/MoviesTest.java|lang=java} - -= Running - -The source for this example can be downloaded from svn via: - -$ svn co -http://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/spring-integration - -Then, in the "spring-integration" directory, run: - -$ mvn clean install - -Which should create output like the following. - -[source,java] ----- -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running org.superbiz.spring.MoviesTest -log4j:WARN No appenders could be found for logger ----- - -(org.springframework.context.support.ClassPathXmlApplicationContext). -log4j:WARN Please initialize the log4j system properly. Apache OpenEJB -3.1 build: 20081009-03:31 http://tomee.apache.org/ INFO - openejb.home = -/Users/dblevins/work/openejb3/examples/spring-integration INFO - -openejb.base = /Users/dblevins/work/openejb3/examples/spring-integration -INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, -type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) INFO - -Configuring Service(id=MovieDatabase, type=Resource, provider-id=Default -JDBC Database) INFO - Configuring Service(id=MovieDatabaseUnmanaged, -type=Resource, provider-id=Default JDBC Database) INFO - Found EjbModule -in classpath: -/Users/dblevins/work/openejb3/examples/spring-integration/target/classes -INFO - Beginning load: -/Users/dblevins/work/openejb3/examples/spring-integration/target/classes -INFO - Configuring enterprise application: classpath.ear INFO - -Configuring Service(id=Default Stateless Container, type=Container, -provider-id=Default Stateless Container) INFO - Auto-creating a -container for bean CineplexImpl: Container(type=STATELESS, id=Default -Stateless Container) INFO - Auto-linking resource-ref -'org.superbiz.spring.CineplexImpl/theaters' in bean CineplexImpl to -Resource(id=theaters) 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, -provider=org.hibernate.ejb.HibernatePersistence) INFO - Enterprise -application "classpath.ear" loaded. INFO - Assembling app: classpath.ear -INFO - PersistenceUnit(name=movie-unit, -provider=org.hibernate.ejb.HibernatePersistence) INFO - -Jndi(name=CineplexImplLocal) --> Ejb(deployment-id=CineplexImpl) INFO - -Jndi(name=MoviesLocal) --> Ejb(deployment-id=Movies) INFO - Created -Ejb(deployment-id=Movies, ejb-name=Movies, container=Default Stateful -Container) INFO - Created Ejb(deployment-id=CineplexImpl, -ejb-name=CineplexImpl, container=Default Stateless Container) INFO - -Deployed Application(path=classpath.ear) INFO - Exported EJB Movies with -interface org.superbiz.spring.Movies to Spring bean MoviesLocal INFO - -Exported EJB CineplexImpl with interface org.superbiz.spring.Cineplex to -Spring bean CineplexImplLocal Tests run: 1, Failures: 0, Errors: 0, -Skipped: 0, Time elapsed: 3.141 sec - -[source,properties] ----- -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 ----- diff --git a/docs/spring.adoc b/docs/spring.adoc deleted file mode 100644 index b4ab712c45..0000000000 --- a/docs/spring.adoc +++ /dev/null @@ -1,139 +0,0 @@ -= Spring -:index-group: Spring -:jbake-date: 2018-12-05 -:jbake-type: page -:jbake-status: published - -\{note} This document and the related feature is considered a prototype -and will change based on user feedback. All comments suggestions -welcome. \{note} - -= Introduction - -The OpenEJB Spring integration makes all Spring defined beans injectable -to Java EE components, and all Java EE components can be injected to -Spring beans. The injection system supports arbitrarily complex nesting -(e.g., Spring bean injected into a Java EE component, which is then -injected into another Spring bean), including: - -* @Resource injection of any Spring bean into EJB -* Injection of any Java EE resource into a Spring bean, including: ** -EJB 3.0 beans ** EJB 3.1 Singleton Bean ** JDBC Connector ** JMS -Connector ** JMS Queue and Topic ** Generic Java EE Connector (JCA) - -In addition, the OpenEJB Spring integration add support for discovery -and deployment of standard Java EE packages within a Spring context, -including: - -* EAR -* EJB Jar -* Persistence Unit -* RAR - -_Requirements:_ * OpenEJB 3.1+ * Spring X.X * Java 1.5 or 1.6 - -= Spring Beans - -The following beans are usable in any spring xml file. - -Class - -Description - -org.apache.openejb.spring.ClassPathApplication - -Scrapes the classpath for all EJB, RAR, and Persistence applications, -deploys them, and imports them into the current ApplicationContext. All -applications found are treated as one big EAR unless the -_classpathAsEar_ property is set to _false_ - -org.apache.openejb.spring.Application - -Scrapes an individual jar file for EJB, RAR, and Persistence -applications, deploys them, and imports them into the current -ApplicationContext. The 'jarFile' property is required. The application -is treated as its own self-contained EAR, separate from other uses of -'Application' - -org.apache.openejb.spring.Resource - -Allows an OpenEJB to be declared in the Spring ApplicationContext - -org.apache.openejb.spring.OpenEJBResource - -A FactoryBean that imports a Resource from OpenEJB into the Spring -ApplicationContext. Has the following properties: _type_ such as -javax.sql.DataSource, and _resourceId_. In the future this bean will not -be required and all OpenEJB Resources will automatically be imported -into the Spring ApplicationContext - -org.apache.openejb.spring.BmpContainer - -Allows an OpenEJB BMP to be declared in the Spring ApplicationContext. -Has the following properties: _poolSize_ - -org.apache.openejb.spring.CmpContainer - -Allows an OpenEJB CMP to be declared in the Spring ApplicationContext. - -org.apache.openejb.spring.SingletonContainer - -Allows an OpenEJB Singleton to be declared in the Spring -ApplicationContext. Has the following properties: _accessTimeout_ - -org.apache.openejb.spring.StatefulContainer - -Allows an OpenEJB Stateful to be declared in the Spring -ApplicationContext. Has the following properties: _timeOut_ - -org.apache.openejb.spring.StatelessContainer - -Allows an OpenEJB Stateful to be declared in the Spring -ApplicationContext. Has the following properties: _timeOut_, _poolSize_, -and _strictPooling_ - -org.apache.openejb.spring.MdbContainer - -Allows an OpenEJB Message-Driven to be declared in the Spring -ApplicationContext. Has the following properties: _resourceAdapter_, -_messageListenerInterface_, _activationSpecClass_, and _instanceLimit_ - -org.apache.openejb.spring.EJB - -A FactoryBean that imports an EJB from OpenEJB into the Spring -ApplicationContext. One of these is automatically created for each -interface of each EJB, but explicit use can be nice if you desire to -import an EJB with a specific name. Has the following properties: -_deploymentId_, _interface_ - -= Examples - -See the link:spring-ejb-and-jpa.html[Spring EJB and JPA] page for -example code and a working Spring xml file. - -= \{anchor:problems} Problems? - -If you are having problems with the installation, please send a message -to the OpenEJB users link:mailing-lists.html[mailing list] containing -any error message(s) and the following information: - -* OpenEJB Version -* Spring Version -* Java Version (execute java -version) -* Operating System Type and Version - -= Limitations - -_JavaAgent_ - OpenEJB uses OpenJPA to provide JPA and CMP persistence, -and OpenJPA currently requires a JavaAgent to function properly in a -Java 1.5 environment. OpenJPA does not require a JavaAgent in Java 1.6. -Use Hibernate as the provider in your `persistence.xml` files if you -wish to avoid this requirement. - -_EntityManager_ - Having an OpenEJB created EntityManager or -EntityManagerFactory injected into Spring beans is currently not -supported. This will be added to the next release. A small workaround -for this is to use an EJB as a factory by adding a 'getEntityManager' -method using it as a -http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-factory-class-instance-factory-method[Spring -instance factory method] .
