You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Alex Soto <as...@gmail.com> on 2014/09/17 16:15:49 UTC

Embedded Apache TomEE and WAR deploy

Hi I am using Apache TomEE 1.7.0, and I am trying to deploy a war file
generated with Shrinkwrap into an embedded Apache TomEE. I have seen in
github that in current snapshot this code has been improved to make it
easier. But I am trying to do it with 1.7.0 without much success.

My code is:

try {

  Configuration configuration = new Configuration();
  String tomeeDir =
Files.createTempDirectory("apache-tomee").toFile().getAbsolutePath();
  configuration.setDir(tomeeDir);
  configuration.setHttpPort(8080);

  container = new Container();
  final File app = new
File(Files.createTempDirectory("app").toFile().getAbsolutePath());
  app.deleteOnExit();

  archive.as(ZipExporter.class).exportTo(new File(app, "app.war"), true);
  container.start();
  container.deploy("app", app);

  container.await();
} catch (Exception e) {
          throw new IllegalArgumentException(e);
}

and the war file contains a Servlet extending HttpServlet and annotated
with @WebServlet. I have inspected the dir where log says the application
is deployed INFO: Deployed Application(path=/tmp/app9073998430735933142)

and Servlet is there so I am not sure what is wrong.

Can you see something wrong here?


-- 
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+

Re: Embedded Apache TomEE and WAR deploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
hi

yes a bit different (it forks a process and watch it) to ensure to
side effects due to the embedded thing:

http://rmannibucau.wordpress.com/2014/03/24/java-jar-my-app-in-tomee-jar/
http://rmannibucau.wordpress.com/2014/03/11/executable-jar-with-tomee-and-tomcat-maven-plugin/


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-22 10:16 GMT+02:00 LG Optimusv <lg...@gmail.com>:
> I saw an article on dzone about this and found out that
> tomcat7-maven-plugin allows us to build an executable jar
> <https://tomcat.apache.org/maven-plugin-trunk/executable-war-jar.html>
> (haven't tried it yet). We can even choose the tomcat7 version
> <http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/adjust-embedded-tomcat-version.html>
> for our executable jar. Does tomee-maven-plugin have these features?
>
> On Thu, Sep 18, 2014 at 2:29 AM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
>> can you share your sample please?
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-09-18 8:25 GMT+02:00 Alex Soto <as...@gmail.com>:
>> > Same problem with 1.7.1
>> >
>> > servlet looks like:
>> >
>> > @WebServlet("/hello")
>> > public class HelloWorldServlet extends HttpServlet {
>> >
>> >     protected void doGet(HttpServletRequest request, HttpServletResponse
>> > response) throws ServletException, IOException {
>> >
>> >         PrintWriter writer = response.getWriter();
>> >         writer.println("Hello World");
>> >
>> >     }
>> > }
>> >
>> > 2014-09-17 16:55 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
>> >
>> >> it is on repo1
>> >>
>> >>
>> >> Romain Manni-Bucau
>> >> Twitter: @rmannibucau
>> >> Blog: http://rmannibucau.wordpress.com/
>> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> Github: https://github.com/rmannibucau
>> >>
>> >>
>> >> 2014-09-17 16:53 GMT+02:00 Alex Soto <as...@gmail.com>:
>> >> > Ok now it is not released on maven central repo yet, so when it is
>> >> > available I will downloaded.
>> >> >
>> >> > 2014-09-17 16:52 GMT+02:00 Romain Manni-Bucau <rmannibucau@gmail.com
>> >:
>> >> >
>> >> >> Hi Alex
>> >> >>
>> >> >> can you test against 1.7.1 before we investigate futher please?
>> >> >>
>> >> >>
>> >> >> Romain Manni-Bucau
>> >> >> Twitter: @rmannibucau
>> >> >> Blog: http://rmannibucau.wordpress.com/
>> >> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> >> Github: https://github.com/rmannibucau
>> >> >>
>> >> >>
>> >> >> 2014-09-17 16:15 GMT+02:00 Alex Soto <as...@gmail.com>:
>> >> >> > Hi I am using Apache TomEE 1.7.0, and I am trying to deploy a war
>> file
>> >> >> > generated with Shrinkwrap into an embedded Apache TomEE. I have
>> seen
>> >> in
>> >> >> > github that in current snapshot this code has been improved to
>> make it
>> >> >> > easier. But I am trying to do it with 1.7.0 without much success.
>> >> >> >
>> >> >> > My code is:
>> >> >> >
>> >> >> > try {
>> >> >> >
>> >> >> >   Configuration configuration = new Configuration();
>> >> >> >   String tomeeDir =
>> >> >> >
>> Files.createTempDirectory("apache-tomee").toFile().getAbsolutePath();
>> >> >> >   configuration.setDir(tomeeDir);
>> >> >> >   configuration.setHttpPort(8080);
>> >> >> >
>> >> >> >   container = new Container();
>> >> >> >   final File app = new
>> >> >> > File(Files.createTempDirectory("app").toFile().getAbsolutePath());
>> >> >> >   app.deleteOnExit();
>> >> >> >
>> >> >> >   archive.as(ZipExporter.class).exportTo(new File(app, "app.war"),
>> >> >> true);
>> >> >> >   container.start();
>> >> >> >   container.deploy("app", app);
>> >> >> >
>> >> >> >   container.await();
>> >> >> > } catch (Exception e) {
>> >> >> >           throw new IllegalArgumentException(e);
>> >> >> > }
>> >> >> >
>> >> >> > and the war file contains a Servlet extending HttpServlet and
>> >> annotated
>> >> >> > with @WebServlet. I have inspected the dir where log says the
>> >> application
>> >> >> > is deployed INFO: Deployed
>> >> Application(path=/tmp/app9073998430735933142)
>> >> >> >
>> >> >> > and Servlet is there so I am not sure what is wrong.
>> >> >> >
>> >> >> > Can you see something wrong here?
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > +----------------------------------------------------------+
>> >> >> >   Alex Soto Bueno - Computer Engineer
>> >> >> >   www.lordofthejars.com
>> >> >> > +----------------------------------------------------------+
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > +----------------------------------------------------------+
>> >> >   Alex Soto Bueno - Computer Engineer
>> >> >   www.lordofthejars.com
>> >> > +----------------------------------------------------------+
>> >>
>> >
>> >
>> >
>> > --
>> > +----------------------------------------------------------+
>> >   Alex Soto Bueno - Computer Engineer
>> >   www.lordofthejars.com
>> > +----------------------------------------------------------+
>>

Re: Embedded Apache TomEE and WAR deploy

Posted by LG Optimusv <lg...@gmail.com>.
I saw an article on dzone about this and found out that
tomcat7-maven-plugin allows us to build an executable jar
<https://tomcat.apache.org/maven-plugin-trunk/executable-war-jar.html>
(haven't tried it yet). We can even choose the tomcat7 version
<http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/adjust-embedded-tomcat-version.html>
for our executable jar. Does tomee-maven-plugin have these features?

On Thu, Sep 18, 2014 at 2:29 AM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> can you share your sample please?
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-09-18 8:25 GMT+02:00 Alex Soto <as...@gmail.com>:
> > Same problem with 1.7.1
> >
> > servlet looks like:
> >
> > @WebServlet("/hello")
> > public class HelloWorldServlet extends HttpServlet {
> >
> >     protected void doGet(HttpServletRequest request, HttpServletResponse
> > response) throws ServletException, IOException {
> >
> >         PrintWriter writer = response.getWriter();
> >         writer.println("Hello World");
> >
> >     }
> > }
> >
> > 2014-09-17 16:55 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
> >
> >> it is on repo1
> >>
> >>
> >> Romain Manni-Bucau
> >> Twitter: @rmannibucau
> >> Blog: http://rmannibucau.wordpress.com/
> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> Github: https://github.com/rmannibucau
> >>
> >>
> >> 2014-09-17 16:53 GMT+02:00 Alex Soto <as...@gmail.com>:
> >> > Ok now it is not released on maven central repo yet, so when it is
> >> > available I will downloaded.
> >> >
> >> > 2014-09-17 16:52 GMT+02:00 Romain Manni-Bucau <rmannibucau@gmail.com
> >:
> >> >
> >> >> Hi Alex
> >> >>
> >> >> can you test against 1.7.1 before we investigate futher please?
> >> >>
> >> >>
> >> >> Romain Manni-Bucau
> >> >> Twitter: @rmannibucau
> >> >> Blog: http://rmannibucau.wordpress.com/
> >> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> >> Github: https://github.com/rmannibucau
> >> >>
> >> >>
> >> >> 2014-09-17 16:15 GMT+02:00 Alex Soto <as...@gmail.com>:
> >> >> > Hi I am using Apache TomEE 1.7.0, and I am trying to deploy a war
> file
> >> >> > generated with Shrinkwrap into an embedded Apache TomEE. I have
> seen
> >> in
> >> >> > github that in current snapshot this code has been improved to
> make it
> >> >> > easier. But I am trying to do it with 1.7.0 without much success.
> >> >> >
> >> >> > My code is:
> >> >> >
> >> >> > try {
> >> >> >
> >> >> >   Configuration configuration = new Configuration();
> >> >> >   String tomeeDir =
> >> >> >
> Files.createTempDirectory("apache-tomee").toFile().getAbsolutePath();
> >> >> >   configuration.setDir(tomeeDir);
> >> >> >   configuration.setHttpPort(8080);
> >> >> >
> >> >> >   container = new Container();
> >> >> >   final File app = new
> >> >> > File(Files.createTempDirectory("app").toFile().getAbsolutePath());
> >> >> >   app.deleteOnExit();
> >> >> >
> >> >> >   archive.as(ZipExporter.class).exportTo(new File(app, "app.war"),
> >> >> true);
> >> >> >   container.start();
> >> >> >   container.deploy("app", app);
> >> >> >
> >> >> >   container.await();
> >> >> > } catch (Exception e) {
> >> >> >           throw new IllegalArgumentException(e);
> >> >> > }
> >> >> >
> >> >> > and the war file contains a Servlet extending HttpServlet and
> >> annotated
> >> >> > with @WebServlet. I have inspected the dir where log says the
> >> application
> >> >> > is deployed INFO: Deployed
> >> Application(path=/tmp/app9073998430735933142)
> >> >> >
> >> >> > and Servlet is there so I am not sure what is wrong.
> >> >> >
> >> >> > Can you see something wrong here?
> >> >> >
> >> >> >
> >> >> > --
> >> >> > +----------------------------------------------------------+
> >> >> >   Alex Soto Bueno - Computer Engineer
> >> >> >   www.lordofthejars.com
> >> >> > +----------------------------------------------------------+
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > +----------------------------------------------------------+
> >> >   Alex Soto Bueno - Computer Engineer
> >> >   www.lordofthejars.com
> >> > +----------------------------------------------------------+
> >>
> >
> >
> >
> > --
> > +----------------------------------------------------------+
> >   Alex Soto Bueno - Computer Engineer
> >   www.lordofthejars.com
> > +----------------------------------------------------------+
>

Re: Embedded Apache TomEE and WAR deploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
can you share your sample please?


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-18 8:25 GMT+02:00 Alex Soto <as...@gmail.com>:
> Same problem with 1.7.1
>
> servlet looks like:
>
> @WebServlet("/hello")
> public class HelloWorldServlet extends HttpServlet {
>
>     protected void doGet(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
>
>         PrintWriter writer = response.getWriter();
>         writer.println("Hello World");
>
>     }
> }
>
> 2014-09-17 16:55 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
>
>> it is on repo1
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-09-17 16:53 GMT+02:00 Alex Soto <as...@gmail.com>:
>> > Ok now it is not released on maven central repo yet, so when it is
>> > available I will downloaded.
>> >
>> > 2014-09-17 16:52 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
>> >
>> >> Hi Alex
>> >>
>> >> can you test against 1.7.1 before we investigate futher please?
>> >>
>> >>
>> >> Romain Manni-Bucau
>> >> Twitter: @rmannibucau
>> >> Blog: http://rmannibucau.wordpress.com/
>> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> Github: https://github.com/rmannibucau
>> >>
>> >>
>> >> 2014-09-17 16:15 GMT+02:00 Alex Soto <as...@gmail.com>:
>> >> > Hi I am using Apache TomEE 1.7.0, and I am trying to deploy a war file
>> >> > generated with Shrinkwrap into an embedded Apache TomEE. I have seen
>> in
>> >> > github that in current snapshot this code has been improved to make it
>> >> > easier. But I am trying to do it with 1.7.0 without much success.
>> >> >
>> >> > My code is:
>> >> >
>> >> > try {
>> >> >
>> >> >   Configuration configuration = new Configuration();
>> >> >   String tomeeDir =
>> >> > Files.createTempDirectory("apache-tomee").toFile().getAbsolutePath();
>> >> >   configuration.setDir(tomeeDir);
>> >> >   configuration.setHttpPort(8080);
>> >> >
>> >> >   container = new Container();
>> >> >   final File app = new
>> >> > File(Files.createTempDirectory("app").toFile().getAbsolutePath());
>> >> >   app.deleteOnExit();
>> >> >
>> >> >   archive.as(ZipExporter.class).exportTo(new File(app, "app.war"),
>> >> true);
>> >> >   container.start();
>> >> >   container.deploy("app", app);
>> >> >
>> >> >   container.await();
>> >> > } catch (Exception e) {
>> >> >           throw new IllegalArgumentException(e);
>> >> > }
>> >> >
>> >> > and the war file contains a Servlet extending HttpServlet and
>> annotated
>> >> > with @WebServlet. I have inspected the dir where log says the
>> application
>> >> > is deployed INFO: Deployed
>> Application(path=/tmp/app9073998430735933142)
>> >> >
>> >> > and Servlet is there so I am not sure what is wrong.
>> >> >
>> >> > Can you see something wrong here?
>> >> >
>> >> >
>> >> > --
>> >> > +----------------------------------------------------------+
>> >> >   Alex Soto Bueno - Computer Engineer
>> >> >   www.lordofthejars.com
>> >> > +----------------------------------------------------------+
>> >>
>> >
>> >
>> >
>> > --
>> > +----------------------------------------------------------+
>> >   Alex Soto Bueno - Computer Engineer
>> >   www.lordofthejars.com
>> > +----------------------------------------------------------+
>>
>
>
>
> --
> +----------------------------------------------------------+
>   Alex Soto Bueno - Computer Engineer
>   www.lordofthejars.com
> +----------------------------------------------------------+

Re: Embedded Apache TomEE and WAR deploy

Posted by Alex Soto <as...@gmail.com>.
Same problem with 1.7.1

servlet looks like:

@WebServlet("/hello")
public class HelloWorldServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {

        PrintWriter writer = response.getWriter();
        writer.println("Hello World");

    }
}

2014-09-17 16:55 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:

> it is on repo1
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-09-17 16:53 GMT+02:00 Alex Soto <as...@gmail.com>:
> > Ok now it is not released on maven central repo yet, so when it is
> > available I will downloaded.
> >
> > 2014-09-17 16:52 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
> >
> >> Hi Alex
> >>
> >> can you test against 1.7.1 before we investigate futher please?
> >>
> >>
> >> Romain Manni-Bucau
> >> Twitter: @rmannibucau
> >> Blog: http://rmannibucau.wordpress.com/
> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> Github: https://github.com/rmannibucau
> >>
> >>
> >> 2014-09-17 16:15 GMT+02:00 Alex Soto <as...@gmail.com>:
> >> > Hi I am using Apache TomEE 1.7.0, and I am trying to deploy a war file
> >> > generated with Shrinkwrap into an embedded Apache TomEE. I have seen
> in
> >> > github that in current snapshot this code has been improved to make it
> >> > easier. But I am trying to do it with 1.7.0 without much success.
> >> >
> >> > My code is:
> >> >
> >> > try {
> >> >
> >> >   Configuration configuration = new Configuration();
> >> >   String tomeeDir =
> >> > Files.createTempDirectory("apache-tomee").toFile().getAbsolutePath();
> >> >   configuration.setDir(tomeeDir);
> >> >   configuration.setHttpPort(8080);
> >> >
> >> >   container = new Container();
> >> >   final File app = new
> >> > File(Files.createTempDirectory("app").toFile().getAbsolutePath());
> >> >   app.deleteOnExit();
> >> >
> >> >   archive.as(ZipExporter.class).exportTo(new File(app, "app.war"),
> >> true);
> >> >   container.start();
> >> >   container.deploy("app", app);
> >> >
> >> >   container.await();
> >> > } catch (Exception e) {
> >> >           throw new IllegalArgumentException(e);
> >> > }
> >> >
> >> > and the war file contains a Servlet extending HttpServlet and
> annotated
> >> > with @WebServlet. I have inspected the dir where log says the
> application
> >> > is deployed INFO: Deployed
> Application(path=/tmp/app9073998430735933142)
> >> >
> >> > and Servlet is there so I am not sure what is wrong.
> >> >
> >> > Can you see something wrong here?
> >> >
> >> >
> >> > --
> >> > +----------------------------------------------------------+
> >> >   Alex Soto Bueno - Computer Engineer
> >> >   www.lordofthejars.com
> >> > +----------------------------------------------------------+
> >>
> >
> >
> >
> > --
> > +----------------------------------------------------------+
> >   Alex Soto Bueno - Computer Engineer
> >   www.lordofthejars.com
> > +----------------------------------------------------------+
>



-- 
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+

Re: Embedded Apache TomEE and WAR deploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
it is on repo1


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-17 16:53 GMT+02:00 Alex Soto <as...@gmail.com>:
> Ok now it is not released on maven central repo yet, so when it is
> available I will downloaded.
>
> 2014-09-17 16:52 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
>
>> Hi Alex
>>
>> can you test against 1.7.1 before we investigate futher please?
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-09-17 16:15 GMT+02:00 Alex Soto <as...@gmail.com>:
>> > Hi I am using Apache TomEE 1.7.0, and I am trying to deploy a war file
>> > generated with Shrinkwrap into an embedded Apache TomEE. I have seen in
>> > github that in current snapshot this code has been improved to make it
>> > easier. But I am trying to do it with 1.7.0 without much success.
>> >
>> > My code is:
>> >
>> > try {
>> >
>> >   Configuration configuration = new Configuration();
>> >   String tomeeDir =
>> > Files.createTempDirectory("apache-tomee").toFile().getAbsolutePath();
>> >   configuration.setDir(tomeeDir);
>> >   configuration.setHttpPort(8080);
>> >
>> >   container = new Container();
>> >   final File app = new
>> > File(Files.createTempDirectory("app").toFile().getAbsolutePath());
>> >   app.deleteOnExit();
>> >
>> >   archive.as(ZipExporter.class).exportTo(new File(app, "app.war"),
>> true);
>> >   container.start();
>> >   container.deploy("app", app);
>> >
>> >   container.await();
>> > } catch (Exception e) {
>> >           throw new IllegalArgumentException(e);
>> > }
>> >
>> > and the war file contains a Servlet extending HttpServlet and annotated
>> > with @WebServlet. I have inspected the dir where log says the application
>> > is deployed INFO: Deployed Application(path=/tmp/app9073998430735933142)
>> >
>> > and Servlet is there so I am not sure what is wrong.
>> >
>> > Can you see something wrong here?
>> >
>> >
>> > --
>> > +----------------------------------------------------------+
>> >   Alex Soto Bueno - Computer Engineer
>> >   www.lordofthejars.com
>> > +----------------------------------------------------------+
>>
>
>
>
> --
> +----------------------------------------------------------+
>   Alex Soto Bueno - Computer Engineer
>   www.lordofthejars.com
> +----------------------------------------------------------+

Re: Embedded Apache TomEE and WAR deploy

Posted by Alex Soto <as...@gmail.com>.
Ok now it is not released on maven central repo yet, so when it is
available I will downloaded.

2014-09-17 16:52 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:

> Hi Alex
>
> can you test against 1.7.1 before we investigate futher please?
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-09-17 16:15 GMT+02:00 Alex Soto <as...@gmail.com>:
> > Hi I am using Apache TomEE 1.7.0, and I am trying to deploy a war file
> > generated with Shrinkwrap into an embedded Apache TomEE. I have seen in
> > github that in current snapshot this code has been improved to make it
> > easier. But I am trying to do it with 1.7.0 without much success.
> >
> > My code is:
> >
> > try {
> >
> >   Configuration configuration = new Configuration();
> >   String tomeeDir =
> > Files.createTempDirectory("apache-tomee").toFile().getAbsolutePath();
> >   configuration.setDir(tomeeDir);
> >   configuration.setHttpPort(8080);
> >
> >   container = new Container();
> >   final File app = new
> > File(Files.createTempDirectory("app").toFile().getAbsolutePath());
> >   app.deleteOnExit();
> >
> >   archive.as(ZipExporter.class).exportTo(new File(app, "app.war"),
> true);
> >   container.start();
> >   container.deploy("app", app);
> >
> >   container.await();
> > } catch (Exception e) {
> >           throw new IllegalArgumentException(e);
> > }
> >
> > and the war file contains a Servlet extending HttpServlet and annotated
> > with @WebServlet. I have inspected the dir where log says the application
> > is deployed INFO: Deployed Application(path=/tmp/app9073998430735933142)
> >
> > and Servlet is there so I am not sure what is wrong.
> >
> > Can you see something wrong here?
> >
> >
> > --
> > +----------------------------------------------------------+
> >   Alex Soto Bueno - Computer Engineer
> >   www.lordofthejars.com
> > +----------------------------------------------------------+
>



-- 
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+

Re: Embedded Apache TomEE and WAR deploy

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Alex

can you test against 1.7.1 before we investigate futher please?


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-17 16:15 GMT+02:00 Alex Soto <as...@gmail.com>:
> Hi I am using Apache TomEE 1.7.0, and I am trying to deploy a war file
> generated with Shrinkwrap into an embedded Apache TomEE. I have seen in
> github that in current snapshot this code has been improved to make it
> easier. But I am trying to do it with 1.7.0 without much success.
>
> My code is:
>
> try {
>
>   Configuration configuration = new Configuration();
>   String tomeeDir =
> Files.createTempDirectory("apache-tomee").toFile().getAbsolutePath();
>   configuration.setDir(tomeeDir);
>   configuration.setHttpPort(8080);
>
>   container = new Container();
>   final File app = new
> File(Files.createTempDirectory("app").toFile().getAbsolutePath());
>   app.deleteOnExit();
>
>   archive.as(ZipExporter.class).exportTo(new File(app, "app.war"), true);
>   container.start();
>   container.deploy("app", app);
>
>   container.await();
> } catch (Exception e) {
>           throw new IllegalArgumentException(e);
> }
>
> and the war file contains a Servlet extending HttpServlet and annotated
> with @WebServlet. I have inspected the dir where log says the application
> is deployed INFO: Deployed Application(path=/tmp/app9073998430735933142)
>
> and Servlet is there so I am not sure what is wrong.
>
> Can you see something wrong here?
>
>
> --
> +----------------------------------------------------------+
>   Alex Soto Bueno - Computer Engineer
>   www.lordofthejars.com
> +----------------------------------------------------------+