From commits-return-44030-archive-asf-public=cust-asf.ponee.io@tomee.apache.org Sat Dec 1 00:04:19 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id DD363180677 for ; Sat, 1 Dec 2018 00:04:17 +0100 (CET) Received: (qmail 33518 invoked by uid 500); 30 Nov 2018 23:04:17 -0000 Mailing-List: contact commits-help@tomee.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tomee.apache.org Delivered-To: mailing list commits@tomee.apache.org Received: (qmail 33502 invoked by uid 99); 30 Nov 2018 23:04:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2018 23:04:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 16186E1396; Fri, 30 Nov 2018 23:04:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: dblevins@apache.org To: commits@tomee.apache.org Date: Fri, 30 Nov 2018 23:04:17 -0000 Message-Id: <125e7d94d3384f66b2be74fd9613286e@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [02/20] tomee git commit: Docs old and new http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/statelesscontainer-config.mdtext ---------------------------------------------------------------------- diff --git a/docs/statelesscontainer-config.mdtext b/docs/statelesscontainer-config.mdtext new file mode 100644 index 0000000..460bbc4 --- /dev/null +++ b/docs/statelesscontainer-config.mdtext @@ -0,0 +1,458 @@ +Title: StatelessContainer Configuration + + +A StatelessContainer can be declared via xml in the `/conf/tomee.xml` file or in a `WEB-INF/resources.xml` file using a declaration like the following. All properties in the element body are optional. + + + accessTimeout = 30 seconds + callbackThreads = 5 + closeTimeout = 5 minutes + garbageCollection = false + idleTimeout = 0 minutes + maxAge = 0 hours + maxAgeOffset = -1 + maxSize = 10 + minSize = 0 + replaceAged = true + replaceFlushed = false + strictPooling = true + sweepInterval = 5 minutes + + +Alternatively, a StatelessContainer can be declared via properties in the `/conf/system.properties` file or via Java VirtualMachine `-D` properties. The properties can also be used when embedding TomEE via the `javax.ejb.embeddable.EJBContainer` API or `InitialContext` + + myStatelessContainer = new://Container?type=STATELESS + myStatelessContainer.accessTimeout = 30 seconds + myStatelessContainer.callbackThreads = 5 + myStatelessContainer.closeTimeout = 5 minutes + myStatelessContainer.garbageCollection = false + myStatelessContainer.idleTimeout = 0 minutes + myStatelessContainer.maxAge = 0 hours + myStatelessContainer.maxAgeOffset = -1 + myStatelessContainer.maxSize = 10 + myStatelessContainer.minSize = 0 + myStatelessContainer.replaceAged = true + myStatelessContainer.replaceFlushed = false + myStatelessContainer.strictPooling = true + myStatelessContainer.sweepInterval = 5 minutes + +Properties and xml can be mixed. Properties will override the xml allowing for easy configuration change without the need for ${} style variable substitution. Properties are not case sensitive. If a property is specified that is not supported by the declared StatelessContainer a warning will be logged. If a StatelessContainer is needed by the application and one is not declared, TomEE will create one dynamically using default settings. Multiple StatelessContainer declarations are allowed. +# Supported Properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyTypeDefaultDescription
accessTimeouttime30 seconds +Specifies the time an invokation should wait for an instance +of the pool to become available. +
callbackThreadsint5 +The number of threads for constructing and destroying beans. +
closeTimeouttime5 minutes +Maximum time to wait for instances to be destroyed when shutting down the pool +
garbageCollectionbooleanfalse +Allows Garbage Collection to be used as a mechanism for shrinking +the pool. +
idleTimeouttime0 minutes +Specifies the maximum time that an instance should be allowed to +sit idly in the pool without use before it should be retired and +removed. +
maxAgetime0 hours +Specifies the maximum time that an instance should live before +it should be retired and removed from use. +
maxAgeOffsetint-1 +Applies to MaxAge usage and would rarely be changed, but is a +nice feature to understand. +
maxSizeint10 +Specifies the size of the instance pool for this stateless +SessionBean container. +
minSizeint0 +Specifies the minimum number of bean instances that should be in +the pool for each bean. +
replaceAgedbooleantrue +When `ReplaceAged` is enabled, any instances in the pool that +expire due to reaching their `MaxAge` will be replaced immediately +so that the pool will remain at its current size. +
replaceFlushedbooleanfalse +When `ReplaceFlushed` is enabled, any instances in the pool that +are flushed will be replaced immediately so that the pool will +remain at its current size. +
strictPoolingbooleantrue +StrictPooling tells the container what to do when the pool +reaches it's maximum size and there are incoming requests that +need instances. +
sweepIntervaltime5 minutes +The frequency in which the container will sweep the pool and +evict expired instances. +
+ + + + +## accessTimeout + +Specifies the time an invokation should wait for an instance +of the pool to become available. + +After the timeout is reached, if an instance in the pool cannot +be obtained, the method invocation will fail. + +Usable time units: nanoseconds, microsecons, milliseconds, +seconds, minutes, hours, days. Or any combination such as +"1 hour and 27 minutes and 10 seconds" + +Any usage of the `javax.ejb.AccessTimeout` annotation will +override this setting for the bean or method where the +annotation is used. + + + +## callbackThreads + +The number of threads for constructing and destroying beans. + +When sweeping the pool for expired instances a thread pool is +used to process calling `@PreDestroy` on expired instances as well +as creating new instances as might be required to fill the pool +to the minimum after a Flush or `MaxAge` expiration. The +`CallbackThreads` setting dictates the size of the thread pool and +is shared by all beans deployed in the container. + + + +## closeTimeout + +Maximum time to wait for instances to be destroyed when shutting down the pool + +PostConstruct methods are invoked on all instances in the pool +when the bean is undeployed and its pool is closed. The +`CloseTimeout` specifies the maximum time to wait for the pool to +close and `PostConstruct` methods to be invoked. + +Usable time units: nanoseconds, microsecons, milliseconds, +seconds, minutes, hours, days. Or any combination such as +`1 hour and 27 minutes and 10 seconds` + + + +## garbageCollection + +Allows Garbage Collection to be used as a mechanism for shrinking +the pool. + +When set to true all instances in the pool, excluding +the minimum, are eligible for garbage collection by the virtual +machine as per the rules of `java.lang.ref.SoftReference` and can be +claimed by the JVM to free memory. Instances garbage collected +will have their `@PreDestroy` methods called during finalization. + +In the OpenJDK VM the `-XX:SoftRefLRUPolicyMSPerMB` flag can adjust +how aggressively SoftReferences are collected. The default +OpenJDK setting is 1000, resulting in inactive pooled instances +living one second of lifetime per free megabyte in the heap, which +is very aggressive. The setting should be increased to get the +most out of the `GarbageCollection` feature of the pool. Much +higher settings are safe. Even a setting as high as 3600000 (1 +hour per free MB in the heap) does not affect the ability for the +VM to garbage collect SoftReferences in the event that memory is +needed to avoid an `OutOfMemoryException`. + + + +## idleTimeout + +Specifies the maximum time that an instance should be allowed to +sit idly in the pool without use before it should be retired and +removed. + +Only instances +in surplus of the pool's `MinSize` are eligible to expire via `IdleTimeout` +Instances that expire due to `IdleTimeout` will have their `@PreDestroy` +methods invoked before being completely destroyed. + +Usable time units: nanoseconds, microsecons, milliseconds, +seconds, minutes, hours, days. Or any combination such as +"1 hour and 27 minutes and 10 seconds" + + + +## maxAge + +Specifies the maximum time that an instance should live before +it should be retired and removed from use. + +This will happen +gracefully. Useful for situations where bean instances are +designed to hold potentially expensive resources such as memory +or file handles and need to be periodically cleared out. + +Usable time units: nanoseconds, microsecons, milliseconds, +seconds, minutes, hours, days. Or any combination such as +`1 hour and 27 minutes and 10 seconds` + + + +## maxAgeOffset + +Applies to MaxAge usage and would rarely be changed, but is a +nice feature to understand. + +When the container first starts and the pool is filled to the +minimum size, all those "minimum" instances will have the same +creation time and therefore all expire at the same time dictated +by the `MaxAge` setting. To protect against this sudden drop +scenario and provide a more gradual expiration from the start +the container will spread out the age of the instances that fill +the pool to the minimum using an offset. + +The `MaxAgeOffset` is not the final value of the offset, but +rather it is used in creating the offset and allows the +spreading to push the initial ages into the future or into the +past. The pool is filled at startup as follows: + + for (int i = 0; i < poolMin; i++) { + long ageOffset = (maxAge / poolMin * i * maxAgeOffset) % maxAge; + pool.add(new Bean(), ageOffset)); + } + +The default `MaxAgeOffset` is -1 which causes the initial +instances in the pool to live a bit longer before expiring. As +a concrete example, let's say the MinSize is 4 and the MaxAge is +100 years. The generated offsets for the four instances created +at startup would be 0, -25, -50, -75. So the first instance +would be "born" at age 0, die at 100, living 100 years. The +second instance would be born at -25, die at 100, living a total +of 125 years. The third would live 150 years. The fourth 175 +years. + +A `MaxAgeOffset` of 1 would cause instances to be "born" older +and therefore die sooner. Using the same example `MinSize` of 4 +and `MaxAge` of `100 years`, the life spans of these initial four +instances would be 100, 75, 50, and 25 years respectively. + +A `MaxAgeOffset` of 0 will cause no "spreading" of the age of the +first instances used to fill the pool to the minimum and these +instances will of course reach their MaxAge at the same time. +It is possible to set to decimal values such as -0.5, 0.5, -1.2, +or 1.2. + + + +## maxSize + +Specifies the size of the instance pool for this stateless +SessionBean container. + +Each `@Stateless` bean will get its own instance pool. +If StrictPooling is not used, instances +will still be created beyond this number if there is demand, but +they will not be returned to the pool and instead will be +immediately expire. + + + +## minSize + +Specifies the minimum number of bean instances that should be in +the pool for each bean. + +Pools are prefilled to the minimum on +startup. Note this will create start order dependencies between +other beans that also eagerly start, such as other `@Stateless` +beans with a minimum or `@Singleton` beans using `@Startup`. The +`@DependsOn` annotation can be used to appropriately influence +start order. + +The minimum pool size is rigidly maintained. Instances in the +minimum side of the pool are not eligible for `IdleTimeout` or +`GarbageCollection`, but are subject to `MaxAge` and flushing. + +If the pool is flushed it is immediately refilled to the minimum +size with `MaxAgeOffset` applied. If an instance from the minimum +side of the pool reaches its `MaxAge`, it is also immediately +replaced. Replacement is done in a background queue using the +number of threads specified by `CallbackThreads`. + + + +## replaceAged + +When `ReplaceAged` is enabled, any instances in the pool that +expire due to reaching their `MaxAge` will be replaced immediately +so that the pool will remain at its current size. + +Replacement +is done in a background queue so that incoming threads will not +have to wait for instance creation. + +The aim of his option is to prevent user requests from paying +the instance creation cost as `MaxAge` is enforced, potentially +while under heavy load at peak hours. + +Instances from the minimum side of the pool are always replaced +when they reach their `MaxAge`, this setting dictates the +treatment of non-minimum instances. + + + +## replaceFlushed + +When `ReplaceFlushed` is enabled, any instances in the pool that +are flushed will be replaced immediately so that the pool will +remain at its current size. + +Replacement is done in a background +queue so that incoming threads will not have to wait for +instance creation. + +The aim of his option is to prevent user requests from paying +the instance creation cost if a flush performed while under +heavy load at peak hours. + +Instances from the minimum side of the pool are always replaced +when they are flushed, this setting dictates the treatment of +non-minimum instances. + +A bean may flush its pool by casting the `SessionContext` to +`Flushable` and calling `flush()`. See `SweepInterval` for details on +how flush is performed. + + import javax.annotation.Resource; + import javax.ejb.SessionContext; + import javax.ejb.Stateless; + import java.io.Flushable; + import java.io.IOException; + + public class MyBean { + + private SessionContext sessionContext; + + public void flush() throws IOException { + + ((Flushable) sessionContext).flush(); + } + } + + + +## strictPooling + +StrictPooling tells the container what to do when the pool +reaches it's maximum size and there are incoming requests that +need instances. + +With strict pooling, requests will have to wait for instances to +become available. The pool size will never grow beyond the the +set `MaxSize` value. The maximum amount of time a request should +wait is specified via the `AccessTimeout` setting. + +Without strict pooling, the container will create temporary +instances to meet demand. The instances will last for just one +method invocation and then are removed. + +Setting `StrictPooling` to `false` and `MaxSize` to `0` will result in +no pooling. Instead instances will be created on demand and live +for exactly one method call before being removed. + + + +## sweepInterval + +The frequency in which the container will sweep the pool and +evict expired instances. + +Eviction is how the `IdleTimeout`, +`MaxAge`, and pool "flush" functionality is enforced. Higher +intervals are better. + +Instances in use are excluded from sweeping. Should an instance +expire while in use it will be evicted immediately upon return +to the pool. Effectively `MaxAge` and flushes will be enforced as +a part of normal activity or sweeping, while IdleTimeout is only +enforcable via sweeping. This makes aggressive sweeping less +important for a pool under moderate load. + +Usable time units: nanoseconds, microsecons, milliseconds, +seconds, minutes, hours, days. Or any combination such as +`1 hour and 27 minutes and 10 seconds` + http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/system-properties-files.mdtext ---------------------------------------------------------------------- diff --git a/docs/system-properties-files.mdtext b/docs/system-properties-files.mdtext new file mode 100644 index 0000000..e457401 --- /dev/null +++ b/docs/system-properties-files.mdtext @@ -0,0 +1,20 @@ +Title: System Properties Files + +# OpenEJB System Properties File + +OpenEJB and TomEE are really configurable in particular through system properties. + +What is not so known is these system properties can be read from several places. The order is important, +it means if the second place provides the same property than the first one, the first one will be +omitted. + +Here how it works: + +* JVM system properties: -Dxxx=yyy +* user system.properties: the file ${user.home}/.openejb/system.properties +* instance system.properties: conf/system.properties + +Note: generally you place in the user system properties file the contant configuration (check my openejb +version for instance). + + http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/system-properties.mdtext ---------------------------------------------------------------------- diff --git a/docs/system-properties.mdtext b/docs/system-properties.mdtext new file mode 100644 index 0000000..8b53bd4 --- /dev/null +++ b/docs/system-properties.mdtext @@ -0,0 +1,64 @@ +Title: System Properties + + + +You can find a list of properties [here](properties-listing.html). But read on to understand how these can be used. + +# Overriding openejb.xml + +Anything in the openejb.xml file can be overridden via system properties of +the format: + + + `-D.=` + +..where id is the value in the config file for example: + + + + JdbcDriver com.mysql.jdbc.Driver + JdbcUrl jdbc:mysql://localhost/test + UserName test + + + +Could be overridden as follows via system properties on the command line: + +> ./bin/openejb start -Dmysql.JdbcDriver=com.mysql.jdbc.Driver +> -Dmysql.JdbcUrl=jdbc:mysql://localhost/test -Dmysql.UserName=test + + + +# Overriding Server Services + +Any server service installed into OpenEJB can be overridden in the same +fashion as things in the openejb.xml file. + +For example, when OpenEJB starts it prints out the following: + + + ** Starting Services ** + NAME IP PORT + httpejbd 0.0.0.0 4204 + telnet 0.0.0.0 4202 + ejbd 0.0.0.0 4201 + hsql 0.0.0.0 9001 + activemq 127.0.0.1 4206 + derbynet 0.0.0.0 4205 + admin thread 0.0.0.0 4200 + + +Each of those has the same standard xinet.d-like properties which can also +be configured as such: + + + `-D.=` + + +... where 'id' is the name of the server service and 'property-name' is one +of the following: bind, port, threads, disabled, only_from. + +So to set the address and port the ejbd service will bind to, simply +specify this on the command line: + + ./bin/openejb start -Dejbd.bind=192.168.1.12 -Dejbd.port=9988 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/telnet-console.mdtext ---------------------------------------------------------------------- diff --git a/docs/telnet-console.mdtext b/docs/telnet-console.mdtext new file mode 100644 index 0000000..793201e --- /dev/null +++ b/docs/telnet-console.mdtext @@ -0,0 +1,163 @@ +Title: Telnet Console +{note} Availability: Since OpenEJB 0.9{note} + + +# Basic Usage + +To use OpenEJB's Telnet Console, simply boot your server normally. + +> $ ./bin/openejb start + + + OPENEJB_HOME=/Users/dblevins/Desktop/openejb-1.0 + OpenEJB 1.0 build: 20060226-1701 + http://www.openejb.org + resources 1 + OpenEJB ready. + [init] + OpenEJB Remote Server + ** Starting Services ** + NAME IP PORT + webadmin 0.0.0.0 4203 + httpejbd 0.0.0.0 4204 + telnet 0.0.0.0 4202 + ejbd 0.0.0.0 4201 + admin 0.0.0.0 4200 + ------- + Ready! + + + +Then in another shell telnet in + +> $ telnet localhost 4202 + + Trying ::1... + Connected to localhost. + Escape character is '^] +'. + OpenEJB Remote Server Console + type 'help' for a list of commands + [openejb] +$ help + stop + exit + system + version + lookup + help + [openejb] +$ system + Containers: + Default BMP Container + Default CMP Container + Default Stateful Container + Default Stateless Container + + Deployments: + client/tests/stateful/EncBean + client/tests/entity/cmp/RMI-over-IIOP/EJBHome + client/tests/stateful/BasicStatefulHome + ClientTools/ViewClass + Webadmin/Configuration + EJBGenerator/CreateEJB + ClientTools/InvokeObject + Webadmin/Properties + client/tests/stateful/RMI-over-IIOP/EJBHome + Webadmin/Home + client/tests/entity/bmp/allowed_operations/EntityHome + client/tests/entity/cmp/EncBean + httpd/DefaultBean + client/tests/stateful/BeanManagedBasicStatefulHome + client/tools/DatabaseHome + client/tests/entity/bmp/EncBean + config/webadmin/ConfigurationData + deploy/webadmin/Deployer + ClientTools/ViewJndi + Webadmin/DeploymentList + client/tests/stateless/BeanManagedBasicStatelessHome + Webadmin/CMPMapping + client/tests/stateless/EncBean + client/tests/stateful/BeanManagedTransactionTests/EJBHome + client/tests/entity/bmp/RMI-over-IIOP/EJBHome + Webadmin/ListLogs + client/tests/stateless/BeanManagedTransactionTests/EJBHome + ClientTools/ViewEjb + client/tests/entity/bmp/BasicBmpHome + mapping/webadmin/CMPMappingData + client/tests/stateless/BasicStatelessHome + client/tests/entity/cmp/BasicCmpHome + Webadmin/Deployment + httpd/session + client/tests/entity/cmp/allowed_operations/EntityHome + client/tests/stateless/RMI-over-IIOP/EJBHome + [openejb] +$ exit + Connection closed by foreign host. + + + +# Configuring the Telnet Service + +The configuration of all server services (network facing services) is done +in xinet.d style config files. The telnet shell is controlled via the +$OPENEJB_HOME/conf/telnet.properties file. This file is created for you +automatically after the first time OpenEJB boots. + +> $ cat conf/telnet.properties + + server = org.openejb.server.telnet.TelnetServer + bind = 127.0.0.1 + port = 4202 + disabled = false + threads = 5 + # only_from = 192.168.1.123 + + +You can change the IP, port, and even the number of threads allowed to +concurrently access the Telnet service via this file. + + +# Disabling the Telnet Service + +Simply edit the config file and set 'disabled' to true + + + disabled = true + + +Then restart OpenEJB. + + +# Restricting Access + +It is unlikely you want just anyone to be able to login and execute +commands. While you can't restrict access on a user basis, yet, you can +restrict access to specific hosts. Host based access control (HBA) is a +built-in part of any Server Service in OpenEJB and the Telnet Service is no +different. This is done with the 'only_from' property, which like the +rest of the file is a direct copy of the xinet.d syntax for HBA. + +For an example to restrict access to the localhost, you could configure the +Telnet Service like this: + + + server = org.openejb.server.telnet.TelnetServer + bind = 127.0.0.1 + port = 4202 + disabled = false + threads = 5 + only_from = localhost + + +If you wanted to restrict access to localhost *and* say the hosts +192.168.1.207 and 192.168.1.16, you can simply add them to the list. + + + server = org.openejb.server.telnet.TelnetServer + bind = 127.0.0.1 + port = 4202 + disabled = false + threads = 5 + only_from = localhost, 192.168.1.207, 192.168.1.16 + http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tip-concurrency.mdtext ---------------------------------------------------------------------- diff --git a/docs/tip-concurrency.mdtext b/docs/tip-concurrency.mdtext new file mode 100644 index 0000000..d9935ef --- /dev/null +++ b/docs/tip-concurrency.mdtext @@ -0,0 +1,22 @@ +Title: Global Concurrency Management + +If for whatever reason you want to define the global default concurrency add this to your META-INF/ejb-jar.xml: + + + + + + + * + Bean + + + + +You may need to create the file if it does not exist. + + src/main/resources/META-INF/ejb-jar.xml \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tip-jersey-client.mdtext ---------------------------------------------------------------------- diff --git a/docs/tip-jersey-client.mdtext b/docs/tip-jersey-client.mdtext new file mode 100644 index 0000000..763fb79 --- /dev/null +++ b/docs/tip-jersey-client.mdtext @@ -0,0 +1,18 @@ +Title: Jersey Client + +If you have an application that uses jersey-client in any way then it may fail with an error along the lines of: + + Caused by: java.lang.ClassNotFoundException: com.sun.jersey.core.util.FeaturesAndProperties + at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java) + at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java) + at org.apache.tomee.catalina.LazyStopWebappClassLoader.loadClass(LazyStopWebappClassLoader.java) + ... 34 more + +This is due to the fact that the jersey-core.jar contains some classes that should not be deployed as part of a javaEE application. For example, it contains javax.ws.rs.Path but does not contain javax.ws.rs.core.Configurable, so the jar is usually ignored by TomEE. + +You could switch to using the [Apache CXF Client](http://cxf.apache.org/), which is what we would recommend. +If you really want to keep Jersey then you can use set the following property in your *[TomEE]\conf\system.properties* + + openejb.api.javax.ws.rs.Path.validation=false + +This will then allow Jersey classes to be loaded by TomEE (After a restart). \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tip-weblogic.mdtext ---------------------------------------------------------------------- diff --git a/docs/tip-weblogic.mdtext b/docs/tip-weblogic.mdtext new file mode 100644 index 0000000..42e783c --- /dev/null +++ b/docs/tip-weblogic.mdtext @@ -0,0 +1,13 @@ +Title: WebLogic Lookup + +How to lookup WebLogic Objects from within a TomEE context: + + Hashtable props = new Hashtable(); + props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); + props.put(javax.naming.Context.URL_PKG_PREFIXES, "weblogic.jndi.factories"); + props.put("java.naming.provider.url", "t3://your.host.name:7023"); + Context ctx = new InitialContext(props); + + IService s = (IService) ctx.lookup("java:global.com.test.ServiceImpl!com.test.IService"); + +Obviously you will need to change the actual lookup to your specific object, but you get the idea. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tomcat-object-factory.mdtext ---------------------------------------------------------------------- diff --git a/docs/tomcat-object-factory.mdtext b/docs/tomcat-object-factory.mdtext new file mode 100644 index 0000000..1a3c77e --- /dev/null +++ b/docs/tomcat-object-factory.mdtext @@ -0,0 +1,12 @@ +Title: Tomcat Object Factory +*The TomcatEjbFactory as discussed in the [OnJava article "OpenEJB: EJB for Tomcat"](http://www.onjava.com/pub/a/onjava/2003/02/12/ejb_tomcat.html) + is no longer required.* + +As of OpenEJB 3.0 references from Servlets to EJBs happen automatically +with usage of the [@EJB annotation](openejbx30:injection-of-other-ejbs-example.html) + in the Servlet, Filter or Listener or with the or + declared in the web.xml. + +See the [Tomcat Integration](openejbx30:tomcat.html) + page for the most up-to-date details on using OpenEJB inside Tomcat. + http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tomee-and-eclipse.mdtext ---------------------------------------------------------------------- diff --git a/docs/tomee-and-eclipse.mdtext b/docs/tomee-and-eclipse.mdtext new file mode 100644 index 0000000..d7aa1f9 --- /dev/null +++ b/docs/tomee-and-eclipse.mdtext @@ -0,0 +1,141 @@ +Title: TomEE and Eclipse +Notice: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +Using TomEE in Eclipse is pretty simple since it uses the existing Tomcat 7 server adaptor that comes +with Eclipse. + +## Quick Start + +An excellent instructional video with step-by-step instructions on how to install Eclipse, TomEE +and create/deploy your first project is available on YouTube here: [Getting Started with Apache TomEE][1] (Remember to select the 'Generate web.xml descriptor' checkbox during project setup. Otherwise the ejb does not get injected and you will get an error.). + +1. Download and install both Apache TomEE and Eclipse. + +1. Start Eclipse and from the main menu go to **File** - **New** - **Dynamic Web Project** + +1. Enter a new project name + +1. In the **Target Runtime** section click on the **New Runtime** button. + +1. Pick **Apache Tomcat v7.0** and click Next + +1. Change the **Name** field to *TomEE* to indicate that this is a TomEE server rather than a Tomcat server. + +1. Set the **Tomcat installation directory** by clicking the **Browse** button and selecting the folder +where you extracted TomEE + +1. Click **Finish** to return to the New Project dialog + +1. Click **Finish** to complete creating your new Project + +1. When you're ready to deploy your project, right-click your project and select Run As - Run On Server + +1. Make sure that the *TomEE* environment is selected in the **Server runtime environment** + +1. On the **Run on Server** dialog, click the **Always use this server when running this project** checkbox + +1. Click **Finish** - Eclipse will start TomEE and deploy your project + +## Advanced installation + +1. In Eclipse, click on the **Servers** tab, right click and select New - Server. + +1. Select **Apache - Tomcat v7.0 Server** and click **Next** + +1. Set the **Tomcat installation directory** by clicking the **Browse** button and selecting the folder +where you extracted TomEE + +1. Add your webapp to the server. Click **Finish**. + +1. In the **Servers** tab, double click on your server to open up the **Overview** page. +Click on the **Modules** tab + +1. Click **Add External Web Module**. In the **Add Web Module** dialog, for document base, browse +to `/webapps/tomee`. Set **Path:** to `/tomee`. Uncheck **Auto reloading enabled**. Click OK. + +1. Return to the **Overview** tab for the server. + +1. Deselect the **Modules auto reload by default** checkbox. + +1. If you do not want Eclipse to take control of your TomEE installation, select **Use Workspace Metadata** +under **Server Locations**. Please review the *Workspace Metadata Installation* section below for additional steps +in this scenario. Otherwise, select **Use Tomcat Installation** + +1. Click the Save button in Eclipse so the server configuration gets saved. + +1. Click on your webapp project, then select Project - clean. Hit OK. This will cause +Eclipse to clean and rebuild + +1. In the **Servers** tab, right click on the server and select **Publish**. + +1. Start the server. + +### Workspace Metadata Installation +If you used **Use Workspace Metadata** in the **Server Locations** definition of the TomEE server, +you will have to add TomEE specific configuration files to your Servers project in your workspace +in case you need to change system properties or add containers / resources and have those reflected in the +server running under Eclipse. + +1. Locate your TomEE server configuration in Workspace / Servers + +1. Right-click the server project and select **Import** + +1. Select General - File System and click **Next** + +1. Browse to your `/conf` folder + +1. Select the following files for import: `logging.properties`, `system.properties` and `tomee.xml` + +1. Click **Finish** to import the files. + +1. In the **Servers** tab, right-click the TomEE server and select **Publish** to publish the files to the +Eclipse metadata folder + +If you need to modify system properties or change your TomEE resources, containers, etc., you now need to make +those changes in the Workspace / Servers / `<`Your Server`>` location and publish them to the server for +the changes to take effect. + +### JSP Hot Deployment + +If jsp changes are not being hot deployed then this is because the jsp servlet is set to development=false in the web.xml file. To allow jsp hot deployment alter this value to true and restart Tomee. + +This is the relevant snippet of the web.xml file. + + + jsp + org.apache.jasper.servlet.JspServlet + .... + + development + true + + .... + + +## How to use JULI for TomEE in WTP? + +It seems that WTP doesn't manage correctly Tomcat logging configuration (which needs to be done through +system properties). A quick workaround is to add these properties manually: + + -Djava.util.logging.config.file="/conf/logging.properties" + -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager + +More information on: http://wiki.eclipse.org/WTP_Tomcat_FAQ#How_do_I_enable_the_JULI_logging_in_a_Tomcat_5.5_Server_instance.3F + + + [1]: http://www.youtube.com/watch?v=Lr8pxEACVRI "Getting Started with Apache TomEE" http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tomee-and-hibernate.mdtext ---------------------------------------------------------------------- diff --git a/docs/tomee-and-hibernate.mdtext b/docs/tomee-and-hibernate.mdtext new file mode 100644 index 0000000..79c11d3 --- /dev/null +++ b/docs/tomee-and-hibernate.mdtext @@ -0,0 +1,159 @@ +Title: TomEE and Hibernate + +Apache TomEE ships with OpenJPA as the default JPA provider, however any valid JPA 2.0 provider can be used. + +The basic steps are: + + 1. Add the Hibernate jars to `/lib/` + 2. Configure the webapp or the server to use Hibernate + + +**The atifact versions defined here are just for example, so please feel free to use current library versions.** + +# Webapp Configuration + +Any webapp can specify the JPA provider it would like to use via the `persistence.xml` file, which can be at any of the following locations in a webapp + + - `WEB-INF/persistence.xml` of the `.war` file + - `META-INF/persistence.xml` in any jar located in `WEB-INF/lib/` + +A single webapp may have many `persistence.xml` files and each may use whichever JPA provider it needs. + +The following is an example of a fairly common `persistence.xml` for Hibernate + + + + + org.hibernate.ejb.HibernatePersistence + movieDatabase + movieDatabaseUnmanaged + + + + + + + + +Note, TomEE will automatically add the following property unless it is explicitly configured: + + + +# Server Configuration + +The default JPA provider can be changed at the server level to favor Hibernate over OpenJPA. + +Using the `/conf/system.properties` file or any other valid means of setting `java.lang.System.getProperties()`, the following standard properties can set the detault for any `persistence.xml` file. + + - `javax.persistence.provider` + - `javax.persistence.transactionType` + - `javax.persistence.jtaDataSource` + - `javax.persistence.nonJtaDataSource` + +So, for example, Hibernate can become the default provider via setting + + `CATALINA_OPTS=-Djavax.persistence.provider=org.hibernate.ejb.HibernatePersistence` + +You **must** of course add the Hibernate libraries to `/lib/` for this to work. + +# Hibernate libraries + +Jars needed for Hibernate 4.x: + +Add: + +- `/lib/antlr-2.7.7.jar` +- `/lib/dom4j-1.6.1.jar` +- `/lib/hibernate-commons-annotations-4.0.1.Final.jar` +- `/lib/hibernate-core-4.1.4.Final.jar` +- `/lib/hibernate-entitymanager-4.1.4.Final.jar` +- `/lib/hibernate-validator-4.3.0.Final.jar` +- `/lib/jboss-logging-3.1.0.GA.jar` + +Remove (optional): + +- `/lib/asm-3.2.jar` +- `/lib/openjpa-2.2.0.jar` + +# Ehcache (optional) + +To use Hibernate with Ehcache, add: + +- `/lib/hibernate-ehcache-4.1.4.Final.jar` +- `/lib/ehcache-core-2.5.1.jar` +- `/lib/ehcache-terracotta-2.5.1.jar` +- `/lib/terracotta-toolkit-1.4-runtime-4.1.0.jar` + +# Infinispan (optional) + +To use Infinispan cache (default Hibernate 2nd level cache) you need the below jars: + +

+    org.infinispan:infinispan-core:5.1.4.FINAL
+    org.hibernate:hibernate-infinispan:${hibernate.core.version}
+    org.jgroups:jgroups:3.0.9.Final
+    org.jboss.marshalling:jboss-marshalling-river:1.3.11.GA:
+    org.jboss.marshalling:jboss-marshalling:1.3.11.GA
+    org.codehaus.woodstox:woodstox-core-asl:4.1.1
+    org.codehaus.woodstox:stax2-api:3.1.1
+    org.rhq.helpers:rhq-pluginAnnotations:3.0.4
+    org.jboss.logmanager:jboss-logmanager:1.2.2.GA
+
+ +There are many guides on how to use 2nd level cache with JPA 2. +You can remove OpenJPA jar so less jars are in `/lib` folder. +Also, be sure to put your Database JDBC driver in `/lib`. + +The actual Maven dependencies for your project can be added in the usual way: + + + + antlr + antlr + 2.7.7 + + + dom4j + dom4j + 1.6.1 + + + org.hibernate.common + hibernate-commons-annotations + 4.0.5.Final + + + org.hibernate + hibernate-core + 4.2.16.Final + + + org.hibernate + hibernate-ehcache + 4.2.16.Final + + + org.hibernate + hibernate-entitymanager + 4.2.16.Final + + + org.hibernate + hibernate-validator + 4.3.2.Final + + + org.jboss.logging + jboss-logging + 3.1.0.GA + + + org.javassist + javassist + 3.15.0-GA + http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tomee-and-intellij.mdtext ---------------------------------------------------------------------- diff --git a/docs/tomee-and-intellij.mdtext b/docs/tomee-and-intellij.mdtext new file mode 100644 index 0000000..0358a6b --- /dev/null +++ b/docs/tomee-and-intellij.mdtext @@ -0,0 +1,77 @@ +Title: TomEE and Intellij +Notice: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +Intellij is the preferred editor of most of the developers on Apache TomEE. It's fast and light and goes out of its way +to guess what you're thinking and act accordingly in efforts to save you time and increase your enjoyment. In this regard +TomEE and Intellij have a lot in common. + +While TomEE works with most IDEs via the Tomcat adapter and this covers WAR files, JetBrains has stepped up to the plate +with a TomEE specific adapter to allow deployment of the full range of archives that TomEE supports. The evolving +TomEE/Intellij integration sets the pace for all other IDE integrations. +[Feature requests very welcome!](http://youtrack.jetbrains.com/issues/IDEA) TomEE is to Intellij +what GlassFish is to NetBeans and your feedback is a critcal part of that. + + +# Getting Started + +We will use one of the existing [examples][1] for this demo. Let's import it. + ![alt text][2] + ![alt text][3] + ![alt text][4] + +Give a minute while Intellij imports the dependencies. + ![alt text][5] + +It's time to run the application. Open "Edit Configurations". + ![alt text][6] + +Click the "+" icon and select "TomEE Server" and "Local". + ![alt text][7] + +If your server is still not configured, click the "Configure" button and point it to your local TomEE installation. + ![alt text][8] + +If you see a warning message like "No artifacts marked for deployment", click the "Fix" button and select one of the options. + ![alt text][9] + +You can change the "Application Context". + ![alt text][10] + +Now you can run it. Click the "play" button. + ![alt text][11] + ![alt text][12] + +Your application is up and running. + ![alt text][13] + ![alt text][14] + + + [1]: https://svn.apache.org/repos/asf/tomee/tomee/trunk/examples/ + [2]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_01.png + [3]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_02.png + [4]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_03.png + [5]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_04.png + [6]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_05.png + [7]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_06.png + [8]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_07.png + [9]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_08.png + [10]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_09.png + [11]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_10.png + [12]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_11.png + [13]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_12.png + [14]: http://people.apache.org/~tveronezi/tomee/tomee_site/intellij_integration/windows8_13.png \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tomee-and-netbeans.mdtext ---------------------------------------------------------------------- diff --git a/docs/tomee-and-netbeans.mdtext b/docs/tomee-and-netbeans.mdtext new file mode 100644 index 0000000..b0783e0 --- /dev/null +++ b/docs/tomee-and-netbeans.mdtext @@ -0,0 +1,93 @@ +Title: TomEE and NetBeans +Notice: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +There is some great information over at [Geertjan's Blog](https://blogs.oracle.com/geertjan/entry/tomee_apache_cxf_and_maven) on how to hit the ground running with Netbeans, CXF and Maven. Geertjan is a Netbeans evangelist and has an incredible insight into everything Netbeans. + +**WORKAROUND**: There is a known issue with Netbeans 8 and TomEE detection that currently requires the following workaround: + +Netbeans 8 has a bug in which it fails to find the **tomee-common-[version].jar** in the **[TomEE]/lib** directory. The solution is to simply rename the jar file to an older version. + +For example, you have **[TomEE]/lib/tomee-common-1.6.0.2.jar** or **[TomEE]/lib/tomee-common-1.7.1.jar**. Rename these files to **[TomEE]/lib/tomee-common-1.6.0.jar** + +This should resolve the detection issue and will not break your installation - Be sure to document the change for yourself as a reminder. + +###Quickstart +Check out this video on [How to Consume REST in a Java Client ](https://www.youtube.com/watch?v=HISV7eagogI) + +You can download Netbeans 8 here: [https://netbeans.org/community/releases/80/](https://netbeans.org/community/releases/80/) + +Here is a quick run through on how to set up TomEE. We will use one of the existing examples for this demo. Let's import it. + + ![Subversion Checkout][1] + ![Subversion URL][2] + ![Local Project][3] + ![alt text][4] + +Click 'Open Project'. + + ![alt text][5] + ![alt text][6] + +It's time to add our local TomEE server. Click 'Tools' and then 'Servers'. + + ![alt text][7] + +Select 'Apache Tomcat'. + + ![alt text][8] + +Select your local TomEE directory. + + ![alt text][9] + ![alt text][10] + ![alt text][11] + +It's time to run it. Click the play button. + + ![alt text][12] + +Select 'Apache Tomcat'. + + ![alt text][13] + +Give it some time. It's building your application. + + ![alt text][14] + +Done. Your server is up and running. + + ![alt text][15] + ![alt text][16] + + + [1]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_01.png + [2]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_02.png + [3]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_03.png + [4]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_04.png + [5]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_05.png + [6]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_06.png + [7]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_07.png + [8]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_08.png + [9]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_09.png + [10]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_10.png + [11]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_11.png + [12]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_12.png + [13]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_13.png + [14]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_14.png + [15]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_15.png + [16]: http://people.apache.org/~tveronezi/tomee/tomee_site/netbeans_integration/windows8_16.png \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tomee-and-security.mdtext ---------------------------------------------------------------------- diff --git a/docs/tomee-and-security.mdtext b/docs/tomee-and-security.mdtext new file mode 100644 index 0000000..e6b9123 --- /dev/null +++ b/docs/tomee-and-security.mdtext @@ -0,0 +1,41 @@ +Title: Apache TomEE and security +Notice: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +Rather than providing its own security implementation, TomEE makes full use of the security features that are part of Tomcat. Any Catalina realm is supported or you can provide your own security module using the login.config file. + +For example, to add some simple security to the [moviefun application](http://tomee.apache.org/examples-trunk/webapps/moviefun/README.html) , all we would need to do is: + +1. Add some users to the tomcat-users.xml file +2. Add the necessary @DefineRoles and @RolesAllowed annotations on MoviesImpl +3. Add some security config to do HTTP Basic authentication to web.xml Webservice security is also looked after – username/password based security (HTTP basic, or WS-Security) uses the same Tomcat security. Certificate based security is also available. + +To put it short, + +* TomEE uses Tomcat's Security Realm + +* Extra TomEE layer adds support for JAAS JACC WS Security + +* Supports any org.apache.catalina.Realm implementation + +* E.g. add users to $CATALINA_BASE/conf/tomcat-users.xml + +* Alternatively use login.config to provide your own security module + + +####See Also: +[TomEE-and-JAAS](tomee-jaas.html) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tomee-and-webspheremq.mdtext ---------------------------------------------------------------------- diff --git a/docs/tomee-and-webspheremq.mdtext b/docs/tomee-and-webspheremq.mdtext new file mode 100644 index 0000000..e44aa65 --- /dev/null +++ b/docs/tomee-and-webspheremq.mdtext @@ -0,0 +1,132 @@ +Title: TomEE and WebSphere MQ +Notice: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +**Steps to integrate TomEE with Websphere MQ** + +1. Unzip rar file place jars under tomee/lib + +2. Added the below to conf/tomee.xml + +
+    <tomee>     
+    <Container id="wmq" type="MESSAGE">
+    ResourceAdapter=wmqRA
+    MessageListenerInterface=javax.jms.MessageListener
+    ActivationSpecClass=com.ibm.mq.connector.inbound.ActivationSpecImpl
+    </Container>
+
+
+   <Resource id="wmqRA" type="com.ibm.mq.connector.ResourceAdapterImpl" class-name="com.ibm.mq.connector.ResourceAdapterImpl">
+    connectionConcurrency=5  
+    maxConnections=10 
+    logWriterEnabled=true 
+    reconnectionRetryCount=5 
+    reconnectionRetryInterval=300000 
+    traceEnabled=false 
+    traceLevel=3 
+   </Resource>
+
+   <Resource **id="qcf"**  type="javax.jms.ConnectionFactory" class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl">
+    TransactionSupport=none 
+    ResourceAdapter=wmqRA 
+    HostName=10.a.b.c   
+    Port=1414 
+    QueueManager=QM_TIERL
+   Channel=SYSTEM.ADMIN.SVRCONN
+   TransportType=Client
+   UserName=xyz
+   Password=*****
+  </Resource>
+
+  <Resource id="wmq-javax.jms.QueueConnectionFactory"  type="javax.jms.QueueConnectionFactory" class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl">
+    TransactionSupport=xa 
+    ResourceAdapter=wmqRA 
+  </Resource>
+
+  <Resource id="wmq-javax.jms.TopicConnectionFactory"  type="javax.jms.TopicConnectionFactory" class-name="com.ibm.mq.connector.outbound.ManagedTopicConnectionFactoryImpl">
+    TransactionSupport=xa 
+    ResourceAdapter=wmqRA 
+  </Resource>
+
+  <Resource **id="queue"** type="javax.jms.Queue"  
+class-name="com.ibm.mq.connector.outbound.MQQueueProxy"> 
+    arbitraryProperties 
+    baseQueueManagerName 
+    baseQueueName 
+    CCSID=1208 
+    encoding=NATIVE 
+    expiry=APP 
+    failIfQuiesce=true 
+    persistence=APP 
+    priority=APP 
+    readAheadClosePolicy=ALL 
+    targetClient=JMS 
+  </Resource>
+
+  <Resource id="wmq-javax.jms.Topic" type="javax.jms.Topic" class-name="com.ibm.mq.connector.outbound.MQTopicProxy">
+    arbitraryProperties 
+    baseTopicName 
+    brokerCCDurSubQueue=SYSTEM.JMS.D.CC.SUBSCRIBER.QUEUE 
+    brokerDurSubQueue=SYSTEM.JMS.D.SUBSCRIBER.QUEUE 
+    brokerPubQueue 
+    brokerPubQueueManager 
+    brokerVersion=1 
+    CCSID=1208 
+    encoding=NATIVE 
+    expiry=APP 
+    failIfQuiesce=true 
+    persistence=APP 
+    priority=APP 
+    readAheadClosePolicy=ALL 
+    targetClient=JMS 
+  </Resource> 
+
+ </tomee>	 
+
+3. In web.xml add the below to access resources
+ <resource-ref> 
+     <res-ref-name>myqcf< /res-ref-name> 
+    <res-type>javax.jms.ConnectionFactory < /res-type>
+    <res-auth>Container</res-auth>< /br>
+    <res-sharing-scope>Shareable< /res-sharing-scope>
+    <mapped-name>qcf< /mapped-name>
+  </resource-ref>
+  
+ <resource-env-ref>
+   <resource-env-ref-name>myqueue< /resource-env-ref-name>
+   <resource-env-ref-type>javax.jms.Queue< /resource-env-ref-type>
+   <mapped-name>queue< /mapped-name>
+  </resource-env-ref>
+
+ +**Code:** +
    
+    @Resource(name = "qcf") 
+    private ConnectionFactory connectionFactory; 
+    @Resource(name = "queue") 
+    private Queue queue;
+    Connection connection = connectionFactory.createConnection();
+    Session session = connection.createSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+    MessageProducer producer = session.createProducer(queue);
+    TextMessage message = session.createTextMessage();
+    message.setText("Test Message");
+    connection.start();
+    producer.send(message);
+    session.close();
+    connection.close();
+
\ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tomee-cluster.txt ---------------------------------------------------------------------- diff --git a/docs/tomee-cluster.txt b/docs/tomee-cluster.txt new file mode 100644 index 0000000..e74c37d --- /dev/null +++ b/docs/tomee-cluster.txt @@ -0,0 +1,72 @@ +The scope of this document to to define how Apache TomEE can be configured for HA (High Availability) clustering. + +The configuration will focus on two local instances, with a view to an open ended remote configuration. + +It is beyond the scope of this documentation to discuss Tomcat CLustering in depth. +Please read the [Apache Tomcat Clustering Howto](http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html) for more information. + +###Local cluster +To test clustering locally (on the same physical machine) the default ports need to be modified on the second TomEE server. +You do not need to do this if the second TomEE instance is to run on different machine or virtual host. + +Note: You cannot test load balancing on a local cluster as they will be running of different ports. +This configuration is only useful for testing Session Replication and application deployment. + +In the [TomEE]/conf/server.xml look for and change the following port definitions to something like: + + + + + + + + + +###Test Startup +Start both TomEE servers together and check for and resolve any errors before proceeding any further. + +Once you are sure both servers can run without error add the following to the **** section of both server.xml files: + + ... + + ... + + + + +Start both TomEE servers together and again check for and resolve any errors before proceeding any further. +Basically look in both [TomEE]/logs/catalina.[date].log and search for *"SimpleTcpCluster memberAdded"*. +This lets us know that the cluster added a new member. + +Stop both the servers, as we will need to add some more configuration to the *server.xml*. + +First create the following directory structure within the TomEE installation (You can change the names later to suit your needs if required). + + [TomEE]/cluster + [TomEE]/cluster/temp + [TomEE]/cluster/watch + [TomEE]/cluster/webapps + +We now need to add these paths to the **Host** section of the configuration file: + + ... + + ... + + + + + + ... \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/f779264f/docs/tomee-directory-structure.mdtext ---------------------------------------------------------------------- diff --git a/docs/tomee-directory-structure.mdtext b/docs/tomee-directory-structure.mdtext new file mode 100644 index 0000000..da6d2e0 --- /dev/null +++ b/docs/tomee-directory-structure.mdtext @@ -0,0 +1,57 @@ +Title: +Notice: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +#TomEE Directory Layout: + +TomEE directory layout is the same as that of Tomcat, with a few changes as described below. + +Considering this root to be the $tomee-install-dir> + +
+/bin
+  Added tomee.sh (Access all TomEE tools: cipher, deploy, properties, undeploy)
+  Added TomEE.*.exe (Windows service binaries)
+  Added service*.bat (Windows service installer - uses binaries above)
+  Modified catalina.(sh|bat) (Optional - add the OpenJPA javaagent to enhance JPA entities. Only necessary if you use both JPA and the OpenJPA implementation and you did not enhance bytecode at build time)
+
+/conf
+  Added system.properties (Easy way to configure whatever you want on TomEE. Check it out and look into, you will discover so many interesting properties)
+  Added tomee.xml (The place where you can declare/configure resources, containers, Transaction manager, etc)
+  Modified server.xml (As in tomcat with one extra listener - can configure ports, hosts, engines, threadpools etc)    
+  Modified tomcat-users.xml (optional - only changed to define tomee user to secure the webapp/tomee GUI)
+
+/endorsed
+  Added annotation-api.jar (Override Tomcat default jar, because not compliant with the current JEE 6 specification)
+  Added jaxb-(api|impl).jar (Override JDK 1.6 default implementation cause too old for the JEE 6 specification)
+  
+/lib
+  That's where all the magic is. This directory will receive a set of new jars. First, it gets all openejb-* and tomee-* jars. It also contains dependencies (Specification implementations: openjpa-*, openwebbeans-*, etc).
+  Removed annotation-api.jar (Non compliant with JEE 6 specification. See endorsed/)
+  Removed el-api.jar (Already contained in javaee-api.jar provided by TomEE in that same directory)
+ 
+/webapps    
+  Works the same way as it does for Tomcat. Drop your directories/wars in here!
+  Removed examples (Just because most of people does not care)
+  
+/apps (does not exist by default)
+  Can receive WARs of course, but also JAR and EAR files. Optionally add your resources.xml file here.
+     
+/webapps/tomee (added but optional)
+  The TomEE graphical user interface. That's the administration interface.
+  ** This webapp is mandatory if you need EJBs remote invocation
+
\ No newline at end of file