Category Archives: tomcat8

Tomcat 8.5.31 stuck while deploying the war

We are migrating our application from tomcat 7 to tomcat 8. All wars are deploying successfully in tomcat 8. But only one war is not deploying. Tomcat 8 starts deploying the war and then stuck there. No logs are printing in Catalina.out and Error.log.

Please find below logs.

23-May-2018 04:14:55.314 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.31
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Apr 27 2018 20:24:25 UTC
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.31.0
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.10.0-693.21.1.el7.x86_64
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/java/jdk1.8.0_60/jre
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_60-b27
23-May-2018 04:14:55.328 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /opt/apache-tomcat-8.5.31
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /opt/apache-tomcat-8.5.31
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
23-May-2018 04:14:55.329 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
23-May-2018 04:14:55.330 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
23-May-2018 04:14:55.644 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
23-May-2018 04:14:55.675 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
23-May-2018 04:14:55.706 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
23-May-2018 04:14:55.708 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
23-May-2018 04:14:55.720 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1282 ms
23-May-2018 04:14:55.755 WARNING [main] org.apache.tomcat.jdbc.pool.ConnectionPool.checkPoolConfiguration maxIdle is smaller than minIdle, setting maxIdle to: 5
23-May-2018 04:14:57.653 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
23-May-2018 04:14:57.654 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.31
23-May-2018 04:14:57.711 INFO [localhost-startStop-1] **org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/apache-tomcat-8.5.31/webapps/llas.war]**

This is last line in Catalina.out.

spring boot email doesnt work in production

I have my spring boot application that has to send emails. The problem that I am facing is that my application in development are able to send emails using the SMTP server of my domain BUT in production no.

Email properties in my spring boot

spring.mail.host=mail.mydomain.com
spring.mail.port=465
spring.mail.protocol=smtps
[email protected]
spring.mail.password=mypass
spring.mail.default-encoding=UTF-8
spring.mail.properties.mail.transport.protocol=smtps
spring.mail.properties.mail.smtps.auth=true
spring.mail.properties.mail.smtps.starttls.enable=true

In production I check the logs in catalina: the error says:

Could not connect to SMTP host: *************** , port 465, response:-1 
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2106) ~ 
[javax.mail-1.5.6.jar:1.5.6]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:712) ~ 
[javax.mail-1.5.6.jar:1.5.6]
at javax.mail.Service.connect(Service.java:366) ~[javax.mail-1.5.6.jar:1.5.6]

Already communicated with the domain and hosting company, they said you should ask a developer about it!! my code is working fine and I can send emails using the same email and port in development in spring sts but after deployment doesnt work. Please help!

Unable to log in in Tomcat 8.5.24 Manager even without user and password set

I work with an application which uses Apache Tomcat 8.5.24 in a Windows Server 2012 or superior as the foundation to run a webpage. I have already installed and successfully made the whole system work in accordance with the steps of an installation manual.

Lately I needed to install the system again in a client but, contrary to previous cases, I've simply being unable to access Tomcat's manager page (127.0.0.1:8080/manager) with a browser.

I attempted many solutions found on the web on how to counter this issue, most of which involving changing the settings inside tomcat-users.xml, with no effect. I even came to the point of abandoning the idea of having a user and password set (the installation wizard says they are optional) and even so the pop-up requesting user and password keep showing and no manager is open. I did fresh reinstall even with a different installer (to check if it was corrupt), copied and pasted the tomcat-users.xml file from a different sucessfull installation, granted all possible permissions (the only real difference this time is that I'm installing remotely, but that shouldn't be a problem since the installation itself uses administrator rights) and the problem persists.

What other thigs could I try to solve this issue? Here are some links I consulted:

By the way, the Tomcat installation is unconnected to any NetBeans or similar software.

Deploying Symfony 4 Application to AWS Elasticbeanstalk

I have a working Symfony 4.0.1 application running on PHP 7.1.14 (locally) that I would like to deploy to AWS Elastic Beanstalk using the EB CLI

I have a dist package of the application on my master git branch configured for production (vendor folder removed etc) that I am able to successfully deploy to Heroku. Now I need to deploy to AWS EB.

The AWS EB environment has already been set up (although I dont have access to the console). Some environment details are as follows:

Platform: arn:aws:elasticbeanstalk:us-east-2::platform/Tomcat 8 with Java 8 running on 64bit Amazon Linux/2.7.7
Tier: WebServer-Standard-1.0

At first, I was able to successfully deploy the application, but accessing the URL gave a 404 error for every page.

enter image description here I did some googling and found a few articles describing the use of .config files. I have added one named 03_main.config with the following contents.

commands:
    300-composer-update:
        command: "export COMPOSER_HOME=/root && composer.phar self-update -n"
container_commands:
    300-run-composer:
        command: "composer.phar install --no-dev --optimize-autoloader --prefer-dist --no-interaction"
    600-update-cache:
        command: "source .ebextensions/bin/update-cache.sh"
    700-remove-dev-app:
        command: "rm web/app_dev.php"

Deploying with this .config file gives the following deployment failure error:

ERROR: [Instance: i-0c5f61f41d55a18bc] Command failed on instance. Return code: 127 Output: /bin/sh: composer.phar: command not found. command 300-composer-update in .ebextensions/03-main.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

I understand the purpose of .config files but do not understand what additional configuration is needed for get this Symfony app running.

Apache tomcat master slave setup

I searched a lot but did not find much of information about master-slave setup for Apache tomcat, all I found was clustering.

our need is to have one master and multiple slaves with different services on each. Please suggest any such site or documentation from where we can take it ahead.

org.apache.catalina.core.StandardWrapperValve invoke SEVERE Error

When i hit the Application URL getting following error :

PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path 
[/webportal] threw exception [GSSException: Failure unspecified at GSS-API 
level (Mechanism level: Invalid argument (400) - Cannot find key of 
appropriate type to decrypt AP REP - RC4 with HMAC)] with root cause
KrbException: Invalid argument (400) - Cannot find key of appropriate type 
to decrypt AP REP - RC4 with HMAC
at sun.security.krb5.KrbApReq.authenticate(KrbApReq.java:270)
at sun.security.krb5.KrbApReq.<init>(KrbApReq.java:144)
at sun.security.jgss.krb5.InitSecContextToken.<init>(InitSecContextToken.java:108)

Spring Boot + Apache Tiles causes "ServletContext resource [/WEB-INF/views/] cannot be resolved to URL because it does not exist"

I am trying to deploy my test application on VPS and that is when the error comes up. Funny thing is that when I run it on my computer everything works! There has to be some tiny thing to fix (maybe move around tiles.xml file around) so tomcat on the server is happy. I tried everything could. Any suggestions?

Files layout:

enter image description here

TestApplication.java

@SpringBootApplication
public class TestApplication extends SpringBootServletInitializer{

public static void main(String[] args) {
    SpringApplication.run(TestApplication.class, args);
}

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(TestApplication.class);
}

/*
 * tiles configuration
 */
@Bean
public TilesConfigurer tilesConfigurer() {
    TilesConfigurer tilesConfigurer = new TilesConfigurer();
    String[] defs = {"WEB-INF/views/**/tiles.xml"};
    tilesConfigurer.setDefinitions(defs);
    tilesConfigurer.setCheckRefresh(true);

    return tilesConfigurer;
}

@Bean
public UrlBasedViewResolver tilesViewResolver() {
    UrlBasedViewResolver tilesViewResolver = new UrlBasedViewResolver();
    tilesViewResolver.setViewClass(TilesView.class);
    return tilesViewResolver;
}

} Stack trace:

java.io.FileNotFoundException: ServletContext resource [/WEB-INF/views/] cannot be resolved to URL because it does not exist
at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:156) ~[spring-web-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:463) ~[spring-core-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:292) ~[spring-core-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.web.servlet.view.tiles3.SpringWildcardServletTilesApplicationContext.getResources(SpringWildcardServletTilesApplicationContext.java:77) ~[spring-webmvc-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.web.servlet.view.tiles3.TilesConfigurer$SpringTilesContainerFactory.getSources(TilesConfigurer.java:305) [spring-webmvc-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.apache.tiles.factory.BasicTilesContainerFactory.createLocaleDefinitionDao(BasicTilesContainerFactory.java:182) [tiles-core-3.0.7.jar!/:3.0.7]
at org.apache.tiles.factory.BasicTilesContainerFactory.createDefinitionsFactory(BasicTilesContainerFactory.java:137) [tiles-core-3.0.7.jar!/:3.0.7]
at org.springframework.web.servlet.view.tiles3.TilesConfigurer$SpringTilesContainerFactory.createDefinitionsFactory(TilesConfigurer.java:353) [spring-webmvc-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.apache.tiles.factory.BasicTilesContainerFactory.createContainer(BasicTilesContainerFactory.java:86) [tiles-core-3.0.7.jar!/:3.0.7]
at org.apache.tiles.startup.AbstractTilesInitializer.createContainer(AbstractTilesInitializer.java:114) [tiles-core-3.0.7.jar!/:3.0.7]
at org.apache.tiles.startup.AbstractTilesInitializer.initialize(AbstractTilesInitializer.java:64) [tiles-core-3.0.7.jar!/:3.0.7]
at org.springframework.web.servlet.view.tiles3.TilesConfigurer.afterPropertiesSet(TilesConfigurer.java:271) [spring-webmvc-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) [spring-beans-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) [spring-beans-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) [spring-beans-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) [spring-beans-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) [spring-beans-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) [spring-context-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) [spring-context-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
at pl.bartoszpiatek.TestApplication.main(TestApplication.java:16) [classes!/:0.0.1-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [testApp.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [testApp.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [testApp.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [testApp.jar:0.0.1-SNAPSHOT]