How to write a unit test with neo4j-in-memory-server - neo4j

I have written a webservice and would now like to write some unit tests for it.
I stumbled across Michael Hunger's in memory server.
Due to the sparse documentation, I have a hard time setting up only one unit test.
I cloned the project, included it in my workspace and added it as a dependency to my project.
In order to test my web service, I wrote this method to create an in-memory neo4j server:
#BeforeClass
public static void setupInMemoryServer()
{
CommunityBootstrapper s = new CommunityBootstrapper();
int status = -1;
try
{
status = s.start();
}
catch(Exception e)
{
System.out.println("could not start server");
e.printStackTrace();
System.out.println(e.getMessage());
System.out.println(e.getCause());
System.out.println(e.getLocalizedMessage());
}
System.out.println(hostAvailabilityCheck());
System.out.println("status = "+status);
}
public static boolean hostAvailabilityCheck() {
try (Socket s = new Socket("127.0.0.1", 7474)) {
return true;
} catch (IOException ex) {
System.out.println ("Neo server not online");
}
return false;
}
When I run this code, I get the following output:
Mai 29, 2014 10:13:17 PM org.neo4j.server.logging.Logger log SEVERE: Unable to upgrade database Mai 29, 2014 10:13:17 PM
org.neo4j.server.logging.Logger log SEVERE:
org.neo4j.server.ServerStartupException: Starting Neo4j Server failed:
Startup failed due to preflight task [class
org.neo4j.server.preflight.PerformUpgradeIfNecessary]: Unable to
upgrade database at
org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:218)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:87) at
org.neo4j.server.Bootstrapper.start(Bootstrapper.java:74) at
com.youtube.rest.status.test.CreateUserTest.setupInMemoryServer(CreateUserTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.neo4j.server.preflight.PreflightFailedException:
Startup failed due to preflight task [class
org.neo4j.server.preflight.PerformUpgradeIfNecessary]: Unable to
upgrade database at
org.neo4j.server.AbstractNeoServer.runPreflightTasks(AbstractNeoServer.java:335)
at
org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:152)
... 19 more
Mai 29, 2014 10:13:17 PM org.neo4j.server.logging.Logger log SEVERE:
Failed to start Neo Server on port [7474]
true
status = 1
Mai 29, 2014
10:13:17 PM org.neo4j.server.logging.Logger log WARNING: Failed to
cleanly shutdown database. Mai 29, 2014 10:13:17 PM
org.neo4j.server.logging.Logger log INFO: Successfully shutdown Neo
Server on port [7474], database [unknown location]
I don't know why this happens since the server is built in memory and everything is (should) created temporarily. I neither understand, how database update conflicts can occur nor how to resolve them.

Based on the string "Unable to upgrade database" in your stack trace, it looks like your database needs to be upgraded, but the upgrade cannot be done automatically. You may need to do an "explicit upgrade", as described on this page.

Related

Jenkins unable to run periodic/scheduled jobs randomly - "error persisting EventHistoryStore entry file"

Jenkins version - Jenkins ver. 2.138.3
OS - Ubuntu 16.04.5 LTS
Jenkins sometimes is unable to run cron/scheduled jobs randomly with below error -
Jan 25, 2019 12:30:00 AM org.jenkinsci.plugins.ssegateway.EventHistoryStore store
SEVERE: Unexpected error persisting EventHistoryStore entry file.
java.io.IOException: Unexpected error creating channel event log dir /var/lib/jenkins/logs/sse-events/job.
at org.jenkinsci.plugins.ssegateway.EventHistoryStore.getChannelDir(EventHistoryStore.java:205)
at org.jenkinsci.plugins.ssegateway.EventHistoryStore.store(EventHistoryStore.java:120)
at org.jenkinsci.plugins.ssegateway.EventHistoryStore$EventHistoryLogger.onMessage(EventHistoryStore.java:324)
at org.jenkinsci.plugins.pubsub.GuavaPubsubBus$GuavaSubscriber$1.run(GuavaPubsubBus.java:137)
at hudson.security.ACL.impersonate(ACL.java:273)
at org.jenkinsci.plugins.pubsub.GuavaPubsubBus$GuavaSubscriber.onMessage(GuavaPubsubBus.java:133)
at sun.reflect.GeneratedMethodAccessor1831.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:68)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
at com.google.common.eventbus.AsyncEventBus.access$001(AsyncEventBus.java:31)
at com.google.common.eventbus.AsyncEventBus$1.run(AsyncEventBus.java:94)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Jan 25, 2019 12:30:00 AM org.jenkinsci.plugins.ssegateway.EventHistoryStore store
SEVERE: Unexpected error persisting EventHistoryStore entry file.
java.io.IOException: Unexpected error creating channel event log dir /var/lib/jenkins/logs/sse-events/job.
at org.jenkinsci.plugins.ssegateway.EventHistoryStore.getChannelDir(EventHistoryStore.java:205)
at org.jenkinsci.plugins.ssegateway.EventHistoryStore.store(EventHistoryStore.java:120)
at org.jenkinsci.plugins.ssegateway.EventHistoryStore$EventHistoryLogger.onMessage(EventHistoryStore.java:324)
at org.jenkinsci.plugins.pubsub.GuavaPubsubBus$GuavaSubscriber$1.run(GuavaPubsubBus.java:137)
at hudson.security.ACL.impersonate(ACL.java:273)
at org.jenkinsci.plugins.pubsub.GuavaPubsubBus$GuavaSubscriber.onMessageJan 25, 2019 12:49:55 AM hudson.model.AsyncPeriodicWork$1 run
Please suggest.

Unable to execute jenkins.war in command Prompt

Remaining logNavigated to folder where my .war is located and executed 'java -jar jenkins.war'.Then this is the error i am getting while i am executing in cmd.
`Unable to run Jenkins.war in cmd,These is the whole log
WARNING: An illegal reflective access operation has occurredWARNING: Illegal reflective access by Main (file:/C:/Self%20Learning/Jenkins/jenkins.war) to field java.util.zip.ZipFile.nameWARNING: Please consider reporting this to the maintainers of MainWARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operationsWARNING: All illegal access operations will be denied in a future releaseRunning from: C:\Self Learning\Jenkins\jenkins.warwebroot: $user.home/.jenkins33mFeb 22, 2018 12:38:13 PM Main deleteWinstoneTempContentsWARNING: Failed to delete the temporary Winstone file C:\Users\bchalla\AppData\Local\Temp\winstone\jenkins.war0mFeb 22, 2018 12:38:13 PM org.eclipse.jetty.util.log.Log initializedINFO: Logging initialized #704ms to org.eclipse.jetty.util.log.JavaUtilLogFeb 22, 2018 12:38:13 PM winstone.Logger logInternalINFO: Beginning extraction from war file33mFeb 22, 2018 12:38:16 PM org.eclipse.jetty.server.handler.ContextHandler setContextPathWARNING: Empty contextPath[0mFeb 22, 2018 12:38:16 PM org.eclipse.jetty.server.Server doStartINFO: jetty-9.4.z-SNAPSHOTFeb 22, 2018 12:38:18 PM org.eclipse.jetty.webapp.StandardDescriptorProcessor visitServletINFO: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServletFeb 22, 2018 12:38:18 PM org.eclipse.jetty.server.session.DefaultSessionIdManager doStartINFO: DefaultSessionIdManager workerName=node0Feb 22, 2018 12:38:18 PM org.eclipse.jetty.server.session.DefaultSessionIdManager doStartINFO: No SessionScavenger set, using defaultsFeb 22, 2018 12:38:18 PM org.eclipse.jetty.server.session.HouseKeeper startScavengingINFO: Scavenging every 660000msJenkins home directory: C:\Users\bchalla\.jenkins found at: $user.home/.jenkinsFeb 22, 2018 12:38:19 PM org.eclipse.jetty.server.handler.ContextHandler doStartINFO: Startedw.#f1a45f8{/,file:///C:/Users/bchalla/.jenkins/war/,AVAILABLE}C:\Users\bchalla\.jenkins\war}Feb 22, 2018 12:38:19 PMorg.eclipse.jetty.server.AbstractConnector doStopINFO: StoppedServerConnector#270b6b5e{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}Feb 22, 2018 12:38:19 PM org.eclipse.jetty.server.session.HouseKeeper stopScavengingINFO: Stopped scavengingfeb 22, 2018 12:38:19 PM hudson.WebAppMain contextDestroyedINFO: Shutting down a Jenkins instance that was still starting ujava.lang.Throwable: reasonat hudson.WebAppMain.contextDestroyed(WebAppMain.java:388)atorg.eclipse.jetty.server.handler.ContextHandler.callContextDestroyed(ContextHandler.java:898)at org.eclipse.jetty.servlet.ServletContextHandler.callContextDestroyed(ServletContextHandler.java:545)atorg.eclipse.jetty.server.handler.ContextHandler.stopContext(ContextHandler.java:873)atorg.eclipse.jetty.servlet.ServletContextHandler.stopContext(ServletContextHandler.java:355)atorg.eclipse.jetty.webapp.WebAppContext.stopWebapp(WebAppContext.java:1507)at org.eclipse.jetty.webapp.WebAppContext.stopContext(WebAppContext.java:1471 at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:927)
at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:271)
at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:569)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:124)
at org.eclipse.jetty.server.Server.doStop(Server.java:523)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at winstone.Launcher.shutdown(Launcher.java:307)
at winstone.Launcher.<init>(Launcher.java:167)
at winstone.Launcher.main(Launcher.java:354)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at Main._main(Main.java:294)
at Main.main(Main.java:132)Exception in thread "Jenkins initialization thread" Feb 22, 2018 12:38:19 PM org.eclipse.jetty.server.handler.ContextHandler doStopINFO: Stopped w.#f1a45f8{/,null,UNAVAILABLE}{C:\Users\bchalla\.jenkins\war}java.lang.NoClassDefFoundError: hudson/util/HudsonFailedToLoad
at hudson.WebAppMain$3.run(WebAppMain.java:247)Caused by: java.lang.ClassNotFoundException: hudson.util.HudsonFailedToLoad
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:560)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 1 moreFeb 22, 2018 12:38:19 PM winstone.Logger logInternalINFO: Winstone shutdown successfullyjava.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:156)
at winstone.Launcher.main(Launcher.java:354)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at Main._main(Main.java:294)
at Main.main(Main.java:132)Caused by: java.net.BindException: Address already in use: bind
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Unknown Source)
at java.base/sun.nio.ch.Net.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at
'
Can you please check in the processes if any other instance of Jenkins is running, also if there are any, please kill all of them start command prompt in admin mode and then try executing command again.
You can also check if the port is being occupied by some other process.

InitialAdminPassword file is not created in jenkins folder in windows 10 os

The Jenkins installation seems like it went fine but when I launch the localhost:8080, Jenkins is asking for password. However, I am not able to find the initialAdminPassword file in my system. I checked it multiple times; it seems that this file does not exist. Therefore, what is the issue and how do I get the initial Jenkins login password?
Feb 06, 2018 6:56:46 PM Main deleteWinstoneTempContents
WARNING: Failed to delete the temporary Winstone file C:\WINDOWS\TEMP\winstone\jenkins.war
Feb 06, 2018 6:56:47 PM org.eclipse.jetty.util.log.Log initialized
INFO: Logging initialized #3166ms to org.eclipse.jetty.util.log.JavaUtilLog
Feb 06, 2018 6:56:48 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Feb 06, 2018 6:57:09 PM org.eclipse.jetty.server.handler.ContextHandler setContextPath
WARNING: Empty contextPath
Feb 06, 2018 6:57:09 PM org.eclipse.jetty.server.Server doStart
INFO: jetty-9.4.z-SNAPSHOT
Feb 06, 2018 6:57:09 PM org.eclipse.jetty.webapp.StandardDescriptorProcessor visitServlet
INFO: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
Feb 06, 2018 6:57:09 PM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
INFO: DefaultSessionIdManager workerName=node0
Feb 06, 2018 6:57:09 PM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
INFO: No SessionScavenger set, using defaults
Feb 06, 2018 6:57:09 PM org.eclipse.jetty.server.session.HouseKeeper startScavenging
INFO: Scavenging every 600000ms
Feb 06, 2018 6:57:10 PM org.eclipse.jetty.server.handler.ContextHandler doStart
INFO: Started w.#f27d66{/,file:///C:/Program%20Files%20(x86)/Jenkins/war/,AVAILABLE}{C:\Program Files (x86)\Jenkins\war}
Feb 06, 2018 6:57:10 PM org.eclipse.jetty.server.AbstractConnector doStop
INFO: Stopped ServerConnector#1cd604c{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
Feb 06, 2018 6:57:10 PM org.eclipse.jetty.server.session.HouseKeeper stopScavenging
INFO: Stopped scavenging
Feb 06, 2018 6:57:10 PM hudson.WebAppMain contextDestroyed
INFO: Shutting down a Jenkins instance that was still starting up
java.lang.Throwable: reason
at hudson.WebAppMain.contextDestroyed(WebAppMain.java:388)
at org.eclipse.jetty.server.handler.ContextHandler.callContextDestroyed(ContextHandler.java:898)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextDestroyed(ServletContextHandler.java:545)
at org.eclipse.jetty.server.handler.ContextHandler.stopContext(ContextHandler.java:873)
at org.eclipse.jetty.servlet.ServletContextHandler.stopContext(ServletContextHandler.java:355)
at org.eclipse.jetty.webapp.WebAppContext.stopWebapp(WebAppContext.java:1507)
at org.eclipse.jetty.webapp.WebAppContext.stopContext(WebAppContext.java:1471)
at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:927)
at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:271)
at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:569)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:124)
at org.eclipse.jetty.server.Server.doStop(Server.java:523)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at winstone.Launcher.shutdown(Launcher.java:307)
at winstone.Launcher.<init>(Launcher.java:167)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Main._main(Main.java:294)
at Main.main(Main.java:132)
Feb 06, 2018 6:57:10 PM org.eclipse.jetty.server.handler.ContextHandler doStop
INFO: Stopped w.#f27d66{/,null,UNAVAILABLE}{C:\Program Files (x86)\Jenkins\war}
Exception in thread "Jenkins initialization thread" java.lang.NoClassDefFoundError: hudson/util/HudsonFailedToLoad
at hudson.WebAppMain$3.run(WebAppMain.java:247)
Caused by: java.lang.ClassNotFoundException: hudson.util.HudsonFailedToLoad
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:560)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
Feb 06, 2018 6:57:10 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:156)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Main._main(Main.java:294)
at Main.main(Main.java:132)
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:298)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:431)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:154)
... 7 more
Feb 06, 2018 6:57:10 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:156)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Main._main(Main.java:294)
at Main.main(Main.java:132)
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:298)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:431)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:154)
... 7 more
I was having a similar problem on windows where the folder was missing.
I went to C:\Program Files\Jenkins and opened jenkins.err.log
It had the key that I needed to proceed.
If you are unable to find the secret file, please uninstall and re-install Jenkins again. Else, delete the .jenkins folder in C:\Users\...\.jenkins\secrets.
===============
Are you using jenkins.war or jenkins.exe to install? If you are using jenkins.exe, try to download jenkins.war from Jenkins war.
Open Command Prompt, run java -jar jenkins.war.
Click on the images to see the oputput
Open browser with URL localhost:8080/
see the file "C:\Program Files\Jenkins\jenkins.err.log"
It has initialpassword before making entry into file.
It seems the issue is that the 8080 port is occupied, so i have used 8081 and its working good.
Check if another service is using port 8080. For me I had to stop the service which i dont really need at the moment and re-run java -jar jenkins.war. with this it created the secret folder where i found the default password
for me did not show the "secret" folder ,and didn't show the "config.xml" file too ,and inside the users folder too was not showing any thing that can help me, so i did the following steps:
i changed the port number from 8080 to 8085 from the "jenkins.xml"
(C:\Program Files (x86)\Jenkins)
restart the computer
after boot up with browser i tried to go "http://localhost:8085/"
then everything solved ,now is showing the starter page of jenkins and the secret folder is created inside the jenkins folder too.
give command sudo su to login as super user
change to secrets folder
cd secrets
cat initialAdminPassword
sometimes it's in C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\secrets, as I personally experienced.
This is shown as:
In my case, I was selected port which was already in use.
Reinstalling and configuring with different port fixed the issue.
If you're using Jenkins on Docker try using
docker exec -u 0 -it name_of_jenkins_container bash
or
docker exec -u 0 -it name_of_jenkins_container /bin/bash
it will login to this container as root user.

Not able to upgrade jenkins to the latest version

Am running Jenkins 1.6.43 in its own container in Linux. I want to upgrade to latest 2.7 version. The release notes say that all I have to do is download the latest Jenkins, remove the pinned plugins and restart.
I did the same- Stopped current jenkins,downloaded using wget, removed all pinned plugins and then started it. I get "started jenkins - ok", but nothing is happening. I do not see any process running! I tried this with 2.6 and 2.7 version and I see the same result! If I revert to my previous 1.643 war and restart also, I do not see any process running.
The log shows:
SEVERE: Container startup failed
java.io.IOException: Failed to start a listener: winstone.Ajp13ConnectorFactory
at winstone.Launcher.spawnListener(Launcher.java:207)
at winstone.Launcher.<init>(Launcher.java:148)
at winstone.Launcher.main(Launcher.java:352)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at Main._main(Main.java:246)
at Main.main(Main.java:91)
Caused by: java.lang.UnsupportedOperationException: AJP support is removed in Winstone 3.0 due to Jetty 9 not supporting AJP. For reverse proxying, please use HTTP instead of AJP.
at winstone.Ajp13ConnectorFactory.start(Ajp13ConnectorFactory.java:31)
at winstone.Launcher.spawnListener(Launcher.java:205)
... 8 more
Running from: /usr/lib/jenkins/jenkins.war
Jun 05, 2016 3:17:25 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Logging initialized #930ms
Jun 05, 2016 3:17:25 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Jun 05, 2016 3:17:25 PM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: Empty contextPath
Jun 05, 2016 3:17:25 PM winstone.Logger logInternal
INFO: Winstone shutdown successfully
Jun 05, 2016 3:17:25 PM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start a listener: winstone.Ajp13ConnectorFactory
at winstone.Launcher.spawnListener(Launcher.java:207)
at winstone.Launcher.<init>(Launcher.java:148)
at winstone.Launcher.main(Launcher.java:352)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at Main._main(Main.java:246)
at Main.main(Main.java:91)
Caused by: java.lang.UnsupportedOperationException: AJP support is removed in Winstone 3.0 due to Jetty 9 not supporting AJP. For reverse proxying, please use HTTP instead of AJP.
at winstone.Ajp13ConnectorFactory.start(Ajp13ConnectorFactory.java:31)
at winstone.Launcher.spawnListener(Launcher.java:205)
... 8 more
Can someone please help!!!How to fix this?
This helped me to solve this issue
setting up JENKINS_AJP_PORT="-1" in /etc/sysconfig/jenkins and then I restarted

Failure to deploy grails app with cloudfoundry plugin

"grails cf-push" results in errors listed below. Is there a way using the cloudfoundry plugin to "start fresh". I would prefer not to lose my test data in a MySQL database and a MongoDB database.
May 18, 2012 6:31:26 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 18, 2012 6:31:26 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
May 18, 2012 6:31:26 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [org.codehaus.groovy.reflection.ClassInfo.ThreadLocalMapHandler] (value [org.codehaus.groovy.reflection.ClassInfo$ThreadLocalMapHandler#6434d75f]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference#4927d15e]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
2012-05-18 18:31:26,379 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/http/conn/ClientConnectionManager
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:66)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NoClassDefFoundError: org/apache/http/conn/ClientConnectionManager
at java.lang.Class.forName(Class.java:169)
at java.lang.Class.forName(Class.java:247)
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.ClientConnectionManager
... 2 more
Stopping Tomcat because the context stopped.
stderr.log is :
May 18, 2012 6:41:00 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-31903
May 18, 2012 6:41:00 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 403 ms
May 18, 2012 6:41:00 PM org.apache.catalina.realm.JAASRealm setContainer
INFO: Set JAAS app name Catalina
May 18, 2012 6:41:00 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 18, 2012 6:41:00 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
May 18, 2012 6:41:00 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
May 18, 2012 6:41:02 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 18, 2012 6:41:02 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
May 18, 2012 6:41:02 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [org.codehaus.groovy.reflection.ClassInfo.ThreadLocalMapHandler] (value org.codehaus.groovy.reflection.ClassInfo$ThreadLocalMapHandler#6d1576d7]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference#1c2d5534]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
If you do cf-update or delete the app and re-run cf-push, it will ask you if you want to use the existing MySQL and Mongo services. If you do there isn't any data loss - just don't delete the services along with the app before re-running cf-push.
Make sure you're using 'grails prod cf-push' since that will use the production configuration - there is a warning displayed if you run 'grails cf-push' to that effect.
The root cause is a CNFE from the HttpClient library. See if you can get it working locally and it should work fine on Cloud Foundry since you're just pushing a war file.
I found the problem. I added a service that used an external jar from a third party package. The third party package shipped with 2 jars: one with dependencies and one without dependencies. I extracted the 3rd party zip into my classpath, but only included the one without dependencies in my lib directory. When I switched to using the jar with dependencies, the app deployed.The following things made this simple problem difficult to resolve:the error logs simply stated that there was a problem with 'grailsApplication' and there was a class not foundthe app ran on my workstation using run-app,the app doesn't run on my workstation using run-war (regardless of whether the correct jars are supplied),lack of sleep!
On to the next issue!

Resources