Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 97448200D21 for ; Mon, 2 Oct 2017 08:02:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8C8A21609D9; Mon, 2 Oct 2017 06:02:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AAC871609C8 for ; Mon, 2 Oct 2017 08:02:45 +0200 (CEST) Received: (qmail 28166 invoked by uid 500); 2 Oct 2017 06:02:43 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 28155 invoked by uid 99); 2 Oct 2017 06:02:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Oct 2017 06:02:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 4E3FE19080F for ; Mon, 2 Oct 2017 06:02:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.379 X-Spam-Level: *** X-Spam-Status: No, score=3.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, MANY_SPAN_IN_TEXT=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id PElvv9FjDBES for ; Mon, 2 Oct 2017 06:02:40 +0000 (UTC) Received: from mail-oi0-f46.google.com (mail-oi0-f46.google.com [209.85.218.46]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 0CDF25F366 for ; Mon, 2 Oct 2017 06:02:40 +0000 (UTC) Received: by mail-oi0-f46.google.com with SMTP id n82so242078oig.3 for ; Sun, 01 Oct 2017 23:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=1z2bkgo1HCXnuQiYS0EBXJYTozVWULPYtbNfYM+7eT4=; b=cnNbwjM3fmyhSV0OfnBM0O3NQefXNNk0VhnLPC72H88ZGStTpmzgXfgp53Nr1JbCE8 26HTfsdEg/7/EbNZfSybAAXG2k7aAjCPN8r78QvPDO6xdwhK0naHhwdXbq0OMtitIdlj wjcrup9WXC923icS6piAuzJEHmTHWF9VE05NDTPxuSO8GWBUcrb9WjLCurNBHib34gRH 8yaHgIKxcHFBPuVGW2evoAz93sIwTwZdLHIGLoSjEX5KpF0ptIvFImFydor2aiweobOa apMcHf5uaaZBK3BoWBPxSxQyE+w0jVR8vbPVKCatqtrBXpSoLC40kpVSNTpL6M7ZiDGh QdLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=1z2bkgo1HCXnuQiYS0EBXJYTozVWULPYtbNfYM+7eT4=; b=HUari25NRZNIpK8zB0v2sna7aXR3a/WdFgQTzNHKik6KtDImXfdt0RX7xdkMrv8C6g YkFbqMI1wom0D2mdgMMIr5m8hDXReKXbIga0EoTvoAJdwnTNwYdqWhqokPeMSYB7LMMQ 9PmcABGS8rNEFqcO1fSnASlQyhUMRVzvXeG1kCI5MZ4LME4xtnXOzWeWiaU0bkDxutBo Sdbl6srpvokbYaBB9V7Wkv9GAfz19xZruEgkaHT6nzl97vkMiRg9tAb3+wDq41rGzYsM /XhXI4H08wNNSE13Gd8Ts3djifnZwSURkDq0HTvpczk8bnh5nXF2SGX/ICIse1dyzMIm xM9A== X-Gm-Message-State: AMCzsaX3e/kmFjgGBnMwJFD1x++a7VeDLT7FVyC8kfmuB+rDhAkS/rop d+yoFSQDUbnGhjJQwkUWVRWaL66Nh9hpItlX0uA6SUq9 X-Google-Smtp-Source: AOwi7QDNUdG74HRwckXg7KXD4LHQQCNJNeNurpWp/noJc6TzqDVgaf0YwBkCndI6BXhZpco3ggcqe25ZmKAgoE9FjKM= X-Received: by 10.157.62.28 with SMTP id a28mr6175646otd.191.1506924158432; Sun, 01 Oct 2017 23:02:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.144.232 with HTTP; Sun, 1 Oct 2017 23:02:37 -0700 (PDT) In-Reply-To: References: From: Brian Toal Date: Sun, 1 Oct 2017 23:02:37 -0700 Message-ID: Subject: Re: Building a uber/fat jar To: Tomcat Users List Content-Type: multipart/alternative; boundary="f403045e423e2abe89055a8a1fb1" archived-at: Mon, 02 Oct 2017 06:02:46 -0000 --f403045e423e2abe89055a8a1fb1 Content-Type: text/plain; charset="UTF-8" thanks John, I want to decouple my solution from web.xml completely, so the goal is to have the container to scan all jars on the classpath and look for Servlet 3.0 annotations and do the necessary (register servlet context listeners, filters, servlets, etc). The container starts, but none of the corresponding annotations are processed. I have various jars on the classpath that contain implementations of the Servlet 3.0 annotation. I'm most certain I'm missing the configuration that is required to get Tomcat to do the scanning and processing, but i'm not aware of what that would be. Any ideas what that would I would need to add? Here's a snippet of what my code looks like so far. See [1] for full source. public void start(ApplicationContext acac) { try { Tomcat tomcat = new Tomcat(); tomcat.setPort(8080); // init http connector tomcat.getConnector(); File base = new File("."); Context ctx = tomcat.addContext("", base.getAbsolutePath()); ServletContext servletContext = ctx.getServletContext(); tomcat.start(); tomcat.getServer().await(); } catch (LifecycleException e) { throw new RuntimeException("Unable to launch tomcat ", e); } } [1] - https://github.com/toaler/container/blob/master/container-webapp-tomcat/src/main/java/container/webapp/tomcat/TomcatWebContainer.java On Sat, Sep 30, 2017 at 5:50 AM, John D. Ament wrote: > I use Maven for the actual build. I use these dependencies (with > 9.0.0.M26): > > > org.apache.tomcat.embed > tomcat-embed-core > > > org.apache.tomcat.embed > tomcat-embed-el > > > org.apache.tomcat > tomcat-juli > > > org.apache.tomcat.embed > tomcat-embed-websocket > > > And use the Capsule Maven Plugin to build the actual runtime (better > isolation than a shaded JAR): > > > com.github.chrisdchristo > capsule-maven-plugin > ${capsule.maven.plugin.version} > > > > build > > > your.main.class.here > fat > > > > > > And then the actual bootstrap would look like this: > https://paste.apache.org/vVNs (I put it in a paste since it's pretty > long). > > On Sat, Sep 30, 2017 at 4:51 AM Brian Toal wrote: > > > Can someone point me to a example of how to run Tomcat as a embedded > > application, packaged in a uber jar? I'm not interested in running via a > > war. I've struggled to find a example. > > > --f403045e423e2abe89055a8a1fb1--