You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Dain Sundstrom <da...@iq80.com> on 2007/09/13 01:32:49 UTC
Tomcat Installer
I added a basic installer servlet for Tomcat, and am looking for some
people to try it out and help with the UI (see below).
Installation:
1. copy openejb-tomcat-3.0.0-SNAPSHOT-bin.zip to your Tomcat webapps
directory
2. make sure Tomcat is running
3. visit http://localhost:8080/openejb/installer and click the
install button
4. Assuming you don't get any errors, reboot tomcat
Once complete, simply include EJBs in your war WEB-INF/classes or WEB-
INF/lib/*.jar using either annotated classes or via a META-INF/ejb-
jar.xml file.
Restrictions:
o The installer only runs on Unix. Windows support will require a
tweaked catalina.bat and a work around for Windows file locking.
Cygwin won't work either and will require even more work arounds in
the Unix code to deal with pathing problems.
o There is no uninstaller. Currently, the installer deletes the non-
compliant Tomcat annotations-api.jar so in addition to backing out
the changes, you need to restore this file.
o Annotations in servlets to OpenEJB resources (EJBs,
PersistenceUnits, Topics, Queues, DataSources, etc) don't resolve.
You will have to use global JNDI for the time being.
o There is no security integration. I suggest you don't even try
using secured EJB in Tomcat embedded mode yet.
o Only works with Tomcat 6.
As you will see, the UI is what I like to call stone and chisel, and
would appreciate any help making it look like the rest of OpenEJB.
The UI is rendered in the
org.apache.openejb.tomcat.installer.InstallerServlet class and the
real work is done in the Paths and Installer helper classes. The
page has form that lets the user change the location of the Tomcat
home dir, base dir and server.xml file, but I think we should hide
this items for normal users since the defaults almost always work.
For advanced users we could have a button that reveal those text boxes.
I appreciate any help on this.
Thanks,
-dain
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
Aah, I just copied the lookup code from another example.
Can you show me how would i look up an ejb in this case?
On 9/12/07, Karan Malhi <ka...@gmail.com> wrote:
> Dain,
>
> Installation was successful!!.
>
> However, I put my bean classes in the classes directory, tried to look
> it up from a servlet and am getting the following exceptoin. What am I
> doing wrong? I am just tired, prolly need a strong cup of coffee.
>
> javax.naming.ServiceUnavailableException: Cannot lookup
> '/GreetingBeanBusinessRemote'. [Root exception is
> java.net.ConnectException: Cannot connect to server
> 'foo://127.0.0.1:4201'. Check that the server is started and that the
> specified serverURL is correct.]
> at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:203)
> at javax.naming.InitialContext.lookup(InitialContext.java:351)
> at org.acme.TestServlet.doGet(TestServlet.java:18)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: java.net.ConnectException: Cannot connect to server
> 'foo://127.0.0.1:4201'. Check that the server is started and that the
> specified serverURL is correct.
> at org.apache.openejb.client.SocketConnectionFactory$SocketConnection.open(SocketConnectionFactory.java:55)
> at org.apache.openejb.client.SocketConnectionFactory.getConnection(SocketConnectionFactory.java:35)
> at org.apache.openejb.client.ConnectionManager.getConnection(ConnectionManager.java:43)
> at org.apache.openejb.client.Client.processRequest(Client.java:63)
> at org.apache.openejb.client.Client.request(Client.java:43)
> at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:74)
> at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:199)
>
>
> On 9/12/07, Dain Sundstrom <da...@iq80.com> wrote:
> > I added a basic installer servlet for Tomcat, and am looking for some
> > people to try it out and help with the UI (see below).
> >
> > Installation:
> > 1. copy openejb-tomcat-3.0.0-SNAPSHOT-bin.zip to your Tomcat webapps
> > directory
> > 2. make sure Tomcat is running
> > 3. visit http://localhost:8080/openejb/installer and click the
> > install button
> > 4. Assuming you don't get any errors, reboot tomcat
> >
> > Once complete, simply include EJBs in your war WEB-INF/classes or WEB-
> > INF/lib/*.jar using either annotated classes or via a META-INF/ejb-
> > jar.xml file.
> >
> > Restrictions:
> > o The installer only runs on Unix. Windows support will require a
> > tweaked catalina.bat and a work around for Windows file locking.
> > Cygwin won't work either and will require even more work arounds in
> > the Unix code to deal with pathing problems.
> > o There is no uninstaller. Currently, the installer deletes the non-
> > compliant Tomcat annotations-api.jar so in addition to backing out
> > the changes, you need to restore this file.
> > o Annotations in servlets to OpenEJB resources (EJBs,
> > PersistenceUnits, Topics, Queues, DataSources, etc) don't resolve.
> > You will have to use global JNDI for the time being.
> > o There is no security integration. I suggest you don't even try
> > using secured EJB in Tomcat embedded mode yet.
> > o Only works with Tomcat 6.
> >
> > As you will see, the UI is what I like to call stone and chisel, and
> > would appreciate any help making it look like the rest of OpenEJB.
> > The UI is rendered in the
> > org.apache.openejb.tomcat.installer.InstallerServlet class and the
> > real work is done in the Paths and Installer helper classes. The
> > page has form that lets the user change the location of the Tomcat
> > home dir, base dir and server.xml file, but I think we should hide
> > this items for normal users since the defaults almost always work.
> > For advanced users we could have a button that reveal those text boxes.
> >
> > I appreciate any help on this.
> >
> > Thanks,
> >
> > -dain
> >
>
>
> --
> Karan Singh Malhi
>
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by David Blevins <da...@visi.com>.
On Sep 12, 2007, at 8:56 PM, Karan Malhi wrote:
> We would need an apache logo also, right? I can pick it up from
> our home page
Using the logo isn't a requirement. We can skip it as it messes with
the color scheme.
We can change the text though to add Apache as in "Apache OpenEJB and
Tomcat Integration Page"
-David
>
> On 9/12/07, David Blevins <da...@visi.com> wrote:
>>
>> On Sep 12, 2007, at 8:43 PM, David Blevins wrote:
>>
>>>
>>> On Sep 12, 2007, at 7:37 PM, Karan Malhi wrote:
>>>
>>>>> So, what needs to be done with the UI? I mean what do we need
>>>>> the UI
>>>>> for basically?
>>>> I basically meant that , if all we have to do is click on the
>>>> button,
>>>> then we basically just need to make that page look like
>>>> openejb.apache.org, by this i mean the colors, logo , footer etc,
>>>> right? Or are there other features you are looking to put in there
>>>> for
>>>> which you need help with the UI?
>>>
>>> Download this and checkout the old integration. This is OpenEJB
>>> 0.9.2 and Tomcat 4.0.6
>>>
>>> http://people.apache.org/~dblevins/openejb-tomcat.tar.gz
>>>
>>> When you download that and extract it, just start tomcat from
>>> inside the jakarta-tomcat-4.0.6 directory. I.e.
>>>
>>> $ cd openejb-tomcat/jakarta-tomcat-4.0.6
>>> $ ./bin/startup.sh
>>>
>>> Make sure you use jdk 1.4!
>>>
>>> It'd be great if we could get back there.
>>>
>>
>> Here are some screenshots:
>>
>> http://people.apache.org/~dblevins/screenshots/
>>
>> -David
>>
>>
>>
>>
>
>
> --
> Karan Singh Malhi
>
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
We would need an apache logo also, right? I can pick it up from our home page
On 9/12/07, David Blevins <da...@visi.com> wrote:
>
> On Sep 12, 2007, at 8:43 PM, David Blevins wrote:
>
> >
> > On Sep 12, 2007, at 7:37 PM, Karan Malhi wrote:
> >
> >>> So, what needs to be done with the UI? I mean what do we need the UI
> >>> for basically?
> >> I basically meant that , if all we have to do is click on the button,
> >> then we basically just need to make that page look like
> >> openejb.apache.org, by this i mean the colors, logo , footer etc,
> >> right? Or are there other features you are looking to put in there
> >> for
> >> which you need help with the UI?
> >
> > Download this and checkout the old integration. This is OpenEJB
> > 0.9.2 and Tomcat 4.0.6
> >
> > http://people.apache.org/~dblevins/openejb-tomcat.tar.gz
> >
> > When you download that and extract it, just start tomcat from
> > inside the jakarta-tomcat-4.0.6 directory. I.e.
> >
> > $ cd openejb-tomcat/jakarta-tomcat-4.0.6
> > $ ./bin/startup.sh
> >
> > Make sure you use jdk 1.4!
> >
> > It'd be great if we could get back there.
> >
>
> Here are some screenshots:
>
> http://people.apache.org/~dblevins/screenshots/
>
> -David
>
>
>
>
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
Great, I got it working and looks pretty cool actually.
On 9/12/07, David Blevins <da...@visi.com> wrote:
>
> On Sep 12, 2007, at 8:43 PM, David Blevins wrote:
>
> >
> > On Sep 12, 2007, at 7:37 PM, Karan Malhi wrote:
> >
> >>> So, what needs to be done with the UI? I mean what do we need the UI
> >>> for basically?
> >> I basically meant that , if all we have to do is click on the button,
> >> then we basically just need to make that page look like
> >> openejb.apache.org, by this i mean the colors, logo , footer etc,
> >> right? Or are there other features you are looking to put in there
> >> for
> >> which you need help with the UI?
> >
> > Download this and checkout the old integration. This is OpenEJB
> > 0.9.2 and Tomcat 4.0.6
> >
> > http://people.apache.org/~dblevins/openejb-tomcat.tar.gz
> >
> > When you download that and extract it, just start tomcat from
> > inside the jakarta-tomcat-4.0.6 directory. I.e.
> >
> > $ cd openejb-tomcat/jakarta-tomcat-4.0.6
> > $ ./bin/startup.sh
> >
> > Make sure you use jdk 1.4!
> >
> > It'd be great if we could get back there.
> >
>
> Here are some screenshots:
>
> http://people.apache.org/~dblevins/screenshots/
>
> -David
>
>
>
>
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by David Blevins <da...@visi.com>.
On Sep 12, 2007, at 8:43 PM, David Blevins wrote:
>
> On Sep 12, 2007, at 7:37 PM, Karan Malhi wrote:
>
>>> So, what needs to be done with the UI? I mean what do we need the UI
>>> for basically?
>> I basically meant that , if all we have to do is click on the button,
>> then we basically just need to make that page look like
>> openejb.apache.org, by this i mean the colors, logo , footer etc,
>> right? Or are there other features you are looking to put in there
>> for
>> which you need help with the UI?
>
> Download this and checkout the old integration. This is OpenEJB
> 0.9.2 and Tomcat 4.0.6
>
> http://people.apache.org/~dblevins/openejb-tomcat.tar.gz
>
> When you download that and extract it, just start tomcat from
> inside the jakarta-tomcat-4.0.6 directory. I.e.
>
> $ cd openejb-tomcat/jakarta-tomcat-4.0.6
> $ ./bin/startup.sh
>
> Make sure you use jdk 1.4!
>
> It'd be great if we could get back there.
>
Here are some screenshots:
http://people.apache.org/~dblevins/screenshots/
-David
Re: Tomcat Installer
Posted by David Blevins <da...@visi.com>.
On Sep 12, 2007, at 7:37 PM, Karan Malhi wrote:
>> So, what needs to be done with the UI? I mean what do we need the UI
>> for basically?
> I basically meant that , if all we have to do is click on the button,
> then we basically just need to make that page look like
> openejb.apache.org, by this i mean the colors, logo , footer etc,
> right? Or are there other features you are looking to put in there for
> which you need help with the UI?
Download this and checkout the old integration. This is OpenEJB
0.9.2 and Tomcat 4.0.6
http://people.apache.org/~dblevins/openejb-tomcat.tar.gz
When you download that and extract it, just start tomcat from inside
the jakarta-tomcat-4.0.6 directory. I.e.
$ cd openejb-tomcat/jakarta-tomcat-4.0.6
$ ./bin/startup.sh
Make sure you use jdk 1.4!
It'd be great if we could get back there.
-David
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
> So, what needs to be done with the UI? I mean what do we need the UI
> for basically?
I basically meant that , if all we have to do is click on the button,
then we basically just need to make that page look like
openejb.apache.org, by this i mean the colors, logo , footer etc,
right? Or are there other features you are looking to put in there for
which you need help with the UI?
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
Oops,
Sorry, forgot to paste the url for the instructions
http://cwiki.apache.org/confluence/display/OPENEJB/New+Instructions
On 9/13/07, Karan Malhi <ka...@gmail.com> wrote:
> Dario,
>
> Here are the instructions. This also contains an example application.
>
> On 9/13/07, Karan Malhi <ka...@gmail.com> wrote:
> > > Karan, can you show me your example? I still didn't get jndi lookup to work yet.
> >
> > Dario,
> >
> > Will document it on the wiki and send you the link.
> > --
> > Karan Singh Malhi
> >
>
>
> --
> Karan Singh Malhi
>
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
Dario,
Here are the instructions. This also contains an example application.
On 9/13/07, Karan Malhi <ka...@gmail.com> wrote:
> > Karan, can you show me your example? I still didn't get jndi lookup to work yet.
>
> Dario,
>
> Will document it on the wiki and send you the link.
> --
> Karan Singh Malhi
>
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
> Karan, can you show me your example? I still didn't get jndi lookup to work yet.
Dario,
Will document it on the wiki and send you the link.
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by Dain Sundstrom <da...@iq80.com>.
On Sep 14, 2007, at 11:57 AM, David Blevins wrote:
> It does have a thing called AnnotationProcessor which will inject
> @EJB, @Resource and the like by looking them up from the web
> module's jndi tree, but it never puts them in there in the first
> place. So effectively nothing is injected. So what we need to do
> is grab the web.xml, find all the servlets, filters, and listeners
> scrape them for annotations and create and bind the required
> objects into the web module's jndi tree. Then when Tomcat creates
> a servlet, filter, or listener the Tomcat AnnotationProcessor will
> again scrape the object for annotations, look for the objects in
> jndi, *find* them (we put them there) and finally inject them.
and that is what I'm working on right now.
-dain
Re: Tomcat Installer
Posted by David Blevins <da...@visi.com>.
On Sep 14, 2007, at 10:44 AM, Dario Laverde wrote:
> Thanks for clarifying David, so with the agent and annotation
> issues aside, I still
> don't understand what's tricky in supporting @EJB, @Resource, etc.
> compared to
> standalone OpenEJB. I'd for one would like to see this working out
> of the box and
> would like to help Dain out here if feasible.
Great! All the help we can get here is really fantastic.
The @EJB, @Resource, etc. work out of the box for ejb modules and
client modules, but not for anything in the web module (servlet,
filter, listener) as Tomcat is the one who creates and injects on
those objects and it ignores those things for the most part.
It does have a thing called AnnotationProcessor which will inject
@EJB, @Resource and the like by looking them up from the web module's
jndi tree, but it never puts them in there in the first place. So
effectively nothing is injected. So what we need to do is grab the
web.xml, find all the servlets, filters, and listeners scrape them
for annotations and create and bind the required objects into the web
module's jndi tree. Then when Tomcat creates a servlet, filter, or
listener the Tomcat AnnotationProcessor will again scrape the object
for annotations, look for the objects in jndi, *find* them (we put
them there) and finally inject them.
Other things that need to be done are to restore the jsps that did
this: http://people.apache.org/~dblevins/screenshots
Skin the installer to look like the above
Security integration
Take your pick!
-David
Re: Tomcat Installer
Posted by Dario Laverde <da...@nycjava.net>.
Thanks for clarifying David, so with the agent and annotation issues aside, I still
don't understand what's tricky in supporting @EJB, @Resource, etc. compared to
standalone OpenEJB. I'd for one would like to see this working out of the box and
would like to help Dain out here if feasible.
-Dario
> On Sep 13, 2007, at 1:35 PM, Dario Laverde wrote:
>
>> Actually it would be nice to have the reverse of:
>>
>> openejb.remotable.businessLocals=true
>>
>> esp for tomcat+openejb i.e. where remote lookups become local lookups.
>
> You can set "openejb.localcopy=false" to shut of the spec required
> pass by value semantics for remote interfaces. All remote interfaces
> will be pass by reference exactly as local interfaces are.
>
> Other than that, using the LocalInitialContextFactory doesn't involve
> sockets, ports and net connections, we just have to add the copy
> semantics on remote interfaces (copying via serializing and
> deserializaing) per spec rules which can be shut off as shown above.
>
>> Restrictions
>> o The installer only runs on Unix. Windows support will require a
>> tweaked catalina.bat and a work around for Windows file locking.
>>
>> This is only because of backing up catalina.sh for adding javaagent
>> correct? Why
>> exactly do we need the agent? Again, I'm more interested in the
>> multiple instance
>> and not the single instance of OpenEJB per Tomcat.
>
> AGENT (OPENJPA)
>
> It's OpenJPA that requires the agent for enhancing byte code of JPA
> beans and the classes that reference JPA beans. They very recently
> started adding unenhanced support but it's only 80 there still.
> Maybe more, but not 100% yet. When they get the unenhanced support
> nailed, we can skip the agent installation unless you want it for
> performance (enhanced mode is faster than unenhanced mode).
>
> Installing the agent into the catalina.bat file is just as easy on
> windows, just lack of time on this one. /me hangs up a help wanted sign
> It can still be done by hand, or you can skip it completely if you
> don't plan to use CMP or JPA, or if you wish to use a different JPA
> provider like hibernate.
>
> INVALID ANNOTATIONS-API.JAR
>
> The other thing is that Tomcat has a completely non-compliant
> annotations-api.jar where @Resource, @EJB and the like have all the
> wrong attributes. When they fix it, this headache will be gone and
> half of the "reboot" issues will go away and a windows installer will
> be easy (it is easy now to just replace the jar manually).
>
> Until they fix it, no compliant JavaEE 5 apps will run! So we have
> to get it out of the classpath and put a working one in. If this
> happens at runtime, you'll have to reboot to get those old class
> definitions out. You can do this part by hand ahead of time when
> Tomcat is shutdown, just delete annotations-api.jar and replace it
> with geronimo-annotation_1.0_spec-1.1.jar.
>
> The trick with doing this on a running Tomcat installation is that
> windows locks the jar files if they are in a classpath of a living
> classloader and won't allow you modify, move or delete them (no write
> access of any kind). There might be some vm specific tricks we can
> pull to get around this, but just as with linux you'll have to reboot
> to get the invalid class definitions out of the tomcat classloaders.
>
>> o There is no uninstaller. Currently, the installer deletes the non-
>> compliant Tomcat annotations-api.jar so in addition to backing out
>> the changes, you need to restore this file.
>>
>> Could you at least backup it up to .orig like you did with
>> catalina.sh and server.xml?
>
> We can do that, but any apps using the compliant annotations jar
> might not run with the non-compliant annotations jar. You're better
> off keeping the compliant jar.
>
>> o Annotations in servlets to OpenEJB resources (EJBs,
>> PersistenceUnits, Topics, Queues, DataSources, etc) don't resolve.
>> You will have to use global JNDI for the time being.
>>
>> This is a show stopper IMO - is it because of having more than one
>> classloader?
>
> Just time. Tomcat doesn't process any of this stuff so we have to do
> it for them. Dain's already working on it.
>
>> Can we also avoid the reboot re: server.xml by moving the listener
>> into the webapp's
>> web.xml instead?
>
> As noted above the reboot is primarily to get the agent in and the
> annotations jar fixed. If those weren't there we could probably find
> a way to avoid the server restart and still install our listener.
>
>> Again, I'm more interested in the multiple instance
>> and not the single instance of OpenEJB per Tomcat.
>
> Just to note, both approaches work in the same integration; i.e. you
> can put ejbs in the tomcat lib dir or anywhere you specify in a
> <Deployments> declaration in your openejb.xml file, as well as having
> ejbs right in your webapp in collapsed ear style.
>
> What no longer works is having OpenEJB itself embedded right in your
> webapp and not visible to other webapps. Were the agent and
> annotation jar issues fixed we could probably do that again, however
> it'd be tricky to support new things like processing @EJB and
> @Resource, etc. annotations for Servlets, Filters and Listeners in
> the webapp where OpenEJB is embedded as there's a sort of chicken and
> egg problem. We can certainly give it a go if this is what people want.
>
> Thoughts?
>
>
>
Re: Tomcat Installer
Posted by David Blevins <da...@visi.com>.
On Sep 13, 2007, at 1:35 PM, Dario Laverde wrote:
> Actually it would be nice to have the reverse of:
>
> openejb.remotable.businessLocals=true
>
> esp for tomcat+openejb i.e. where remote lookups become local lookups.
You can set "openejb.localcopy=false" to shut of the spec required
pass by value semantics for remote interfaces. All remote interfaces
will be pass by reference exactly as local interfaces are.
Other than that, using the LocalInitialContextFactory doesn't involve
sockets, ports and net connections, we just have to add the copy
semantics on remote interfaces (copying via serializing and
deserializaing) per spec rules which can be shut off as shown above.
> Restrictions
> o The installer only runs on Unix. Windows support will require a
> tweaked catalina.bat and a work around for Windows file locking.
>
> This is only because of backing up catalina.sh for adding javaagent
> correct? Why
> exactly do we need the agent? Again, I'm more interested in the
> multiple instance
> and not the single instance of OpenEJB per Tomcat.
AGENT (OPENJPA)
It's OpenJPA that requires the agent for enhancing byte code of JPA
beans and the classes that reference JPA beans. They very recently
started adding unenhanced support but it's only 80 there still.
Maybe more, but not 100% yet. When they get the unenhanced support
nailed, we can skip the agent installation unless you want it for
performance (enhanced mode is faster than unenhanced mode).
Installing the agent into the catalina.bat file is just as easy on
windows, just lack of time on this one. /me hangs up a help wanted sign
It can still be done by hand, or you can skip it completely if you
don't plan to use CMP or JPA, or if you wish to use a different JPA
provider like hibernate.
INVALID ANNOTATIONS-API.JAR
The other thing is that Tomcat has a completely non-compliant
annotations-api.jar where @Resource, @EJB and the like have all the
wrong attributes. When they fix it, this headache will be gone and
half of the "reboot" issues will go away and a windows installer will
be easy (it is easy now to just replace the jar manually).
Until they fix it, no compliant JavaEE 5 apps will run! So we have
to get it out of the classpath and put a working one in. If this
happens at runtime, you'll have to reboot to get those old class
definitions out. You can do this part by hand ahead of time when
Tomcat is shutdown, just delete annotations-api.jar and replace it
with geronimo-annotation_1.0_spec-1.1.jar.
The trick with doing this on a running Tomcat installation is that
windows locks the jar files if they are in a classpath of a living
classloader and won't allow you modify, move or delete them (no write
access of any kind). There might be some vm specific tricks we can
pull to get around this, but just as with linux you'll have to reboot
to get the invalid class definitions out of the tomcat classloaders.
> o There is no uninstaller. Currently, the installer deletes the non-
> compliant Tomcat annotations-api.jar so in addition to backing out
> the changes, you need to restore this file.
>
> Could you at least backup it up to .orig like you did with
> catalina.sh and server.xml?
We can do that, but any apps using the compliant annotations jar
might not run with the non-compliant annotations jar. You're better
off keeping the compliant jar.
> o Annotations in servlets to OpenEJB resources (EJBs,
> PersistenceUnits, Topics, Queues, DataSources, etc) don't resolve.
> You will have to use global JNDI for the time being.
>
> This is a show stopper IMO - is it because of having more than one
> classloader?
Just time. Tomcat doesn't process any of this stuff so we have to do
it for them. Dain's already working on it.
> Can we also avoid the reboot re: server.xml by moving the listener
> into the webapp's
> web.xml instead?
As noted above the reboot is primarily to get the agent in and the
annotations jar fixed. If those weren't there we could probably find
a way to avoid the server restart and still install our listener.
> Again, I'm more interested in the multiple instance
> and not the single instance of OpenEJB per Tomcat.
Just to note, both approaches work in the same integration; i.e. you
can put ejbs in the tomcat lib dir or anywhere you specify in a
<Deployments> declaration in your openejb.xml file, as well as having
ejbs right in your webapp in collapsed ear style.
What no longer works is having OpenEJB itself embedded right in your
webapp and not visible to other webapps. Were the agent and
annotation jar issues fixed we could probably do that again, however
it'd be tricky to support new things like processing @EJB and
@Resource, etc. annotations for Servlets, Filters and Listeners in
the webapp where OpenEJB is embedded as there's a sort of chicken and
egg problem. We can certainly give it a go if this is what people want.
Thoughts?
Re: Tomcat Installer
Posted by Dario Laverde <da...@nycjava.net>.
Thanks Karan, Dain and David for looking into the issues I was having.
Karan, can you show me your example? I still didn't get jndi lookup to work yet.
Actually it would be nice to have the reverse of:
openejb.remotable.businessLocals=true
esp for tomcat+openejb i.e. where remote lookups become local lookups.
Dain, I have some problems with the restrictions hwn using the installer:
Restrictions
o The installer only runs on Unix. Windows support will require a
tweaked catalina.bat and a work around for Windows file locking.
This is only because of backing up catalina.sh for adding javaagent correct? Why
exactly do we need the agent? Again, I'm more interested in the multiple instance
and not the single instance of OpenEJB per Tomcat.
o There is no uninstaller. Currently, the installer deletes the non-
compliant Tomcat annotations-api.jar so in addition to backing out
the changes, you need to restore this file.
Could you at least backup it up to .orig like you did with catalina.sh and server.xml?
o Annotations in servlets to OpenEJB resources (EJBs,
PersistenceUnits, Topics, Queues, DataSources, etc) don't resolve.
You will have to use global JNDI for the time being.
This is a show stopper IMO - is it because of having more than one classloader?
Can we also avoid the reboot re: server.xml by moving the listener into the webapp's
web.xml instead?
thanks,
Dario
> Works!! , verrry cool ;). I will update the docs, even though Dain has
> already written 99.9% of it, I will just add an example and probably
> add a couple of more steps to make it more step by step.
>
> So, what needs to be done with the UI? I mean what do we need the UI
> for basically?
>
> On 9/12/07, Karan Malhi <ka...@gmail.com> wrote:
>> Thanks David
>>
>> On 9/12/07, David Blevins <da...@visi.com> wrote:
>> >
>> > On Sep 12, 2007, at 6:27 PM, Karan Malhi wrote:
>> >
>> > > Dain,
>> > >
>> > > Installation was successful!!.
>> > >
>> > > However, I put my bean classes in the classes directory, tried to look
>> > > it up from a servlet and am getting the following exceptoin. What am I
>> > > doing wrong? I am just tired, prolly need a strong cup of coffee.
>> > >
>> > > javax.naming.ServiceUnavailableException: Cannot lookup
>> > > '/GreetingBeanBusinessRemote'. [Root exception is
>> > > java.net.ConnectException: Cannot connect to server
>> > > 'foo://127.0.0.1:4201'. Check that the server is started and that the
>> > > specified serverURL is correct.]
>> >
>> >
>> > You should use the LocalInitialContextFactory instead of the
>> > RemoteInitialContextFactory.
>> >
>> > The LocalInitialContextFactory is used to connect to containers in
>> > your vm.
>> > The RemoteInitialContextFactory is used to connect over a network to
>> > containers in another vm.
>> >
>> > You could use the RemoteInitialContextFactory to connect to ejbs in
>> > your webapp, but you'd have to specify the serverUrl which would be
>> > something like this:
>> >
>> > Properties p = new Properties();
>> > p.put("java.naming.factory.initial",
>> > "org.apache.openejb.client.RemoteInitialContextFactory");
>> > p.put("java.naming.provider.url", "http://127.0.0.1:8080/openejb/
>> > ejb");
>> > InitialContext context = new InitialContext(p);
>> > context.lookup("GreetingBeanBusinessRemote");
>> >
>> > Though, I'd only ever use that style if you wanted to connect via a
>> > standalone EJB client application. Use the
>> > LocalInitialContextFactory for looking up anything in your same vm.
>> >
>> > Properties p = new Properties();
>> > p.put("java.naming.factory.initial",
>> > "org.apache.openejb.client.LocalInitialContextFactory");
>> > InitialContext context = new InitialContext(p);
>> > context.lookup("GreetingBeanBusinessRemote");
>> >
>> >
>> > -David
>> >
>> >
>>
>>
>> --
>> Karan Singh Malhi
>>
>
>
> --
> Karan Singh Malhi
>
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
Works!! , verrry cool ;). I will update the docs, even though Dain has
already written 99.9% of it, I will just add an example and probably
add a couple of more steps to make it more step by step.
So, what needs to be done with the UI? I mean what do we need the UI
for basically?
On 9/12/07, Karan Malhi <ka...@gmail.com> wrote:
> Thanks David
>
> On 9/12/07, David Blevins <da...@visi.com> wrote:
> >
> > On Sep 12, 2007, at 6:27 PM, Karan Malhi wrote:
> >
> > > Dain,
> > >
> > > Installation was successful!!.
> > >
> > > However, I put my bean classes in the classes directory, tried to look
> > > it up from a servlet and am getting the following exceptoin. What am I
> > > doing wrong? I am just tired, prolly need a strong cup of coffee.
> > >
> > > javax.naming.ServiceUnavailableException: Cannot lookup
> > > '/GreetingBeanBusinessRemote'. [Root exception is
> > > java.net.ConnectException: Cannot connect to server
> > > 'foo://127.0.0.1:4201'. Check that the server is started and that the
> > > specified serverURL is correct.]
> >
> >
> > You should use the LocalInitialContextFactory instead of the
> > RemoteInitialContextFactory.
> >
> > The LocalInitialContextFactory is used to connect to containers in
> > your vm.
> > The RemoteInitialContextFactory is used to connect over a network to
> > containers in another vm.
> >
> > You could use the RemoteInitialContextFactory to connect to ejbs in
> > your webapp, but you'd have to specify the serverUrl which would be
> > something like this:
> >
> > Properties p = new Properties();
> > p.put("java.naming.factory.initial",
> > "org.apache.openejb.client.RemoteInitialContextFactory");
> > p.put("java.naming.provider.url", "http://127.0.0.1:8080/openejb/
> > ejb");
> > InitialContext context = new InitialContext(p);
> > context.lookup("GreetingBeanBusinessRemote");
> >
> > Though, I'd only ever use that style if you wanted to connect via a
> > standalone EJB client application. Use the
> > LocalInitialContextFactory for looking up anything in your same vm.
> >
> > Properties p = new Properties();
> > p.put("java.naming.factory.initial",
> > "org.apache.openejb.client.LocalInitialContextFactory");
> > InitialContext context = new InitialContext(p);
> > context.lookup("GreetingBeanBusinessRemote");
> >
> >
> > -David
> >
> >
>
>
> --
> Karan Singh Malhi
>
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
Thanks David
On 9/12/07, David Blevins <da...@visi.com> wrote:
>
> On Sep 12, 2007, at 6:27 PM, Karan Malhi wrote:
>
> > Dain,
> >
> > Installation was successful!!.
> >
> > However, I put my bean classes in the classes directory, tried to look
> > it up from a servlet and am getting the following exceptoin. What am I
> > doing wrong? I am just tired, prolly need a strong cup of coffee.
> >
> > javax.naming.ServiceUnavailableException: Cannot lookup
> > '/GreetingBeanBusinessRemote'. [Root exception is
> > java.net.ConnectException: Cannot connect to server
> > 'foo://127.0.0.1:4201'. Check that the server is started and that the
> > specified serverURL is correct.]
>
>
> You should use the LocalInitialContextFactory instead of the
> RemoteInitialContextFactory.
>
> The LocalInitialContextFactory is used to connect to containers in
> your vm.
> The RemoteInitialContextFactory is used to connect over a network to
> containers in another vm.
>
> You could use the RemoteInitialContextFactory to connect to ejbs in
> your webapp, but you'd have to specify the serverUrl which would be
> something like this:
>
> Properties p = new Properties();
> p.put("java.naming.factory.initial",
> "org.apache.openejb.client.RemoteInitialContextFactory");
> p.put("java.naming.provider.url", "http://127.0.0.1:8080/openejb/
> ejb");
> InitialContext context = new InitialContext(p);
> context.lookup("GreetingBeanBusinessRemote");
>
> Though, I'd only ever use that style if you wanted to connect via a
> standalone EJB client application. Use the
> LocalInitialContextFactory for looking up anything in your same vm.
>
> Properties p = new Properties();
> p.put("java.naming.factory.initial",
> "org.apache.openejb.client.LocalInitialContextFactory");
> InitialContext context = new InitialContext(p);
> context.lookup("GreetingBeanBusinessRemote");
>
>
> -David
>
>
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by David Blevins <da...@visi.com>.
On Sep 12, 2007, at 6:27 PM, Karan Malhi wrote:
> Dain,
>
> Installation was successful!!.
>
> However, I put my bean classes in the classes directory, tried to look
> it up from a servlet and am getting the following exceptoin. What am I
> doing wrong? I am just tired, prolly need a strong cup of coffee.
>
> javax.naming.ServiceUnavailableException: Cannot lookup
> '/GreetingBeanBusinessRemote'. [Root exception is
> java.net.ConnectException: Cannot connect to server
> 'foo://127.0.0.1:4201'. Check that the server is started and that the
> specified serverURL is correct.]
You should use the LocalInitialContextFactory instead of the
RemoteInitialContextFactory.
The LocalInitialContextFactory is used to connect to containers in
your vm.
The RemoteInitialContextFactory is used to connect over a network to
containers in another vm.
You could use the RemoteInitialContextFactory to connect to ejbs in
your webapp, but you'd have to specify the serverUrl which would be
something like this:
Properties p = new Properties();
p.put("java.naming.factory.initial",
"org.apache.openejb.client.RemoteInitialContextFactory");
p.put("java.naming.provider.url", "http://127.0.0.1:8080/openejb/
ejb");
InitialContext context = new InitialContext(p);
context.lookup("GreetingBeanBusinessRemote");
Though, I'd only ever use that style if you wanted to connect via a
standalone EJB client application. Use the
LocalInitialContextFactory for looking up anything in your same vm.
Properties p = new Properties();
p.put("java.naming.factory.initial",
"org.apache.openejb.client.LocalInitialContextFactory");
InitialContext context = new InitialContext(p);
context.lookup("GreetingBeanBusinessRemote");
-David
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
Dain,
Installation was successful!!.
However, I put my bean classes in the classes directory, tried to look
it up from a servlet and am getting the following exceptoin. What am I
doing wrong? I am just tired, prolly need a strong cup of coffee.
javax.naming.ServiceUnavailableException: Cannot lookup
'/GreetingBeanBusinessRemote'. [Root exception is
java.net.ConnectException: Cannot connect to server
'foo://127.0.0.1:4201'. Check that the server is started and that the
specified serverURL is correct.]
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:203)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.acme.TestServlet.doGet(TestServlet.java:18)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.net.ConnectException: Cannot connect to server
'foo://127.0.0.1:4201'. Check that the server is started and that the
specified serverURL is correct.
at org.apache.openejb.client.SocketConnectionFactory$SocketConnection.open(SocketConnectionFactory.java:55)
at org.apache.openejb.client.SocketConnectionFactory.getConnection(SocketConnectionFactory.java:35)
at org.apache.openejb.client.ConnectionManager.getConnection(ConnectionManager.java:43)
at org.apache.openejb.client.Client.processRequest(Client.java:63)
at org.apache.openejb.client.Client.request(Client.java:43)
at org.apache.openejb.client.JNDIContext.request(JNDIContext.java:74)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:199)
On 9/12/07, Dain Sundstrom <da...@iq80.com> wrote:
> I added a basic installer servlet for Tomcat, and am looking for some
> people to try it out and help with the UI (see below).
>
> Installation:
> 1. copy openejb-tomcat-3.0.0-SNAPSHOT-bin.zip to your Tomcat webapps
> directory
> 2. make sure Tomcat is running
> 3. visit http://localhost:8080/openejb/installer and click the
> install button
> 4. Assuming you don't get any errors, reboot tomcat
>
> Once complete, simply include EJBs in your war WEB-INF/classes or WEB-
> INF/lib/*.jar using either annotated classes or via a META-INF/ejb-
> jar.xml file.
>
> Restrictions:
> o The installer only runs on Unix. Windows support will require a
> tweaked catalina.bat and a work around for Windows file locking.
> Cygwin won't work either and will require even more work arounds in
> the Unix code to deal with pathing problems.
> o There is no uninstaller. Currently, the installer deletes the non-
> compliant Tomcat annotations-api.jar so in addition to backing out
> the changes, you need to restore this file.
> o Annotations in servlets to OpenEJB resources (EJBs,
> PersistenceUnits, Topics, Queues, DataSources, etc) don't resolve.
> You will have to use global JNDI for the time being.
> o There is no security integration. I suggest you don't even try
> using secured EJB in Tomcat embedded mode yet.
> o Only works with Tomcat 6.
>
> As you will see, the UI is what I like to call stone and chisel, and
> would appreciate any help making it look like the rest of OpenEJB.
> The UI is rendered in the
> org.apache.openejb.tomcat.installer.InstallerServlet class and the
> real work is done in the Paths and Installer helper classes. The
> page has form that lets the user change the location of the Tomcat
> home dir, base dir and server.xml file, but I think we should hide
> this items for normal users since the defaults almost always work.
> For advanced users we could have a button that reveal those text boxes.
>
> I appreciate any help on this.
>
> Thanks,
>
> -dain
>
--
Karan Singh Malhi
Re: Tomcat Installer
Posted by Karan Malhi <ka...@gmail.com>.
I am available for the help with the UI . Trying it out right now
On 9/12/07, Dain Sundstrom <da...@iq80.com> wrote:
> I added a basic installer servlet for Tomcat, and am looking for some
> people to try it out and help with the UI (see below).
>
> Installation:
> 1. copy openejb-tomcat-3.0.0-SNAPSHOT-bin.zip to your Tomcat webapps
> directory
> 2. make sure Tomcat is running
> 3. visit http://localhost:8080/openejb/installer and click the
> install button
> 4. Assuming you don't get any errors, reboot tomcat
>
> Once complete, simply include EJBs in your war WEB-INF/classes or WEB-
> INF/lib/*.jar using either annotated classes or via a META-INF/ejb-
> jar.xml file.
>
> Restrictions:
> o The installer only runs on Unix. Windows support will require a
> tweaked catalina.bat and a work around for Windows file locking.
> Cygwin won't work either and will require even more work arounds in
> the Unix code to deal with pathing problems.
> o There is no uninstaller. Currently, the installer deletes the non-
> compliant Tomcat annotations-api.jar so in addition to backing out
> the changes, you need to restore this file.
> o Annotations in servlets to OpenEJB resources (EJBs,
> PersistenceUnits, Topics, Queues, DataSources, etc) don't resolve.
> You will have to use global JNDI for the time being.
> o There is no security integration. I suggest you don't even try
> using secured EJB in Tomcat embedded mode yet.
> o Only works with Tomcat 6.
>
> As you will see, the UI is what I like to call stone and chisel, and
> would appreciate any help making it look like the rest of OpenEJB.
> The UI is rendered in the
> org.apache.openejb.tomcat.installer.InstallerServlet class and the
> real work is done in the Paths and Installer helper classes. The
> page has form that lets the user change the location of the Tomcat
> home dir, base dir and server.xml file, but I think we should hide
> this items for normal users since the defaults almost always work.
> For advanced users we could have a button that reveal those text boxes.
>
> I appreciate any help on this.
>
> Thanks,
>
> -dain
>
--
Karan Singh Malhi