Sorry, I had this message mixed up with another one. What I really wanted to ask was:
Do I have to use the libs included with openEJB for the Bean Annotations described, or can I put javaee.jar, from the J2EE 5, in order to use the annotations from the default of the language itself, and still have the application server pick up the annotations and treat the annotated class as expected? Can I use javaee.jar, in a situation where I just want to or need to for other reasons? Date: Tue, 7 Jun 2011 19:15:05 -0700 From: [email protected] To: [email protected] Subject: Re: OPEN EJB most recent version and POJO's. On Jun 7, 2011, at 5:11 PM, Zachary1234 wrote: > Do I have to use the libs included with JBOSS AS for the Bean Annotations > described, > or can I put javaee.jar, from the J2EE 5, in order to use the annotations > from the default of the language itself, and still have the application server > pick up the annotations and treat the annotated class as expected? > Is there any extra conf/xml configuration required here? OpenEJB and JBoss are both implementations of EJB. Like OSX and Windows. Don't worry, you're not the first person to be confused by the project name and ask for JBoss or WebLogic or other server support :) We're a very patient bunch and understand it's hard when learning. If you wanted to use OpenEJB, this would be the best tutorial: https://cwiki.apache.org/OPENEJBx30/hello-world.html No xml required. Just use the libraries shown in that tutorial and you'll have your first EJB up and running. These examples are very nice too: http://openejb.apache.org/examples.html -David > Date: Tue, 7 Jun 2011 12:07:07 -0700 > From: [hidden email] > To: [hidden email] > Subject: Re: OPEN EJB most recent version and POJO's. > > > > As of EJB 3.0 everything is based on POJOs exactly as you describe. > POJOs with Remote and local access is supported through JNDI lookup. > Different lifecycles are available. And all of it is standard and handled by > the container exactly as you describe. > > > In addition they can offer security and transaction support and interceptors. > Security is off by default, transactions are on by default but can be shut > off, and interceptors don't factor in unless you explicitly add some. > > > On Jun 7, 2011, at 12:47 AM, Zachary1234 wrote: > > >> -A Pojo which I can have instantiated within openEJB > >> by the context.lookup call either > > > - @Stateful gives you a POJO that will be instantiated on lookup. Each > lookup will result in a new instance of the POJO. > > - @Singleton gives you a POJO that will be instantiated on *first* lookup. > Each subsequent lookup will give you a reference to the same bean. > > > See http://openejb.apache.org/3.0/simple-stateful-example.html > See http://openejb.apache.org/3.0/singleton-example.html > > There is another lifecycle called @Stateless, but doesn't sound like what you > want. That is essentially a small pool of reusable instances hooked up to > JNDI. > > > To get something into JNDI you need to use one of these three annotations on > the POJO so we know how you want us to handle its lifecycle when lookups > occur. I.e. it tells us what you want us to give the caller; a new instance, > the same instance, or an instance from a pool. > > >> -from within another static class/object within the same openEJB instance > > > Putting @LocalBean on the pojo class will make it available locally for JNDI > lookup -- no interface required. By default the MyClass pojo will be > available in JNDI under the name "MyPojoLocalBean". This is configurable. > > > Putting @Local on an interface and implementing that interface in the pojo > will make it available locally for lookup. Only the methods of the interface > will be accessible by others in the same VM. By default the MyClass pojo > will be available under the name "MyClassLocal" > > > To lookup specify org.apache.openejb.client.LocalInitialContextFactory as > your Context.INITIAL_CONTEXT_FACTORY when creating the InitialContext, then > use the name described above. > > > Note for unit testing, any @Remote interfaces (described below) can be looked > up from the LocalInitialContextFactory as well. This is nice as the > LocalInitialContextFactory involves no ports or actual networking code. Just > plain direct access to JNDI of the VM you are in. > > >> -on the same PC in a seperate JVM. > >> -Or on a seperate PC in a seperate JVM, through a classic network. > > > Putting @Remote on an interface and implementing that interface in the bean > will make it available remote for lookup and execution from another vm > outside the server, either on the same PC or elsewhere in the network. By > default the MyClass pojo will be available in JNDI under "MyClassRemote". > This is configurable. > > > To lookup from a client in another vm specify > org.apache.openejb.cient.RemoteInitialContextFactory as the > Context.INITIAL_CONTEXT_FACTORY and "ejbd://theserver:4201" as the > Context.PROVIDER_URL. > > > >> Of course, from seperate VM's, I intend to use JNDI. > >> > >> -If just calling a class from within another class, > >> do I just deploy the compiled class in a jar file > >> to the JBOSS AS deployment directory, as per normal? > > > Two options. You can put the app in a server, or you can put the server in > your app. > > > Here is an example if putting the server in your app. > > > http://openejb.apache.org/3.0/embedded-and-remotable.html > > To put the app in a server, you just put the jar file of your app into the > ${openejb.home}/apps/ directory and start the openejb server. > > >> -How can I run code like a main method > >> inside the Microcontainer/AS (non EJB, any version standard)? > > > I'm not sure what you might mean with this one, but the 'embedded-and-remote' > might be what you are after. That gives you a plain 'main method' java > application that can also service requests from remote clients. > > >> -If I then wish to use JNDI for context lookups, > >> how do I declare the POJO in my openEJB .class,.jar? > >> Is a simple annotation necessary for this? > >> -If annotation is necessary, what is the annotation > >> name/import statement/.jar lib filename? > > > This tutorial is a great one for showing all the steps with annotations and > compiling and running. No IDE or build tool is used which makes it easier to > see what is going on: > > > http://openejb.apache.org/hello-world.html > > > -David > > > > > > > > > > > If you reply to this email, your message will be added to the > discussion below: > > http://openejb.979440.n4.nabble.com/OPEN-EJB-most-recent-version-and-POJO-s-tp3576153p3580513.html > > > > To unsubscribe from OPEN EJB most recent version and POJO's., > click here. > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/OPEN-EJB-most-recent-version-and-POJO-s-tp3576153p3581234.html > Sent from the OpenEJB User mailing list archive at Nabble.com. If you reply to this email, your message will be added to the discussion below: http://openejb.979440.n4.nabble.com/OPEN-EJB-most-recent-version-and-POJO-s-tp3576153p3581464.html To unsubscribe from OPEN EJB most recent version and POJO's., click here. -- View this message in context: http://openejb.979440.n4.nabble.com/OPEN-EJB-most-recent-version-and-POJO-s-tp3576153p3581555.html Sent from the OpenEJB User mailing list archive at Nabble.com.
