Deploying jenkins war file using java command - java

I am trying to deploy a jenkins war file. I executed the following command
java -jar jenkins.war
Below is the log file.
PS C:\Sites> java -jar jenkins.war Running from: C:\Sites\jenkins.war
webroot: $user.home/.jenkins Sep 03, 2014 6:09:15 PM winstone.Logger
logInternal INFO: Beginning extraction from war file Sep 03, 2014
6:09:28 PM org.eclipse.jetty.util.log.JavaUtilLog info INFO:
jetty-8.y.z-SNAPSHOT Sep 03, 2014 6:09:35 PM
org.eclipse.jetty.util.log.JavaUtilLog info INFO: NO JSP Support for ,
did not find org.apache.jasper.servlet.JspServlet Jenkins home
directory: C:\Users\Mathew.jenkins found at: $user.home/.jenkins
Sep 03, 2014 6:09:46 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started SelectChannelConnector#0.0.0.0:8080 Sep 03, 2014 6:09:46
PM winstone.Logger logInternal INFO: Winstone Servlet Engine v2.0
running: controlPort=disabled Sep 03, 2014 6:09:46 PM
jenkins.InitReactorRunner$1 onAttained INFO: Started initialization
Sep 03, 2014 6:10:26 PM jenkins.InitReactorRunner$1 onAttained INFO:
Listed all plugins Sep 03, 2014 6:10:26 PM jenkins.InitReactorRunner$1
onAttained INFO: Prepared all plugins Sep 03, 2014 6:10:26 PM
jenkins.InitReactorRunner$1 onAttained INFO: Started all plugins Sep
03, 2014 6:10:26 PM jenkins.InitReactorRunner$1 onAttained INFO:
Augmented all extensions Sep 03, 2014 6:10:26 PM
jenkins.InitReactorRunner$1 onAttained INFO: Loaded all jobs Sep 03,
2014 6:10:42 PM org.jenkinsci.main.modules.sshd.SSHD start INFO:
Started SSHD at port 55062 Sep 03, 2014 6:10:45 PM
jenkins.InitReactorRunner$1 onAttained INFO: Completed initialization
Sep 03, 2014 6:10:45 PM hudson.WebAppMain$3 run INFO: Jenkins is fully
up and running Sep 03, 2014 6:11:48 PM
hudson.model.DownloadService$Downloadable load INFO: Obtained the
updated data file for hudson.tasks.Maven.MavenInstaller Sep 03, 2014
6:11:51 PM hudson.model.DownloadService$Downloadable load INFO:
Obtained the updated data file for hudson.tasks.Ant.AntInstaller Sep
03, 2014 6:11:52 PM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tools.JDKInstaller Sep
03, 2014 6:12:11 PM hudson.model.UpdateSite updateData INFO: Obtained
the latest update center data file for UpdateSource default
Can anyone tell me what does the command java-jar jenkins.war do?
WHere did it deploy my war file?
Which web server does it use and how does localhost:8080 point to jenkins application?

Q. Can anyone tell me what does the command java -jar jenkins.war do?
java -jar expects a jar file name, in this case, jenkins.war.
An executable Java program can be packaged in a JAR file, along with any libraries the program uses. Executable JAR files have the manifest specifying the entry point class with Main-Class: myPrograms.MyClass and an explicit Class-Path (and the -cp argument is ignored). Some operating systems can run these directly when clicked. The typical invocation is "java -jar foo.jar" from a command line
Reference: http://en.wikipedia.org/wiki/JAR_(file_format)
Q. Where did it deploy my war file?
In case it is a RHEL/CentOS installation, your war is deployed at /var/lib/jenkins
You can find out the location by reading the file /etc/init.d/jenkins. You will find a variable named JENKINS_CONFIG
JENKINS_CONFIG=/etc/sysconfig/jenkins
Q. Which web server does it use and how does localhost:8080 point to jenkins application?
In case it is a RHEL/CentOS installation, you will generally find the file here: /etc/sysconfig/jenkins. In this file, you define port on which Jenkins runs.

1) It executes the java arvhive jenkins.war (see http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jar.html)
2) From the output you posted yourself:
Running from: C:\Sites\jenkins.war webroot: $user.home/.jenkins
the user.home variable may refer to your ~ directory on Linux, or your Document and Settings on windows. See http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
3) From the output you posted yourself:
jetty-8.y.z-SNAPSHOT
INFO: Started SelectChannelConnector#0.0.0.0:8080
See http://www.eclipse.org/jetty/. This is a web server that register a listener on port 8080.

it uses the Manifest.mf inside, if you open the war, you would understand how it runs
The Main class uses winstone http://winstone.sourceforge.net/
I would recommend to use glassfish, jetty or tomcat - for better control on configuration
there is a bug open for that
https://issues.jenkins-ci.org/browse/JENKINS-18366
Also see various container notes
https://wiki.jenkins-ci.org/display/JENKINS/Containers

Related

Why my Tomcat 7 stop working after deploy

I have a grails app that runs on dev environment and I crated the war without problems.
In the server, I stop the service using "sudo service tomcat7 stop" command and put the war file into the server folder "/var/lib/tomcat7/webapps" and start the server again with the command "sudo service tomcat7 start".
For checking the state of the server I run "sudo service tomcat7 status" and get the "Tomcat servlet engine is running with pid 19169" response, and check if the application deploys correctly on the folder "/var/lib/tomcat7/webapps" and I see the project's folder there.
Right now, if I check the catalina.out file, I can't see any deploy error having this:
May 27, 2020 9:04:31 PM org.apache.coyote.AbstractProtocol init INFO:
Initializing ProtocolHandler ["http-bio-80"] May 27, 2020 9:04:31 PM
org.apache.catalina.startup.Catalina load INFO: Initialization
processed in 1280 ms May 27, 2020 9:04:31 PM
org.apache.catalina.core.StandardService startInternal INFO: Starting
service Catalina May 27, 2020 9:04:31 PM
org.apache.catalina.core.StandardEngine startInternal INFO: Starting
Servlet Engine: Apache Tomcat/7.0.26 May 27, 2020 9:04:33 PM
org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor
/etc/tomcat7/Catalina/localhost/docs.xml May 27, 2020 9:04:33 PM
org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor
/etc/tomcat7/Catalina/localhost/host-manager.xml May 27, 2020 9:04:33
PM org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor
/etc/tomcat7/Catalina/localhost/manager.xml May 27, 2020 9:04:33 PM
org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor
/etc/tomcat7/Catalina/localhost/examples.xml May 27, 2020 9:04:33 PM
org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web
application archive /var/lib/tomcat7/webapps/fleetcontroller.war
log4j:WARN No appenders could be found for logger
(net.bull.javamelody). log4j:WARN Please initialize the log4j system
properly. log4j:WARN See
http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
But if I wait a while, the tomcat service is stoped.
When I check the server status with "sudo service tomcat7 status" I get this msg
Tomcat servlet engine is not running, but pid file exists.
And the catalina.out show me:
WARN intercept.RequestmapFilterInvocationDefinition - Exception
initializing; this is ok if it's at startup and due to GORM not being
initialized yet since the first web request will re-initialize. Error
message is: {0} 2020-05-27 21:14:13,192 [pool-2-thread-1] WARN
module.ModuleDeclarationsFactory - resources artefact
KickstartResources does not define any modules | Using LESS files to
generating CSS files!
Please, if someone can help with that, because I don't know how to find the problem.
Really thanks for your time.
It was a virtual machine size problem.
I checked some server parameters and see that they was lower than production. infrastructure office changed the virtual server size and it starts to work!
Thanks you for your time!

Getting Exception whenever I start Jenkins

Whenever I run this command java -jar jenkins.war --ajp13Port=-1 --httpPort=8080 it throws
First Jenkins started with daemon mode where it was restarting the process then I have tried to start it manually but getting the same error.
I even tried with older version of Jenkins as well but gettting the same error.
Jenkins Version - 2.107.2
Running from: /Applications/Jenkins/jenkins.war
webroot: $user.home/.jenkins
Apr 25, 2018 2:54:55 PM Main deleteWinstoneTempContents
WARNING: Failed to delete the temporary Winstone file /var/folders/60/r656jt5d01s0g2qtqdlycjbr0000gq/T/winstone/jenkins.war
Apr 25, 2018 2:54:55 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Logging initialized #429ms
Apr 25, 2018 2:54:55 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Apr 25, 2018 2:54:56 PM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: Empty contextPath
Apr 25, 2018 2:54:56 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
java.lang.NoSuchMethodError: org.eclipse.jetty.server.handler.HandlerWrapper.updateBean(Ljava/lang/Object;Ljava/lang/Object;Z)V
at org.eclipse.jetty.server.handler.HandlerWrapper.setHandler(HandlerWrapper.java:95)
at org.eclipse.jetty.servlet.ServletContextHandler.doSetHandler(ServletContextHandler.java:188)
at org.eclipse.jetty.servlet.ServletContextHandler.relinkHandlers(ServletContextHandler.java:210)
at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:171)
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:289)
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:221)
at winstone.HostConfiguration$1.<init>(HostConfiguration.java:155)
at winstone.HostConfiguration.create(HostConfiguration.java:155)
at winstone.HostConfiguration.<init>(HostConfiguration.java:81)
at winstone.HostGroup.initHost(HostGroup.java:66)
at winstone.HostGroup.<init>(HostGroup.java:45)
at winstone.Launcher.<init>(Launcher.java:145)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:312)
at Main.main(Main.java:136)
Check the dependency tree or open the war by extracting it and see that the particular method is available or not.
This may be the case when it is taking a wrong jar while building the war file from it.

Tomcat auto unpack WAR file changed the last modified time of files

I experienced an issue when I tried to deploy a WAR file to tomcat.
While the auto unpack process from tomcat, the last modified date of unpack files were being modified.
The date of unpack web app. files became 12 hours faster, and this results several miscellaneous errors.
I tried to unpack manually via jar -xvf, the last modified date of files remain unchanged.
I also tested in a local tomcat (same timezone with dev. env.), nothing changed in last modified date.
It seems the tomcat timezone issue, does setup on tomcat I can do to solve out this issue?
Great thanks for any help.
Environment:
Tomcat 6 on linux, with GMT-4 timezone both set in server and tomcat
the WAR file created by machine with GMT+8 timezone set
In my case, the application was setting the default timezone from within Tomcat as the application was being initialized. The difference introduced by the change in timezones matched the offset in the file modification times.
I was surprised that any code within the app could run before being unpacked, but the Tomcat container does give the application an opportunity to run initialization code prior to all files being unpacked.
Look for an occurrence of TimeZone.setDefault() and try removing the call or moving the call later in the initialization sequence.
Helpful clues:
This JSP told me that the application was always running with a specific timezone regardless of the environment settings:
<html>
<body>
<h2>Current Timezone</h2>
<% java.util.Date date = new java.util.Date();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("zzz"); %>
<%=sdf.format(date)%>
</body>
</html>
In the log files, I could see the instant the timezone was changing (four hour jump). It happens at the time the app is loaded.
Note: Once set, the timezone will stay set until Tomcat is restarted.
Sep 18, 2015 2:34:26 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8443
Sep 18, 2015 2:34:26 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 285 ms
Sep 18, 2015 2:34:26 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 18, 2015 2:34:26 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
Sep 18, 2015 2:34:26 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive myWebapp.war
Sep 18, 2015 6:34:30 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Sep 18, 2015 6:34:34 PM org.apache.catalina.core.ApplicationContext log
INFO: org.tuckey.web.filters.urlrewrite.UrlRewriteFilter INFO: loaded (conf ok)
Sep 18, 2015 6:34:34 PM org.apache.catalina.core.ApplicationContext log
INFO: struts: []: Verifying ModuleConfig for this module
Sep 18, 2015 6:34:34 PM org.apache.catalina.core.ApplicationContext log
INFO: struts: []: Verification of ModuleConfig has been completed
Sep 18, 2015 6:34:34 PM org.apache.catalina.core.ApplicationContext log
INFO: struts: []: Verifying ModuleConfig for this module

Troubleshoot Eclipse's "Run on server" deploy

I am taking over an existing Struts-based web application and am trying to deploy it for the first time on my local machine. My predecessor told me to run it through Eclipse on a Tomcat server.
I have installed the latest tomcat and it is running fine. I have grabbed the code from their CVS server and, with a few tweaks, removed all of the errors from the Java files. I then created a new Run Configuration having it run as "Run on server".
When I run the Run Config, the tomcat server starts up without error messages in the Console and an Eclipse browser page pops up to the correct local URL. The returned page is a 404, however. Looking at my Tomcat "webaps" folder, I see that my application is not there.
My question is, how can I troubleshoot this? My tomcat error logs do not get updated when I deploy and the Console output, shown below, offers no hint that there is a problem.
May 30, 2011 3:48:07 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: <long list of paths>
May 30, 2011 3:48:07 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
May 30, 2011 3:48:07 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 410 ms
May 30, 2011 3:48:07 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 30, 2011 3:48:07 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
May 30, 2011 3:48:08 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor CanPost_Emil.xml
May 30, 2011 3:48:08 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
May 30, 2011 3:48:08 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
May 30, 2011 3:48:08 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
May 30, 2011 3:48:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 244 ms
This is not the way to run web apps inside Eclipse.
Go to the Server view panel instead, and choose Add server. Here install the Tomcat adapter according to the instructions, and then add the projects you have (if they are Dynamic Web Projects). You can now start and stop the server and have the projects chosen updated when you change.
Do it this way. Do not try to create a Run Configuration launching Tomcat.
I have exactly the same problem.
While this is not a solution to the problem itself (running the project on Tomcat from within Eclipse), it is a way to run the project:
Pack(age) the project (I use maven: 'mvn clean package')
Copy the .war file into the webapps dir inside your tomcat installation.
(if not already running) Start up tomcat.
This works for me. I'm still looking for the proper answer to your question, but until I find it I'll just continue to manually package/deploy the project.

An incompatible version 1.1.12 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.17

I downloaded Apache Tomcat 7.x. When I add this Tomcat in Eclipse I get this error:
Jan 25, 2011 3:21:05 PM org.apache.catalina.core.AprLifecycleListener init
SEVERE: An incompatible version 1.1.12 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.17
Jan 25, 2011 3:21:05 PM org.apache.catalina.core.AprLifecycleListener init
SEVERE: An incompatible version 1.1.12 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.17
Jan 25, 2011 3:21:05 PM org.apache.catalina.core.AprLifecycleListener init
SEVERE: An incompatible version 1.1.12 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.17
Jan 25, 2011 3:21:05 PM org.apache.catalina.core.AprLifecycleListener init
SEVERE: An incompatible version 1.1.12 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.17
Jan 25, 2011 3:21:05 PM org.apache.catalina.core.AprLifecycleListener init
SEVERE: An incompatible version 1.1.12 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.1.17
Jan 25, 2011 3:21:08 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 25, 2011 3:21:08 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 25, 2011 3:21:08 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3054 ms
Jan 25, 2011 3:21:08 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 25, 2011 3:21:08 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.6
Jan 25, 2011 3:21:08 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jan 25, 2011 3:21:08 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 25, 2011 3:21:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 251 ms
How can I solve this problem?
When I open the localhost:8080/manager/html it shows the following error:
HTTP Status 404 - /manager/html
type Status report
message /manager/html
description The requested resource (/manager/html) is not available.
Apache Tomcat/7.0.6
The first error certainly sounds like a version mismatch. The APR library is a library linked in at runtime based on your path (which itself can be based on where you execute Tomcat from). It sounds like you have the APR library for Tomcat 6. It's possible that Eclipse is providing this APR library.
Tomcat ships with an APR library but in order to ease installation Tomcat doesn't automatically modify the path to point at the APR library. The Eclipse Tomcat integration may (I'm not sure on this one, haven't used the integration before) include the APR libraries to make it easier to use Tomcat.
Check and make sure that Eclipse isn't configured to use an earlier version of Tomcat and if it is, either upgrade Eclipse to Tomcat 7 or downgrade Tomcat to the version specified in Eclipse.
If you can't figure it out then you don't necessarily have to worry about it at the moment. Tomcat should work anyways without the APR libraries. The only benefit you will get from the APR libraries is increased performance and since this is probably the start of your project that doesn't have to be worked out right away.
The second issue, the /manager/ page, could be Tomcat configuration. Tomcat won't actually display the manager page (and it will give you that error) unless users have been configured with manager permissions.
Try going to just / (i.e. http://localhost:8080), that page should load regardless of user configuration.
In my case I had inadvertently installed the APR library when I install once Tomcat locally on my Linux using the package manager. On Debian/Ubuntu this installed the APR package for a different Tomcat version (the one bundled with your distribution) which caused this error.
After simply
sudo apt-get purge libtcnative-1
The error was gone.

Categories