cargo java api to start tomcat; the container is not coming up - java

I am trying to start tomcat using cargo api. Everything looks fine from the logs, but when i hit the url(http://localhost:8079/), the tomcat management page is not coming up.
Update: I tried starting tomcat from eclipse. The logs say the exact same thing but i am not able to see the management console. so its not an issue with cargo for sure. I get a 404 when i start the server from eclipse .
the code is this
LocalConfiguration configuration = (LocalConfiguration) new DefaultConfigurationFactory().createConfiguration(
"tomcat6x", ContainerType.INSTALLED, ConfigurationType.STANDALONE);
InstalledLocalContainer container =
(InstalledLocalContainer) new DefaultContainerFactory().createContainer(
"tomcat6x", ContainerType.INSTALLED, configuration);
//container.setHome(installer.getHome());
//container.setHome("C:\\Users\\Kriss\\AppData\\Local\\Temp\\cargo\\installs\\apache-tomcat-7.0.25\\apache-tomcat-7.0.25");
container.setHome("C:\\TOSCA\\apache-tomcat-7.0.25-windows-x86\\apache-tomcat-7.0.25\\");
container.setOutput("C:\\TOSCA\\output.log");
//getting cargo related logging
container.setLogger(fileLogger);
//changing the log settings of the container
// configuration.setProperty(GeneralPropertySet.LOGGING, LoggingLevel.HIGH.getLevel());
configuration.setProperty("cargo.servlet.port", "8079");
logger.info(container.getOutput());
container.setAppend(false);
logger.info("gethome value is" + container.getHome());
// (3) Statically deploy some WAR (optional)
// configuration.addDeployable(new WAR("cargo.war"));
// (4) Start the container
container.start();
logger.info("Container is started");
Thread.sleep(26000);
container.stop();
logger.info("Container is stopped");
The logs look fine(atleast to me :P)
Apr 10, 2012 4:27:54 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [C:\Users\Kriss\AppData\Local\Temp\cargo\conf\common\classes], exists: [false], isDirectory: [false], canRead: [false]
Apr 10, 2012 4:27:54 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [C:\Users\Kriss\AppData\Local\Temp\cargo\conf\common\lib], exists: [false], isDirectory: [false], canRead: [false]
Apr 10, 2012 4:27:54 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [C:\Users\Kriss\AppData\Local\Temp\cargo\conf\shared\classes], exists: [false], isDirectory: [false], canRead: [false]
Apr 10, 2012 4:27:54 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [C:\Users\Kriss\AppData\Local\Temp\cargo\conf\shared\lib], exists: [false], isDirectory: [false], canRead: [false]
Apr 10, 2012 4:27:55 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter\Driver;C:\Program Files\Java\jdk1.7.0_01\bin;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\TortoiseSVN\bin;.
Apr 10, 2012 4:27:55 PM org.apache.catalina.startup.SetAllPropertiesRule begin
WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'emptySessionPath' to 'true' did not find a matching property.
Apr 10, 2012 4:27:55 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8079"]
Apr 10, 2012 4:27:55 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Apr 10, 2012 4:27:55 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 674 ms
Apr 10, 2012 4:27:55 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 10, 2012 4:27:55 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.25
Apr 10, 2012 4:27:55 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Users\Kriss\AppData\Local\Temp\cargo\conf\conf\Catalina\localhost\manager.xml
Apr 10, 2012 4:27:56 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive C:\Users\Kriss\AppData\Local\Temp\cargo\conf\webapps\cargocpc.war
Apr 10, 2012 4:27:56 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\Kriss\AppData\Local\Temp\cargo\conf\webapps\host-manager
Apr 10, 2012 4:27:56 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8079"]
Apr 10, 2012 4:27:56 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Apr 10, 2012 4:27:56 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 610 ms
Minor detail: when i tried to start, bootstrap was missing some classes which were part of tomcat-juli.jar. so i unjarred that and put the classes inside bootstrap.jar. I just thought i should mention that as a side comment though i dont think it is causing some problem..
Also here is the log when i start tomcat using command prompt:
Apr 09, 2012 1:55:36 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.22.
Apr 09, 2012 1:55:36 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], r
andom [true].
Apr 09, 2012 1:55:37 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
Apr 09, 2012 1:55:37 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Apr 09, 2012 1:55:37 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1944 ms
Apr 09, 2012 1:55:37 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 09, 2012 1:55:37 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.25
Apr 09, 2012 1:55:37 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\TOSCA\apache-tomcat-7.0.25-windows-
x86\apache-tomcat-7.0.25\webapps\docs
Apr 09, 2012 1:55:38 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\TOSCA\apache-tomcat-7.0.25-windows-
x86\apache-tomcat-7.0.25\webapps\examples
Apr 09, 2012 1:55:38 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\TOSCA\apache-tomcat-7.0.25-windows-
x86\apache-tomcat-7.0.25\webapps\host-manager
Apr 09, 2012 1:55:38 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\TOSCA\apache-tomcat-7.0.25-windows-
x86\apache-tomcat-7.0.25\webapps\manager
Apr 09, 2012 1:55:38 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\TOSCA\apache-tomcat-7.0.25-windows-
x86\apache-tomcat-7.0.25\webapps\ROOT
Apr 09, 2012 1:55:38 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
Apr 09, 2012 1:55:38 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Apr 09, 2012 1:55:38 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 927 ms

Related

Changing Server Settings and Adding New Files Are Not Detected in Tomcat

I was trying to learn how to use servlet by following the tutorial in this page:
https://www.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html
When I reached 2.6 STEP 5: Develop and Deploy a WebApp, I was told to restart tomcat so that it'll load the directory I just made. However, the changes I made was not loaded, the assigned port is still 8080 even though I assigned it to 9999 and the hello directory was not found. Here are the messages when I issued startup.bat:
Apr 26, 2019 5:32:04 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.2.21 using APR version 1.6.5.
Apr 26, 2019 5:32:04 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Apr 26, 2019 5:32:04 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.1.1a 20 Nov 2018)
Apr 26, 2019 5:32:04 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
Apr 26, 2019 5:32:04 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Apr 26, 2019 5:32:04 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 494 ms
Apr 26, 2019 5:32:04 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 26, 2019 5:32:04 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
Apr 26, 2019 5:32:04 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory G:\Tomcat 2\webapps\docs
Apr 26, 2019 5:32:05 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [146] milliseconds.
Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory G:\Tomcat 2\webapps\examples
Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory G:\Tomcat 2\webapps\host-manager
Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory G:\Tomcat 2\webapps\manager
Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory G:\Tomcat 2\webapps\ROOT
Apr 26, 2019 5:32:05 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
Apr 26, 2019 5:32:05 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Apr 26, 2019 5:32:05 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1092 ms
As you can see, the hello directory was not deployed. So, what is exactly happening here?
I just realized that when I issued the startup & shutdown command that there was an information in the console which looked like this:
Using CLASSPATH: "G:\Learning\tomcat9\bin\bootstrap.jar;G:\Learning\tomcat9\bin\tomcat-juli.jar"
It seemed that my classpath was pointing to the wrong path. I deleted CATALINA_HOME in the environment variable settings, and now it is working fine.

Tomcat7 doesn't initialize my spring configuration

I have a simple maven spring project, when I run the project on the tomcat server, I don't see tomcat load the configuration on the start up.
MySpringMvcDispatcherServletInitializer.java
package com.abc.xyz.config;
import
org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
public class MySpringMvcDispatcherServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
#Override
protected Class<?>[] getRootConfigClasses() {
// TODO Auto-generated method stub
return null;
}
#Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] { DemoAppConfig.class };
}
#Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
}
DemoAppConfig.java
package com.abc.xyz.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
#Configuration
#EnableWebMvc
#ComponentScan("com.abc.xyz")
public class DemoAppConfig implements WebMvcConfigurer {
}
DemoRestController.java
package com.abc.xyz.rest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
#RestController
#RequestMapping("/test")
public class DemoRestController {
// add code for the "/hello" endpoint
#GetMapping("/hello")
public String sayHello() {
return "Hello World!";
}
}
tomcat7 startup log
Oct 24, 2018 4:15:45 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:spring-rest-demo' did not find a matching property.
Oct 24, 2018 4:15:45 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SIT_Dashboard' did not find a matching property.
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.82
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Sep 29 2017 12:23:15 UTC
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.82.0
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\FAST\JDK64\LINKS\JDK8\jre
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_144-b01
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\wtpwebapps
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\endorsed
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Oct 24, 2018 4:15:45 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\FAST\JDK64\LINKS\JDK8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\FAST\JDK64\1.8.0.144\bin;C:\ProgramData\Oracle\Java\javapath;C:\oracle\product\11.2.0\client_64\BIN\;C:\Program Files\Micro Focus\Reflection\;C:\Program Files (x86)\Micro Focus\Reflection\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\1E\SMSNomad\;C:\Program Files\aim\aim-install\bin\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Git\cmd;C:\FAST\nodejs\6.11.4\;C:\Program Files\TortoiseSVN\bin;C:\opt\gate\base91\..\perl\bin;C:\Users\R633368\AppData\Roaming\npm;C:\FAST\maven\3.5.0\apache-maven-3.5.0\bin;.
Oct 24, 2018 4:15:45 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Oct 24, 2018 4:15:45 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Oct 24, 2018 4:15:45 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 768 ms
Oct 24, 2018 4:15:45 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Oct 24, 2018 4:15:45 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.82
Oct 24, 2018 4:15:46 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [472] milliseconds.
Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\docs
Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\docs has finished in 101 ms
Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\examples
Oct 24, 2018 4:15:47 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Oct 24, 2018 4:15:47 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Oct 24, 2018 4:15:47 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache#6d4352bf')
Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\examples has finished in 499 ms
Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\host-manager
Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\host-manager has finished in 157 ms
Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\manager
Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\manager has finished in 82 ms
Oct 24, 2018 4:15:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\ROOT
Oct 24, 2018 4:15:48 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\FAST\ApacheTomcat\7.0.82\apache-tomcat-7.0.82\webapps\ROOT has finished in 77 ms
Oct 24, 2018 4:15:48 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Oct 24, 2018 4:15:48 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Oct 24, 2018 4:15:48 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2191 ms
As you can see, the start up doesn't show it read my spring configuration, please help, thanks in advance
tomcat web application manager
Updated: I have a temp fix, (wow,it takes me 2 days to make some progress since there is no ERRORs  at all in the project).
Here is the trick: Right click project => properties=> Deployment
Assembly=> add=> choose Java Build Path Entries=>choose Maven
Dependencies=> apply=> OK
You can see server log refresh and it finally loads spring
configuration, and if you check
tomcat home directory/wtpwebapps/{project name}/WEB-INF/lib, you can
see all the maven dependencies are copied to here
Up to this point, It looks like everything is fine now, but I find the
other issue, every time I right click=>maven=> update project...=> it
will try to remove the dependencies(jars) in tomcat home
directory/wtpwebapps/{project name}/WEB-INF/lib,
If your project is running at the tomcat , you will get a error
because these jars are being used.
But if you stop server, and update project and then run as server
again, everything is back to normal, no error, no spring configuration
in the server startup log, then you have to do the same trick again.
I tried so many online solutions about "maven project update will
remove jars in tomcat server", none of them are working. So if anyone
has the the fix, please shared

Tomcat7 takes too much time to start

I am using tomcat7 as application server to run my java web application (.war) when I restart tomcat it take 20-25 mins to deploy may war file.
i get this log when i restart tomcat :
Sep 24, 2016 9:45:29 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 24, 2016 9:45:29 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.68 (Ubuntu)
Sep 24, 2016 9:45:29 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/tnu.war
Sep 24, 2016 9:45:30 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(/var/lib/tomcat7/webapps/tnu/WEB-INF/lib/javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Sep 24, 2016 9:45:33 AM org.apache.catalina.startup.TldConfig execute
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 24, 2016 9:46:51 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Sep 24, 2016 9:46:51 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Sep 24, 2016 9:46:51 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Sep 24, 2016 9:46:51 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Sep 24, 2016 9:46:51 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Sep 24, 2016 9:46:51 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.68 (Ubuntu)
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jun 27 2016 18:13:17 UTC
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.68.0
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 4.4.0-36-generic
INFO: Server version: Apache Tomcat/7.0.68 (Ubuntu)
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jun 27 2016 18:13:17 UTC
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.68.0
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 4.4.0-36-generic
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /var/lib/tomcat7
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /usr/share/tomcat7
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.awt.headless=true
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Xmx128m
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -XX:+UseConcMarkSweepGC
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/var/lib/tomcat7
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/usr/share/tomcat7
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp
INFO: Command line argument: -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp
Sep 24, 2016 9:46:52 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 744 ms
Sep 24, 2016 9:46:52 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 24, 2016 9:46:52 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.68 (Ubuntu)
Sep 24, 2016 9:46:52 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/tnu.war
Sep 24, 2016 9:46:53 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFile
INFO: validateJarFile(/var/lib/tomcat7/webapps/tnu/WEB-INF/lib/javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Sep 24, 2016 9:46:56 AM org.apache.catalina.startup.TldConfig execute
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 24, 2016 10:03:01 AM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [965,010] milliseconds.
log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender.
log4j:WARN No such property [maxFileSize] in org.apache.log4j.DailyRollingFileAppender.
24 Sep 2016 10:03:01,669 - [localhost-startStop-1] DEBUG [org.jboss.logging] [] - Logging Provider: org.jboss.logging.Log4jLoggerProvider
24 Sep 2016 10:03:01,694 - [localhost-startStop-1] DEBUG [logging.loggers.YWLogger] [] - Sat Sep 24 10:03:01 UTC 2016 - [ ConstantReader ] File Found
File Found
24 Sep 2016 10:03:01,697 - [localhost-startStop-1] DEBUG [reqfilter.interceptor.MobReqFilter] [] - MobRequestFilter : init + webapp path : /var/lib/tomcat7/webapps/tnu/
24 Sep 2016 10:03:01,698 - [localhost-startStop-1] DEBUG [reqfilter.interceptor.MobReqFilter] [] - init params : WEB-INF/classes/log4j.properties
Sep 24, 2016 10:03:05 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/tomcat7/webapps/tnu.war has finished in 973,344 ms
Sep 24, 2016 10:03:05 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
Sep 24, 2016 10:03:05 AM org.apache.catalina.core.StandardContext setPath
WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
Sep 24, 2016 10:03:06 AM org.apache.catalina.startup.TldConfig execute
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 24, 2016 10:03:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /var/lib/tomcat7/webapps/ROOT has finished in 331 ms
Sep 24, 2016 10:03:06 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Sep 24, 2016 10:03:06 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 973768 ms
I have to wait for 20-25 mins after i restart tomcat7.Any solution for this?
Note : OS - ubuntu 14.04 on digitalocean cloud.
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [965,010] milliseconds.
This is the process that takes a lot of server time.
Creation of SecureRandom itself takes 16.0835 Minutes.
Fortunately, Apache wiki has a workaround for this:
Tomcat 7+ heavily relies on SecureRandom class to provide random values for its session ids and in other places. Depending on your JRE it can cause delays during startup if entropy source that is used to initialize SecureRandom is short of entropy. You will see warning in the logs when this happens, e.g.:
<DATE> org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [5172] milliseconds.
There is a way to configure JRE to use a non-blocking entropy source by setting the following system property: -Djava.security.egd=file:/dev/./urandom
In case of headless servers, Haveged is a possible solution for tomcat being too slow to start due to low entropy. One important advantage of using Haveged over urandom is, you don't have to compromise on security to speed up the tomcat start up. I had a similar post.
Tomcat takes too much time to start - Java SecureRandom.
Read this Tomcat takes too long to start

open shift war deployment error

getting below error when deploying war to openshift using git command..i was able to deploy correctly earlier but not sure what happened and now not able to deploy and getting this error..in local i am able to run the same wat correctly.
Sep 25, 2014 12:59:53 PM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Sep 25, 2014 12:59:53 PM org.apache.catalina.startup.Catalina addClusterRuleSetINFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.ap
ache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Sep 25, 2014 12:59:54 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /opt/rh/mysql55/root/usr/lib64:/usr/java/packages/lib/i386:/lib:/usr/lib
Sep 25, 2014 12:59:55 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-127.3.114.129-8080"]
Sep 25, 2014 12:59:55 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2841 ms
Sep 25, 2014 12:59:56 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 25, 2014 12:59:56 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Sep 25, 2014 12:59:56 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/openshift/53579b125004465e18000995/app-root/runtime/dependencies/jbossews/webapps/abc.war
Sep 25, 2014 1:00:56 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Sep 25, 2014 1:00:56 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
Sep 25, 2014 1:00:56 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/53579b125004465e18000995/app-root/runtime/dependencies/jbossews/webapps/ROOT.war has finished in
8,534 ms
Sep 25, 2014 1:00:56 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.3.114.129-8080"]
Sep 25, 2014 1:00:56 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 60436 ms
Looks like an exception is being thrown from your application. Is this the catalina.out log? How are you deploying the application (via IDE or?).

Eclipse is reading Apache Catalina output from standard error

Based on the color of my Eclipse console, it seems as though it's outputting standard console messages to the Standard Error buffer. Why does it do this? And, more importantly, is there a way to change this so that it works properly to make debugging simpler?
May 14, 2013 4:44:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;.
May 14, 2013 4:44:12 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
May 14, 2013 4:44:12 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
May 14, 2013 4:44:12 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 681 ms
May 14, 2013 4:44:12 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 14, 2013 4:44:12 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.30
May 14, 2013 4:44:13 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
May 14, 2013 4:44:13 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 14, 2013 4:44:13 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 396 ms

Categories