Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sample-appsensor-ws-rest-server won't run with tomcat #21

Closed
bbigras opened this issue Jun 16, 2015 · 3 comments
Closed

sample-appsensor-ws-rest-server won't run with tomcat #21

bbigras opened this issue Jun 16, 2015 · 3 comments

Comments

@bbigras
Copy link

bbigras commented Jun 16, 2015

I'm not sure if it's a problem or if I'm not doing the right thing.

I'm trying to run sample-appsensor-ws-rest-server with tomcat in a Docker container.

When I access http://localhost:8080/sample-appsensor-ws-rest-server-2.1.0/ by clicking the link in the app manager, I get 404 - Not Found.

Tomcat is able to run a sample war.

Dockerfile

FROM tomcat:8.0.23-jre7

RUN apt-get update && \
    apt-get install -y \
    maven \
    git \
    openjdk-7-jdk \
    libtcnative-1 && \
    apt-get clean && \
    apt-get autoremove -y

RUN cd /tmp && \
    git clone https://github.com/jtmelton/appsensor.git && \
    cd appsensor/sample-apps/sample-appsensor-ws-rest-server && \
    mvn package && \
    cp target/sample-appsensor-ws-rest-server-2.1.0.war /usr/local/tomcat/webapps && \
    rm -rf /tmp/appsensor

ADD tomcat-users.xml /usr/local/tomcat/conf/tomcat-users.xml

tomcat-users.xml

<tomcat-users>
  <role rolename="admin-gui"/> 
  <role rolename="admin-script"/> 
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-jmx"/>
  <role rolename="manager-status"/>
  <user username="tomcat" password="secret" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/> 
</tomcat-users>

log

Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
16-Jun-2015 20:27:56.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.23
16-Jun-2015 20:27:56.777 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          May 19 2015 14:58:38 UTC
16-Jun-2015 20:27:56.777 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.23.0
16-Jun-2015 20:27:56.777 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
16-Jun-2015 20:27:56.778 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            4.0.3-boot2docker
16-Jun-2015 20:27:56.778 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
16-Jun-2015 20:27:56.778 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-7-openjdk-amd64/jre
16-Jun-2015 20:27:56.778 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.7.0_79-b14
16-Jun-2015 20:27:56.779 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
16-Jun-2015 20:27:56.779 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /usr/local/tomcat
16-Jun-2015 20:27:56.779 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/local/tomcat
16-Jun-2015 20:27:56.781 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
16-Jun-2015 20:27:56.781 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
16-Jun-2015 20:27:56.781 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/usr/local/tomcat/endorsed
16-Jun-2015 20:27:56.781 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
16-Jun-2015 20:27:56.781 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
16-Jun-2015 20:27:56.782 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
16-Jun-2015 20:27:56.782 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent An older version 1.1.32 of the APR based Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of 1.1.33
16-Jun-2015 20:27:56.782 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1.
16-Jun-2015 20:27:56.782 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
16-Jun-2015 20:27:56.822 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized (OpenSSL 1.0.1k 8 Jan 2015)
16-Jun-2015 20:27:57.027 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
16-Jun-2015 20:27:57.044 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
16-Jun-2015 20:27:57.048 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1038 ms
16-Jun-2015 20:27:57.100 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
16-Jun-2015 20:27:57.100 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.23
16-Jun-2015 20:27:57.156 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /usr/local/tomcat/webapps/sample-appsensor-ws-rest-server-2.1.0.war
16-Jun-2015 20:28:02.918 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars 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.
16-Jun-2015 20:28:03.023 INFO [localhost-startStop-1] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization started
16-Jun-2015 20:28:03.141 INFO [localhost-startStop-1] org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh Refreshing Root WebApplicationContext: startup date [Tue Jun 16 20:28:03 UTC 2015]; root of context hierarchy
16-Jun-2015 20:28:03.193 INFO [localhost-startStop-1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [applicationContext.xml]
16-Jun-2015 20:28:03.612 INFO [localhost-startStop-1] org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.<init> JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
20:28:03,782 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
20:28:03,783 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
20:28:03,783 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/usr/local/tomcat/webapps/sample-appsensor-ws-rest-server-2.1.0/WEB-INF/classes/logback.xml]
20:28:03,784 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
20:28:03,784 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/usr/local/tomcat/webapps/sample-appsensor-ws-rest-server-2.1.0/WEB-INF/lib/appsensor-core-2.1.0.jar!/logback.xml]
20:28:03,784 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/usr/local/tomcat/webapps/sample-appsensor-ws-rest-server-2.1.0/WEB-INF/classes/logback.xml]
20:28:03,863 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
20:28:03,873 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
20:28:03,889 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
20:28:03,913 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
20:28:03,987 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
20:28:03,987 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
20:28:03,988 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
20:28:03,990 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@39e481c4 - Registering current configuration as safe fallback point

20:28:04.686 [localhost-startStop-1] WARN  o.o.a.c.s.c.StaxClientConfiguration - Could not load appsensor client configuration file. This error is fine if you are running a server.
16-Jun-2015 20:28:04.704 INFO [localhost-startStop-1] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization completed in 1681 ms
16-Jun-2015 20:28:25.357 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [20,647] milliseconds.
16-Jun-2015 20:28:25.672 INFO [localhost-startStop-1] org.glassfish.jersey.server.ApplicationHandler.initialize Initiating Jersey application, version Jersey: 2.8 2014-04-29 01:25:26...
16-Jun-2015 20:28:27.321 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /usr/local/tomcat/webapps/sample-appsensor-ws-rest-server-2.1.0.war has finished in 30,164 ms
16-Jun-2015 20:28:27.325 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/examples
16-Jun-2015 20:28:27.693 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/examples has finished in 368 ms
16-Jun-2015 20:28:27.693 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/host-manager
16-Jun-2015 20:28:27.731 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/host-manager has finished in 38 ms
16-Jun-2015 20:28:27.732 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/docs
16-Jun-2015 20:28:27.761 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/docs has finished in 29 ms
16-Jun-2015 20:28:27.761 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/manager
16-Jun-2015 20:28:27.805 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/manager has finished in 44 ms
16-Jun-2015 20:28:27.805 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/ROOT
16-Jun-2015 20:28:27.831 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/ROOT has finished in 26 ms
16-Jun-2015 20:28:27.853 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
16-Jun-2015 20:28:27.872 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8009"]
16-Jun-2015 20:28:27.878 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 30830 ms
@jtmelton
Copy link
Owner

@BrunoQC Thanks for posting the issue here. From the logs it looks like it was started correctly. Can you try hitting this url:
http://localhost:8080/sample-appsensor-ws-rest-server-2.1.0/api/v1.0/responses
You should get a message back that says "Page requires sending configured client application identification header." If you do, that means you're setup properly. There is no handler for the root ("/") url.

@bbigras
Copy link
Author

bbigras commented Jun 16, 2015

I got "Page requires sending configured client application identification header."

Thanks!

@bbigras bbigras closed this as completed Jun 16, 2015
@jtmelton
Copy link
Owner

Great - sounds good @BrunoQC . That sample app has a default config already setup that you'll probably want to change if you're doing anything other than basic testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants