Hi Lev,

This is not a stupid question, this is just the kind of info that should
make it into the documentation.  Usually this kind of info only makes it
into documentation after someone takes the time to ask the question, so
thank you for asking ;)

Just to add to the "email documentation" we've got going here.

As Jacek said, you only need the IntraVM Server (also called the Local
Server), which is the openejb-0.8.2.jar library.

So basically, all you need is that library your app's or Tomcat's
classpath, you won't need the Remote Server (openejb_server-0.8.2.jar
and openejb_client-0.8.2.jar).  The Remote Server is for accepting
requests that come from other VMs, that's what Jacek means by 2+ VMs.
But all the real EJB logic is in the openejb-0.8.2.jar library, which
can be used like any library such as log4j, xerces, or a jdbc driver.
Think of it as an EJB driver.

Then you point your EJB Clients/Servlets to OpenEJB's IntraVM server
when you create an javax.naming.InitialContext in your code.  Here is an
example of that:

    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.openejb.core.ivm.naming.InitContextFactory");
    p.put("openejb.home", "c:\\dir\\openejb");
    InitialContext ctx = new InitialContext( p );

That's it.  The rest happens automatically.

I'm sure you and everyone are curious, so I'll explain a little of what
goes on behind the scenes.  The first time the above code is called,
OpenEJB will magically "wake-up" and initialize itself.  

This is identical to using a JDBC driver.  In JDBC, you can load your
driver by calling Class.forName("com.my.jdbc.Driver").  That causes your
driver to be loaded into the VM, so you can later get a connection to it
from the DriverManager and use that connection to execute JDBC calls.

Well, that is exactly what's happening here.  When you make that first
call to "new InitialContext( p );", it causes OpenEJB to get loaded into
the VM, then you can lookup beans and make EJB calls like usual.  The
only difference is that we don't need to send them outside the VM to a
server running on another machine.  OpenEJB and all your beans are right
there in your classpath, so we can just invoke the bean and do all the
work in your VM.

Please feel welcome to ask all the questions you want, will help us
greatly in creating better documentation.

Best regards,
David

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Lev
Assinovsky
Sent: Monday, September 09, 2002 1:10 PM
To: Jacek Laskowski
Cc: [EMAIL PROTECTED]
Subject: Re: [OpenEJB-user] TOMCAT & OpenEJB


Sorry, I have to rephrase the question: 
How to run two Main() in the same VM? One from OpenEJB and another one
from Tomcat? 
Another word what should be in place of CLASS in 
java <options ...> CLASS? 
Thanks and sorry for my stupid question. 
Jacek Laskowski wrote: 
Hi Lev, 
What would you like to know other than is described at 
http://openejb.sourceforge.net/tomcat-adapter.html. How would you like 
to see it improved/enhanced ? We're listening... 
-Jacek 
Lev Assinovsky wrote: 
>  >FROM: David Blevins 
>  >DATE: 08/07/2002 16:20:16 
>  >SUBJECT: RE:  [OpenEJB-user] TOMCAT + OpenEJB 
>  >... 
>  >We've known of people using OpenEJB + Tomcat 
>  >in the same VM, but haven't heard from anyone using them on separate

>  >machines through the new Remote Server. 
> 
>  >Thanks, 
>  >David 
> 
> I have found the post above in the mailing archive. 
> David said: We've known of people using OpenEJB + Tomcat in the same
VM. 
> Could the people share their knowledges about using  OpenEJB&Tomcat in

> the same VM ? 
> Thanks in advance! 
> 
> -- 
> Lev Assinovsky                Peterlink Web 
> Programmer                    St. Petersburg, Russia 
> Tel/Fax: +7 812 9418104       197022 ul.Chapigina 7Á 
> E-mail: [EMAIL PROTECTED] 
> 
> 
------------------------------------------------------- 
This sf.net email is sponsored by: OSDN - Tired of that same old 
cell phone?  Get a new here for FREE! 
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 
_______________________________________________ 
http://OpenEJB.sf.net 
OpenEJB-user mailing list 
[EMAIL PROTECTED] 
https://lists.sourceforge.net/lists/listinfo/openejb-user
-- 
Lev Assinovsky                Peterlink Web
Programmer                    St. Petersburg, Russia
Tel/Fax: +7 812 9418104       197022 ul.Chapigina 7Á
E-mail: [EMAIL PROTECTED]
  



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
http://OpenEJB.sf.net
OpenEJB-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/openejb-user

Reply via email to