Code Monkey home page Code Monkey logo

webapp-runner's Introduction

Webapp Runner CI Maven Central

Webapp Runner is designed to allow you to launch an exploded or compressed war that is on your filesystem into a tomcat container with a simple java -jar command. It currently supports Tomcat 9.0.x and 10.1.x, older versions of webapp-runner for other Tomcat versions are no longer maintained.

Table of Contents

Usage

Webapp Runner is a standalone CLI tool that runs a WAR file. The simplest usage looks like this:

$ java -jar webapp-runner.jar path/to/project.war

Maven

You can use the Maven dependency plugin to download Webapp Runner as part of your build. This will eliminate the need for any external dependencies other than those specified in your build to run your application.

<plugins>
  <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <version>3.3.0</version>
      <executions>
          <execution>
              <phase>package</phase>
              <goals>
                  <goal>copy</goal>
              </goals>
              <configuration>
                  <artifactItems>
                      <artifactItem>
                          <groupId>com.github.heroku</groupId>
                          <artifactId>webapp-runner</artifactId>
                          <version>${webapp-runner.version}</version>
                          <destFileName>webapp-runner.jar</destFileName>
                      </artifactItem>
                  </artifactItems>
              </configuration>
          </execution>
      </executions>
  </plugin>
</plugins>

Now when you run maven package, Webapp Runner will be downloaded for you. You can then launch your application with:

$ java -jar target/dependency/webapp-runner.jar target/<appname>.war

Excluding Memcached and Redis libraries

Webapp Runner bundles Memcached and Redis client libraries into it's package. These libraries can cause conflicts with similar libraries in your application. This frequently manifests itself as a java.lang.NoSuchMethodError.

If you do not require these client libraries (because you are storing session data in some other way), you can exclude them by using webapp-runner-main instead of webapp-runner:

<artifactItem>
    <groupId>com.github.heroku</groupId>
    <artifactId>webapp-runner-main</artifactId>
    <version>${webapp-runner.version}</version>
    <destFileName>webapp-runner.jar</destFileName>
</artifactItem>

Store your sessions in Redis

Webapp Runner includes a session manager that stores sessions in redis.

To use it, add --session-store redis to your startup command:

$ java -jar webapp-runner.jar --session-store redis target/<appname>.war

The session store is configured via the following environment variables:

  • REDIS_URL

Store your sessions in memcache

Webapp Runner includes a session manager that stores sessions in memcache.

To use it, add --session-store memcache to your startup command:

$ java -jar webapp-runner.jar --session-store memcache target/<appname>.war

The session store is configured via the following environment variables:

  • MEMCACHE_SERVERS
  • MEMCACHE_USERNAME
  • MEMCACHE_PASSWORD

Using behind a reverse proxy server

If you are using webapp-runner behind a proxy server, you can set the proxy base url within tomcat:

$ java -jar webapp-runner.jar --proxy-base-url https://example.com target/<appname>.war

If you pass an HTTPS base url, e.g. https://example.com, secure flag will be automatically added to session cookies. This indicates to the browser that cookies should only be sent over a secure protocol.

Options

Usage: <main class> [options]
  Options:
    --access-log
      Enables AccessLogValue to STDOUT
      Default: false
    --access-log-pattern
      If --access-log is enabled, sets the logging pattern
      Default: common
    --basic-auth-pw
      Password to be used with basic auth. Defaults to BASIC_AUTH_PW env
      variable.
    --basic-auth-user
      Username to be used with basic auth. Defaults to BASIC_AUTH_USER env
      variable.
    --bind-on-init
      Controls when the socket used by the connector is bound. By default it
      is bound when the connector is initiated and unbound when the connector
      is destroyed., default value: true
      Default: true
    --compressable-mime-types
      Comma delimited list of mime types that will be compressed when using
      GZIP compression.
      Default: text/html,text/xml,text/plain,text/css,application/json,application/xml,text/javascript,application/javascript
    --context-xml
      The path to the context xml to use.
    --enable-basic-auth
      Secure the app with basic auth. Use with --basic-auth-user and
      --basic-auth-pw or --tomcat-users-location
      Default: false
    --enable-client-auth
      Specify -Djavax.net.ssl.keyStore and -Djavax.net.ssl.keyStorePassword in
      JAVA_OPTS
      Default: false
    --enable-compression
      Enable GZIP compression on responses
      Default: false
    --enable-naming
      Enables JNDI naming
      Default: false
    --enable-ssl
      Specify -Djavax.net.ssl.keyStore, -Djavax.net.ssl.keystoreStorePassword,
      -Djavax.net.ssl.trustStore and -Djavax.net.ssl.trustStorePassword in
      JAVA_OPTS. Note: should not be used if a reverse proxy is terminating
      SSL for you (such as on Heroku)
      Default: false
    --expand-war-file
      Expand the war file and set it as source
      Default: true
    --expanded-dir-name
      The name of the directory the WAR file will be expanded into.
      Default: expanded
    --help

    --max-threads
      Set the maximum number of worker threads
      Default: 0
    --memcached-transcoder-factory-class
      The class name of the factory that creates the transcoder to use for
      serializing/deserializing sessions to/from memcached.
    --path
      The context path
      Default: <empty string>
    --port
      The port that the server will accept http requests on.
      Default: 8080
    --proxy-base-url
      Set proxy URL if tomcat is running behind reverse proxy
      Default: <empty string>
    --scanBootstrapClassPath
      Set jar scanner scan bootstrap classpath.
      Default: false
    --session-store
      Session store to use (valid options are 'memcache' or 'redis')
    --session-store-ignore-pattern
      Request pattern to not track sessions for. Valid only with memcache
      session store. (default is '.*\.(png|gif|jpg|css|js)$'. Has no effect
      for 'redis')
      Default: .*\.(png|gif|jpg|css|js)$
    --session-store-locking-mode
      Session locking mode for use with memcache session store. (default is
      all. Has no effect for 'redis')
      Default: all
    --session-store-operation-timeout
      Operation timeout for the memcache session store. (default is 5000ms)
      Default: 5000
    --session-store-pool-size
      Pool size of the session store connections (default is 10. Has no effect
      for 'memcache')
      Default: 10
    --session-store-ssl-endpoint-identification
      Enables or disables SSL endpoint identification for the redis session
      store. (default is true. Has no effect for 'memcache')
      Default: true
    --session-timeout
      The number of minutes of inactivity before a user's session is timed
      out.
    --shutdown-override
      Overrides the default behavior and casues Tomcat to ignore lifecycle
      failure events rather than shutting down when they occur.
      Default: false
    --temp-directory
      Define the temp directory, default value: ./target/tomcat.PORT
    --tomcat-users-location
      Location of the tomcat-users.xml file. (relative to the location of the
      webapp-runner jar file)
    --uri-encoding
      Set the URI encoding to be used for the Connector.
    --use-body-encoding-for-uri
      Set if the entity body encoding should be used for the URI.
      Default: false
    --secure-error-report-valve
      Set true to set ErrorReportValve properties showReport and showServerInfo to false. This protects from Apache stacktrace logging of malicious http requests. 
      Default: false
    -A
      Allows setting HTTP connector attributes. For example: -Acompression=on
      Syntax: -Akey=value
      Default: {}

See the Tomcat documentation for a complete list of HTTP connector attributes.

Development

To run the entire suite of integration tests, use the following command:

$ ./mvnw clean install -Pintegration-test

To run an individual integration test, use a command like this:

$ ./mvnw clean install -Pintegration-test -Dinvoker.test=memcache-test

webapp-runner's People

Contributors

alevy avatar alexintech avatar ato avatar bimsapi avatar chrisupb avatar damienbeaufils avatar dennysfredericci avatar dependabot[bot] avatar edmorley avatar gallifabio avatar heroku-linguist[bot] avatar howardfackrell avatar inodb avatar jagarcia avatar jamesward avatar jbn avatar jkutner avatar jsimone avatar kissaten-bot avatar malax avatar mqshen avatar nidorx avatar oniseijin avatar pulkitsinghal avatar ryanbrainard avatar schneems avatar slife avatar svc-ast-gh-snyk3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webapp-runner's Issues

License missing

What license is webapp-runner released under? Apache 2 like Tomcat itself?

Could you please add a note to the README? :-)

Change behavior of Cache-Control

Hey folks,

Is there any way to change behavior of Cache-Control?
Cache-Control:no-cache, no-store, max-age=0, must-revalidate

I want to enable cache for images and CSS.

Thank you for the excellent job :)

Option --enable-ssl and javax.net.ssl.trustStore

I have SSL certificate issued by Certificate Authorities and would like to use https connection to my site.
I've tried to add option --enable-ssl into command line. Also, I've added java options
-Djavax.net.ssl.trustStore=fullchain_and_key.p12 and
-Djavax.net.ssl.trustStorePassword=changeit
But, when I run command file I get an error:
SEVERE: Failed to load keystore type JKS with path /root/.keystore due to /root/.keystore (No such file or directory)
I have not the .keystore file in home folder.
After that I've changed the parameter's name to -Djavax.net.ssl.keyStore -Djavax.net.ssl.keyStorePassword (i.e. keyStore instead trustStore) and everything is working now.
As I undestood, keyStore uses when client connects to server and checks server's certificate, but trustStore uses when server connects to other servers/client with SSL.
Or may be I did something wrong and everything should working with trustStore?

error handling for invalid command line parametes

if webapp runner is started with the below command:

 web:  java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT --session_ manager memcache target/*.war

Note: The space between session_ and _manager.

Once a proc file is pushed with this command, the app fails with a H14. Need to handle these kinds of typo errors more gracefully.

Upgrade to tomcat 7.0.59

Problem with server startup when using webapp-runner version 7.0.57.2.
I have created a basic Maven Web Application using Eclipse and wanted to deploy it to Heroku. Config:
JDK - 1.8 / 1.7 (tried with both)
Servlet container - 3.0.1 / 3.1
webapp-runner version - 7.0.57.1/7.0.57.2

Bug status from Apache shows it's resolved from 7.0.58 onward.

I'm wondering if there's something wrong with what I'm doing or if it's a problem with the Tomcat version itself ?

Jul 10, 2015 12:34:51 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Jul 10, 2015 12:34:51 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Jul 10, 2015 12:34:51 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Jul 10, 2015 12:34:51 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.57
Jul 10, 2015 12:34:52 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
Jul 10, 2015 12:34:54 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [org/apache/batik/dom/svg/SVGOMAnimatedPathData$AnimSVGPathSegList.class] from Jar [jar:jndi:/localhost/WEB-INF/lib/batik-svg-dom-1.7.jar!/] for annotations
java.io.EOFException
    at org.apache.tomcat.util.bcel.classfile.FastDataInputStream.readUnsignedShort(FastDataInputStream.java:120)
    at org.apache.tomcat.util.bcel.classfile.Utility.swallowFieldOrMethod(Utility.java:75)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods(ClassParser.java:235)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:92)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2071)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1947)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1913)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1898)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5380)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Jul 10, 2015 12:34:54 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [org/apache/batik/dom/svg/SVGOMStyleElement$DOMCharacterDataModifiedListener.class] from Jar [jar:jndi:/localhost/WEB-INF/lib/batik-svg-dom-1.7.jar!/] for annotations
java.io.EOFException
    at org.apache.tomcat.util.bcel.classfile.FastDataInputStream.readInt(FastDataInputStream.java:145)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readID(ClassParser.java:200)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:78)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2071)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1947)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1913)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1898)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5380)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Jul 10, 2015 12:34:54 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [org/apache/xalan/xsltc/compiler/Parser.class] from Jar [jar:jndi:/localhost/WEB-INF/lib/xalan-2.7.1.jar!/] for annotations
java.io.EOFException
    at org.apache.tomcat.util.bcel.classfile.FastDataInputStream.readUnsignedShort(FastDataInputStream.java:120)
    at org.apache.tomcat.util.bcel.classfile.Utility.swallowFieldOrMethod(Utility.java:75)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods(ClassParser.java:235)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:92)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2071)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1947)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1913)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1898)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5380)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Jul 10, 2015 12:34:55 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [org/apache/poi/hssf/converter/ExcelToFoConverter.class] from Jar [jar:jndi:/localhost/WEB-INF/lib/poi-scratchpad-3.8.jar!/] for annotations
java.io.EOFException
    at org.apache.tomcat.util.bcel.classfile.FastDataInputStream.readUnsignedShort(FastDataInputStream.java:120)
    at org.apache.tomcat.util.bcel.classfile.Utility.swallowFieldOrMethod(Utility.java:75)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods(ClassParser.java:235)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:92)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2071)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1947)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1913)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1898)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5380)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Jul 10, 2015 12:34:55 PM org.apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [org/apache/commons/lang/StringUtils.class] from Jar [jar:jndi:/localhost/WEB-INF/lib/commons-lang-2.4.jar!/] for annotations
java.io.EOFException
    at org.apache.tomcat.util.bcel.classfile.FastDataInputStream.readUnsignedShort(FastDataInputStream.java:120)
    at org.apache.tomcat.util.bcel.classfile.Utility.swallowFieldOrMethod(Utility.java:75)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods(ClassParser.java:235)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:92)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2071)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1947)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1913)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1898)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1330)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5380)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Jul 10, 2015 12:34:58 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [150] milliseconds.
Jul 10, 2015 12:34:58 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]

Upgrade to Tomcat 7.0.54

Tomcat 7.0.53+ supports Java 8. It would be useful to upgrade this to use version 7.0.54 of Tomcat since you'd be able to use Java 8 then.

webapp-runner throws NPE on DataSource

Hi,

I have a maven Servlet/JSP project with a JDBC Postgres backend.
The project is designed to produce a WAR file with an embedded "META-INF/context.xml" that contains the dataSource factory informations.

If the WAR is deployed manually on a Tomcat installation, everything works fine.

However, if I try to deploy the it file with WebappRunner with the usual procedure:

mvn clean package
java -jar target\dependency\webapp-runner.jar target\myapplication.war

the application throws NullPointerException at the first DataSource instantation. It seems to be a hint that WebappRunner is actually not finding the context.xml file inside the WAR (even if is there).

No improvement as well if I specify the context.xml externally:

java -jar target\dependency\webapp-runner.jar --context-xml src\main\webapp\META-INF\context.xml target\myapplication.war

Any ideas on what could be wrong here?
Thanks!

backed session manager is not working with RedisCloud

When i try to use the RedisCloud add-on for my heroku app is not working because the current version of the redis cache code looking for REDIS_URL or REDISTOGO_URL but the RedisCloud add on generating new variable called 'REDISCLOUD_URL'

Set up JNDI resources for common backing services

It is common, and very convenient to configure external service configuration via environment variables. For example, access to a database can be provided via an environment variable like so:

DATABASE_URL=postgres://un:pw@hostname:port/database

It would be nice if webapp-runner could automatically configure a JNDI DataSource at java:comp/env/jdbc/default for this datasource. If the URL is formatted as DATABASE_SOMENAME_URL then the data source should be configured at java:comp/env/jdbc/somename.

Failover Nodes Configuration Missing

Hi, I didn't find in the documentation a way to support setting up the failover nodes in case one of the memcached servers crashes.

I wanted to know if there is a way to set that up or if it could be implemented.

Thanks.

Unknown option: --scanBootstrapClassPath

Running java -jar ./target/dependency/webapp-runner.jar ${WEBAPP_RUNNER_OPTS:-"--scanBootstrapClassPath"} --port $PORT ./my.war

Throws:

Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: --scanBootstrapClassPath
at com.beust.jcommander.JCommander.parseValues(JCommander.java:723)
at com.beust.jcommander.JCommander.parse(JCommander.java:275)
at com.beust.jcommander.JCommander.parse(JCommander.java:258)
at com.beust.jcommander.JCommander.(JCommander.java:203)
at webapp.runner.launch.Main.main(Main.java:70)

EDIT: environment
webapp-runner 7.0.57.2

EDIT#2: environments
Reproduces too in
webapp-runner 8.0.33.1

Urgently add support for recent Tomcat patch releases to mitigate CVE-2017-12617

The Apache Tomcat team has announced a High severity remote code execution vulnerability affecting versions 9.0.0.M1 to 9.0.0, 8.5.0 to 8.5.22, 8.0.0.RC1 to 8.0.46 and 7.0.0 to 7.0.81.

The vulnerabilities have been fixed in Tomcat versions 8.5.23, 8.0.47, and 7.0.82.

webapp-runner needs to be updated urgently to allow users to deploy versions of Tomcat without this vulnerability.

Memcached classloader problem

Hi,

First of all, thanks for this great library I use for heroku !

I want to share web sessions accross multiple instances using Memcached and at the same time, my webapp is built with Spring and use Memcached (MemcachedClientFactoryBean) for internal purposes.

At startup, I have a ClassNotFoundException on the Spring FactoryBean. It seems that the classloader used is the one of the Tomcat (with Memcached dependency but not the Spring dependency) instead of the classloader of the webapp (with Spring and Memcached dependencies).

So my question is :
Is there a way to force the use of the classloader of the webapp before the Tomcat classloader ?

Thanks.
Best regards,
Jรฉrรดme

Add simple way of restricting access

It is common to restrict access to staging applications with a simple basic auth protection.

It would be nice if webapp-runner could turn on this access control based on the existing of an environment variable. For example:

BASIC_AUTH_CREDENTIAL=myusername:mypassword

Version conflict httpcore dependency

Hi,

I found into the webapp-runner-8.5.11.2.jar that org.apache.httpcomponents.httpcore version 4.3 is included, Is it right? I use aws-java-sdk which has httpcore 4.4.5 dependency and I have a version conflict.

How can I remove the org.apache.httpcomponents.httpcore version 4.3 from webapp-runner-8.5.11.2.jar?

Thanks

Make expanded dirname configurable

An expanded war file is currently unzip to a directory named expanded. The name of this directory should either be configurable or use the name of the WAR file.

Trouble launching Wavemaker WARs

Heroku by default uses webapp-runner.jar for deploying WAR files. However, when I launch a Wavemaker war by deploying to Heroku or running it locally using webapp-runner - the apply will not completely launch. See photo:

heroku swebapprunnerjar

Jetty-runner.jar run locally will launch the app correctly. Is this an issue of Wavemaker being derived from Spring technology?

rename --session_manager

Following standard option conventions, it should be named --session-manager (dash instead of underscore). Also, is it really a session manager? Isn't it just a session store? Perhaps --session-store is a better name for this option.

Webrunner/session-store issue? - Cannot create a session after the response has been committed

Hi,
I am not sure this issue is related to webapp runner (and apologies if this is not the case), but the exception I get doesn't even contain my java code in the stacktrace apparently so I assume can be related to webrunner and session store?

Project running on Heroku, webapp-runner 7.0.57.2

HTTP Status 500 - javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed

type Exception report

message javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed

description The server encountered an internal error that prevented it from fulfilling this request.

exception
Stack
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:585)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:160)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:178)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
root cause

javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed
    org.apache.jsp.WEB_002dINF.web.generic.error_jsp._jspService(error_jsp.java:148)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:160)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:178)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
root cause

java.lang.IllegalStateException: Cannot create a session after the response has been committed
    org.apache.catalina.connector.Request.doGetSession(Request.java:2934)
    org.apache.catalina.connector.Request.getSession(Request.java:2310)
    org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:897)
    javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:229)
    javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:238)
    javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:238)
    javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:238)
    org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:147)
    org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:126)
    org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:112)
    org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:65)
    org.apache.jsp.WEB_002dINF.web.generic.error_jsp._jspService(error_jsp.java:72)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:160)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:178)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)

Not working @Interceptor CDI / Weld

I'm having problems when using CDI

At start App:

Fev 24, 2014 2:07:07 PM org.apache.catalina.core.StandardContext listenerStart
Grave: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener
org.jboss.weld.exceptions.DeploymentException: WELD-001417: Enabled interceptor class <class>br.com.guedesdesouza.infra.persistencia.transacao.TransacionalInterceptor</class> in jndi:/localhost/WEB-INF/beans.xml@7 is neither annotated @Interceptor nor registered through a portable extension
    at org.jboss.weld.bootstrap.Validator.validateEnabledInterceptorClasses(Validator.java:647)
    at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:470)
    at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:425)

If run Tomcat (physical Installation) the problem does not occur

Slow startup for tomcat 8

Hi,

I am not really sure if this is a issue... Anyway, every time I try to start, Tomcat takes several minutes... The log message that it takes more time is "org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found"

Any tips? Should I create any configuration? I tried to search, but I did not find anything.

tomcat8

Is there a way, to run it with tomcat8? (websockets .. :) )

thanks

App is always deployed at the root?

It seems like the runner always deploys a given application at the root. For instance, if my application is called hello.war, I would expect it be available under heroku for example as https://hello.herokuapp.com/hello. Instead it becomes available under https://hello.herokuapp.com

How can one ensure the context path is preserved?

support for proxy

In most cases tomcat runs behind a proxy, one of them would be for SSL offloading.
We have a modified version of the runner that looks up BASE_URL and sets the proxy parameters in embedded tomcat.

Would you be interested in a pull request John?

Tomcat fails to shutdown (or is slow)

We've found that in some cases with Tomcat 7.0.57 and webapp-runner 7.0.57.2, the process does not respond to SIGTERM in a timely fashion. However, this problem does not exist in 7.0.40.2.

webapps does not exist or is not a directory

I am still having the same issue as mentioned below with version 7.0.75:
#40

The output is almost identical:

SEVERE: Exception fixing docBase for context []
java.io.IOException: Application base [{1}] for host [/nfs/agile_apps/integration/avery/apps/webapps/ansible/logs/next-catalogs/target/tomcat.10003/webapps] does not exist or is not a directory. deployOnStartUp and autoDeploy have been set to false to prevent deployment errors. Other errors may still occur.

I thought by adding --expanded-dirname in my parameters, according to this other issue would solve my problem:
#57

Unfortunately, this results in an exception because the --expanded-dir-name param is not understood:

Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: --expanded-dir-name
        at com.beust.jcommander.JCommander.parseValues(JCommander.java:723)
        at com.beust.jcommander.JCommander.parse(JCommander.java:275)
        at com.beust.jcommander.JCommander.parse(JCommander.java:258)
        at com.beust.jcommander.JCommander.<init>(JCommander.java:203)
        at webapp.runner.launch.Main.main(Main.java:72)

Add `bindOnInit` option

webapp-runner should allow the configuration of the bindOnInit property of the connector. This will prevent cases where the embedded Tomcat container binds port before application is completely started.

Support for custom Valves

Hi,
I created a custom Tomcat Valve and configured it in context.xml. I tried putting the Velve implementation class in classpath when launching, but I'm getting java.lang.ClassNotFoundException:

java -cp .jar -jar webapp-runner.jar --context-xml context.xml --port 8888 theWar.war

When the Valve implementation is added into the webapp-runner.jar, everything is working as expected.

Is there a way to specify jar(s) where custom Valves are implemented so they can be used by Tomcat?

Thank you.

Location of expanded-war?

I am running a war file on Heroku. My proc file is as such:

web:    java $JAVA_OPTS -jar .../webapp-runner.jar --expand-war --port $PORT app.war

I see in heroku logs:

2016-01-04T19:58:34.392414+00:00 app[web.1]: Expanding idp.war into /app/target/tomcat.31320/webapps/expanded
2016-01-04T19:58:34.392472+00:00 app[web.1]: Adding Context  for /app/target/tomcat.31320/webapps/expanded

Which is fine. However, In order for the app to initialize itself correctly, I need to be able to pass an environment variable to the running process, with a value that points to a directory inside the expanded webapp. I am trying to do this via heroku's config vars.

I am not sure how to find the location of the expanded web app. Is that something that can be determined and passed?

Multiple paths warning when launching, even though only one has been specified.

Running

java -Dgrails.env=prod -jar build/server/webapp-runner-*.jar --expand-war --port 8000 libs/war_file.war

Yields

WARNING: multiple paths are specified, but no longer supported. First path will be used.

And fails to load the WAR file in the container. This seems to have been broken recently as it works in 8.5.5.2 but is broken in 8.5.11.1.

add option to explode WAR files

Certain file access operations in Spring (among other frameworks) only work if running from an exploded WAR file.

There should be a command line flag that will cause webapp runner to explode a WAR file into a temp dir before launching.

Incorrectly appends default memcached port to provided port, thus breaking all memcached backed session functionality

On Tomcat 8.0.30, oracle jdk 8.77
Using https://github.com/jsimone/webapp-runner with server string for MEMCACHE_SERVERS:
n1:pub-memcache-42.us-east-1-1.1.ec2.garantiadata.com:11733

Results in default port being appended to provided port:
a
Apr 13, 2016 4:52:57 AM de.javakaffee.web.msm.MemcachedSessionService startInternal
INFO: starts initialization... (configured nodes definition n1:pub-memcache-42.us-east-1-1.1.ec2.garantiadata.com:11733:11211, failover nodes null)
Apr 13, 2016 4:52:57 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: The session manager failed to start
org.apache.catalina.LifecycleException: Failed to start component [de.javakaffee.web.msm.MemcachedBackupSessionManager[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5272)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Configured memcachedNodes attribute has wrong format, must match ([\w]+):([^:]+):([\d]+)(?:(?:\s+|,)([\w]+):([^:]+):([\d]+))*
at de.javakaffee.web.msm.MemcachedNodesManager.createFor(MemcachedNodesManager.java:190)
at de.javakaffee.web.msm.MemcachedSessionService.createMemcachedNodesManager(MemcachedSessionService.java:480)
at de.javakaffee.web.msm.MemcachedSessionService.startInternal(MemcachedSessionService.java:423)
at de.javakaffee.web.msm.MemcachedBackupSessionManager.startInternal(MemcachedBackupSessionManager.java:518)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 8 more

Reference
magro/memcached-session-manager#294

WebSockets issues

Hi,
my webapp uses WebSockets by annotating the server code like this
@serverendpoint(value = "/websocket/myservlet")
It works perfecly when deployed on a real Tomcat server, but websockets don't work when run through the webapp-runner. Is it a known issue or am I doing something wrong?

Detecting SpringBootServletInitializer takes around 3-5 minutes

I made a little spring boot application. When I want to start the application with the webapp-runner, the runner stops after the first few steps with "INFO: No global web.xml found ". After 3-5 minutes the runner detects the SpringBootServletInitializer and starts my app.

Am I doing something wrong or is it a bug?

Sep 28 04:11:09 spring-boot-test-app heroku/web.1:  Starting process with command `java -Xmx384m -Xss512k -XX:+UseCompressedOops -Dspring.profiles.active=prod -jar build/remoteSources/webapp-runner-8.0.24.1.jar --port 24166 build/libs/spring-boot-test-app-0.5.0.war`
Sep 28 04:11:12 spring-boot-test-app app/web.1:  Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Sep 28 04:11:13 spring-boot-test-app app/web.1:  Adding Context  for build/libs/spring-boot-test-app-0.5.0.war
Sep 28 04:11:13 spring-boot-test-app app/web.1:  Sep 28, 2015 11:11:13 AM org.apache.coyote.AbstractProtocol init
Sep 28 04:11:13 spring-boot-test-app app/web.1:  INFO: Initializing ProtocolHandler ["http-nio-24166"]
Sep 28 04:11:13 spring-boot-test-app app/web.1:  Sep 28, 2015 11:11:13 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
Sep 28 04:11:13 spring-boot-test-app app/web.1:  INFO: Using a shared selector for servlet write/read
Sep 28 04:11:13 spring-boot-test-app app/web.1:  Sep 28, 2015 11:11:13 AM org.apache.catalina.core.StandardService startInternal
Sep 28 04:11:13 spring-boot-test-app app/web.1:  INFO: Starting service Tomcat
Sep 28 04:11:13 spring-boot-test-app app/web.1:  Sep 28, 2015 11:11:13 AM org.apache.catalina.core.StandardEngine startInternal
Sep 28 04:11:13 spring-boot-test-app app/web.1:  INFO: Starting Servlet Engine: Apache Tomcat/8.0.24
Sep 28 04:11:15 spring-boot-test-app app/web.1:  Sep 28, 2015 11:11:15 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
--> Sep 28 04:11:15 spring-boot-test-app app/web.1:  INFO: No global web.xml found
Sep 28 04:11:16 spring-boot-test-app heroku/web.1:  State changed from starting to up
--> Sep 28 04:15:43 spring-boot-test-app app/web.1:  Sep 28, 2015 11:15:43 AM org.apache.jasper.servlet.TldScanner scanJars
Sep 28 04:15:43 spring-boot-test-app app/web.1:  INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Sep 28 04:15:45 spring-boot-test-app app/web.1:  Sep 28, 2015 11:15:44 AM org.apache.catalina.core.ApplicationContext log
Sep 28 04:15:45 spring-boot-test-app app/web.1:  INFO: Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration@578d7f3b, com.ametras.design.server.Application@1f04ff]
Sep 28 04:15:49 spring-boot-test-app app/web.1:    .   ____          _            __ _ _
Sep 28 04:15:49 spring-boot-test-app app/web.1:   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
Sep 28 04:15:49 spring-boot-test-app app/web.1:  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
Sep 28 04:15:49 spring-boot-test-app app/web.1:   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
Sep 28 04:15:49 spring-boot-test-app app/web.1:    '  |____| .__|_| |_|_| |_\__, | / / / /
Sep 28 04:15:49 spring-boot-test-app app/web.1:   =========|_|==============|___/=/_/_/_/```

How to dynamically reload project ?

Hi
sorry but out of error from me, I was unable to find this option.

  • is it possible to tell to webapp-runner to reload the current war (or exploded content) ?

If no:

  • is it possible to add console command like 'r' key to reload the current war (or exploded content) ?

this to avoid startup time
if reloading all project make no sense, maybe an option to reload only static resources could be a good point (while developping static frontend for example)

what do you think ?

Add --enable-naming

Add a --enable-naming option, which will cause tomcat.enableNaming() to be called. Currently, it is one called if basic auth or tomcat-users are provided.

context root path issues

omg did I waste lot of time searching google for an answer as to why my dynamic web app would work perfectly on a tomcat server from within eclipse but when I run it with your webapp-runner it would lose the context root 'http://localhost:8080/event/' in my case and just run off localhost:8080/ well this obviously broke all my links. The solution was dam simple to just define the path option which I didn't know about till I found this page! My suggestion is some way that webapp-runner can read in the context root defined by eclipse and also I defined it in my pom with a specific warName= event but that and many other experiments all failed to pass through.

Add some info around basic authN in README

For example:

Specifying --enable-basic-auth will automatically look for a tomcat-users.xml file in your heroku-project's root directory

    if(tomcatUsersLocation == null) {
        tomcatUsersLocation = "../../tomcat-users.xml";
    }

and use it.

Explicitly specifying --tomcat-users-location path will automatically enable --enable-basic-auth flag.

Procfile
web: ./webapp-runner.sh

webapp-runner.sh
java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT --enable-basic-auth target/*.war

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.