tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Gallimore <jonathan.gallim...@gmail.com>
Subject Re: Is OpenEJB + Jetty dead?
Date Tue, 01 May 2012 22:31:48 GMT
Just on the self contained jar point - I did at one point have TomEE
embedded inside a .war file, so you could either deploy the .war file in
TomEE, or you could do a java -jar myapp.war which booted an embedded TomEE
and started deployed the app. It still relied on a temporary directory
though - I imagine you could do the same for an all-in-one jar. In essence
you need to do something along these lines:

    public static void start() throws IOException {
        webApp = createWebApp();
        Properties p = new Properties();
        p.setProperty(EJBContainer.APP_NAME, "moviefun");
        p.setProperty(EJBContainer.PROVIDER, "tomee-embedded"); //
need web feature
        p.setProperty(EJBContainer.MODULES, webApp.getAbsolutePath());
        p.setProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT,
"9999");
        container = EJBContainer.createEJBContainer(p);
    }

    public static void stop() {
        if (container != null) {
            container.close();
        }
        if (webApp != null) {
            try {
                FileUtils.forceDelete(webApp);
            } catch (IOException e) {
                FileUtils.deleteQuietly(webApp);
            }
        }
    }

    private static File createWebApp() throws IOException {
        File file = new File(System.getProperty("java.io.tmpdir") +
"/tomee-" + Math.random());
        if (!file.mkdirs() && !file.exists()) {
            throw new RuntimeException("can't create " +
file.getAbsolutePath());
        }

        FileUtils.copyDirectory(new File("target/classes"), new
File(file, "WEB-INF/classes"));
	    FileUtils.copyDirectory(new File("target/test-libs"), new
File(file, "WEB-INF/lib"));
        FileUtils.copyDirectory(new File("src/main/webapp"), file);

        return file;
    }

If I remember correctly, this is basically what our embedded TomEE
arquillian adaptor does (it might have changed since I last had a go with
it), and is basically an extension of the Embedded EJBContainer API.

Check out
http://svn.apache.org/repos/asf/openejb/trunk/openejb/arquillian-tomee/arquillian-tomee-moviefun-example/src/test/java/org/superbiz/moviefun/MoviesHtmlUnitTest.javafor
an example of doing this from a unit test.

Its been a while since I used OpenEJB + Jetty in the manner on the web page
I linked to, but I'd definitely be interested in how you get on. I dare say
it'll need some tweaking but I think the concepts should still be about
right. I have a couple of things I need to clear down at work, and then
I'll definitely be happy to help.

On the certification front, never say never :) but a lot of work is
involved. But if we can get the basics going in a way that works well, then
I'm up for seeing what would be involved in certifying it.

Jon

On Tue, May 1, 2012 at 11:14 PM, Will Hoover <java.whoover@gmail.com> wrote:

> It may be just easier to get Jetty + OpenEJB working. There are also other
> features that make Jetty a nice alternative. I'll look into the interim
> solution that Jonathan proposed.
>
> I guess the answer to a certified OpenEJB + Jetty configuration is out of
> the picture for the foreseeable future, correct?
>
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> Sent: Tuesday, May 01, 2012 3:14 PM
> To: users@openejb.apache.org
> Subject: Re: Is OpenEJB + Jetty dead?
>
> it cant out of the box,
>
> well maybe you should ping tomcat mailing list before. if somebody is
> interesting it can help. Doing it manually should be possible (even if i
> should look further to confirm) but it is really tricky for an end user
> standard usage i guess ;).
>
>
> - Romain
>
>
> 2012/5/1 Will Hoover <java.whoover@gmail.com>
>
> > I would be interested on how to accomplish it.
> >
> > BTW, I know the thread is over a year old, but Mark Thomas says it can't
> be
> > done yet:
> http://grokbase.com/t/tomcat/users/113h2c3j55/tomcat-v7-embedded
> >
> > -----Original Message-----
> > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > Sent: Tuesday, May 01, 2012 2:56 PM
> > To: users@openejb.apache.org
> > Subject: Re: Is OpenEJB + Jetty dead?
> >
> > i didnt try it but as in tomee we add servlet programmatically i dont see
> > anything blocking to do it for listener etc... so i guess that's possible
> > to use tomcat API to do so
> >
> > - Romain
> >
> >
> > 2012/5/1 Will Hoover <java.whoover@gmail.com>
> >
> > > Embedded Tomcat 7 is very limited on functionality. One of the missing
> > > features is the ability to run within a self-contained executable JAR.
> > This
> > > feature is vital when using it as a truly embedded solution. Unless you
> > > know
> > > something that I don't (which could very well be the case)?
> > >
> > > -----Original Message-----
> > > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > > Sent: Tuesday, May 01, 2012 2:39 PM
> > > To: users@openejb.apache.org
> > > Subject: Re: Is OpenEJB + Jetty dead?
> > >
> > > couldnt we use tomcat? i find easy to hack tomcat than starting to
> > > integrate jetty
> > >
> > > thoughts?
> > >
> > > - Romain
> > >
> > >
> > > 2012/5/1 Will Hoover <java.whoover@gmail.com>
> > >
> > > > A basic solution would probably work in the short-term, but at some
> > point
> > > > we
> > > > would need a certified solution going forward due to vendor
> > > > requirements/restrictions.
> > > >
> > > > -----Original Message-----
> > > > From: Jonathan Gallimore [mailto:jonathan.gallimore@gmail.com]
> > > > Sent: Tuesday, May 01, 2012 1:00 PM
> > > > To: users@openejb.apache.org
> > > > Subject: Re: Is OpenEJB + Jetty dead?
> > > >
> > > > There's obviously been a big focus on Tomcat with the work that's
> gone
> > on
> > > > with getting TomEE released and certified. I've always been really
> keen
> > > on
> > > > getting OpenEJB working with Jetty, and have had a very basic setup
> > > working
> > > > which I have previously used for functional testing:
> > > >
> > > >
> > >
> > >
> >
> >
>
> http://openejb.apache.org/functional-testing-with-openejb,-jetty-and-seleniu
> > > > m.html
> > > >
> > > > I'd love to work on this some more if there's demand for it. Getting
> > > > something basic working I suspect wouldn't be too difficult, but
> > getting
> > > a
> > > > certified solution would probably be a lot of work and so would be a
> > > longer
> > > > term goal. Do you need a certified solution or would something more
> > basic
> > > > be
> > > > enough to get you going?
> > > >
> > > > Jon
> > > >
> > > > Sent from my iPad
> > > >
> > > > On 1 May 2012, at 13:41, "Will Hoover" <java.whoover@gmail.com>
> wrote:
> > > >
> > > > > Is the initial OpenEJB + Jetty now a dead initiative?
> > > > >
> > > > >
> > > > >
> > > > > The reason why I ask is because the new embedded feature in Tomcat
> 7
> > > > still
> > > > > is cumbersome to implement when compared to Jetty. This is
> especially
> > > > true
> > > > > when a "real" embedded solution is desired that does not require
a
> > > > directory
> > > > > structure to maintain. Jetty allows you to set handlers without
> > > > designating
> > > > > a home directory for web applications (which is very convenient
> when
> > > > > embedding within Java SE/JavaFX applications). I know Tomcat has
> done
> > > > this
> > > > > for compliance reasons, but just as OpenEJB has revolutionized the
> > EJB
> > > > world
> > > > > by features outside the norm, so has Jetty in some respects. Don't
> > get
> > > me
> > > > > wrong, I love Tomcat and use it extensively when applicable, but
> > > > sometimes
> > > > > it makes more sense to use Jetty.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message