SonarQube/ANT Authentication required for 'svn+ssh:// - java

Using fresh installed SonarQube 5.6, my ANT scanner complains svn: E170001: Authentication required for 'svn+ssh://my-server' while getting author (blame) data.
"C:\Program Files\Java\jdk1.8.0_51\bin\java" ... build.sonar.xml
[...shortened]
java.lang.IllegalStateException: Error when executing blame for file /path/to/foo.java
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
[...shortened]
Caused by: java.lang.IllegalStateException: Error when executing blame for file /path/to/foo.java
at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:102)
[...shortened]
Caused by: org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001: Authentication required for 'svn+ssh://my-server'
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:47)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:41)
at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:203)
SonarQube-5.6 installation seems fine, I installed Java/JSON plugins as admin before first scan.
My code is obviously hosted at svn+ssh://my-server/path/to/root. There, svnadmin --version says Version 1.5.7 (r36142)
IP of my-server is in C:\Windows\System32\drivers\etc\hosts (I
contact the server through a tunnel and my-server has no DNS entry)
putty session named my-server connects successfully.
svn up works fine via TortoiseSVN v1.9.4 UI and command line and Intellij IDEA.
I have cached my SVN credentials. No pwd prompt when svn up
I use
win10 x64
JDK jdk1.8.0_51 (running ANT/build/sonarqube-ant-task-2.4.1.jar)
JRE version "1.8.0_91" (running SonarQube)
I had cleared my C:\Users\johndoe\AppData\Roaming\Subversion and rentered the pwd.
Any ideas how to get tmatesoft's SVNKit to use my cached authentication data? Thanks a lot!

Passing -Dsvnkit.ssh2.key=path/to/private/key pointing to an OpenSSH formatted private key file helped. I pass it as jvm arg to my ANT that runs the build.xml containing the <sonar> target.
By playing with SVNKit 1.8.12 standalone, logging enabled, I found the complaint about the private key file format.
Now, my scanner runs sucessfully for the first time.
Notably, not passing the correct property value now does not break the scan any more, just a small complaint about missing blame data. But I won't investgate that.

Related

Confluence configuration Spring Application context has not been set

I tried to install confluence on my own ubuntu server, but always failed. The error is:
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.IllegalStateException: Spring Application context has not been set
at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:149)
caused by: java.lang.IllegalStateException: Spring Application context has not been set
at com.atlassian.spring.container.SpringContainerContext.getComponent(SpringContainerContext.java:48)
I saw some solutions in the jira confluence forum saying try to fix the permission of installed directory and home directory. I tried but failed again. How can I fix the problem.
In my case the issue was corrupted confluence.cfg.xml file (contains DB connection stings and other settings). The file size was 0 bytes.
I would suggest to use a VM to create a new installation and borrow confluence.cfg.xml from that installation.
It's embarrassing that this behavior has been allowed to exist for nearly 7 years in a commercial product. This is a basic stuff...
I wish that was on instructions somewhere:
Make single backup copy of confluence.cfg.xml immediately before any writes to it by the application. Application should be able to restore from backed up copy if it gets corrupted.
Atlassian documentation lists the following causes of this problem:
The user running Confluence does not have write permissions to the home folder defined in <install>/confluence/WEB-INF/classes/confluence-init.properties or the install directory.
You are running Confluence as the root user or if you have an application firewall enabled (SeLinux or AppArmor).
The database driver is not located in the <install>/confluence/WEB-INF/lib folder or you are using a database version that is incompatible with the bundled driver.
The hostname of the server can not be resolved.
In my case I was running it as root user inside docker container.

Problems with GlassFish using IntelliJ, deploy is not available

I've started using GlassFish 4.1.1 with IntelliJ and tried created a new J2EE project. The only thing I modified was the output message written out by the facelet.
Now deploying and thus connecting to the server doesn't seem to work.
The message:
Detected server admin port: 4848
Detected server http port: 8080
[2016-04-18 10:30:58,648] Artifact FirstEE:war exploded: Server is not connected. Deploy is not available.
java.nio.file.AccessDeniedException: C:\Program Files\Java\glassfish4\glassfish\domains\domain1\logs\server.log.lck
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:115)
at java.nio.channels.FileChannel.open(FileChannel.java:287)
at java.nio.channels.FileChannel.open(FileChannel.java:335)
at java.util.logging.FileHandler.openFiles(FileHandler.java:459)
at java.util.logging.FileHandler.<init>(FileHandler.java:326)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:99)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:192)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:228)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:124)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:322)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:366)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:300)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56)
Attempting to start domain1.... Please look at the server log for more details.....
"C:\Program Files\Java\glassfish4\glassfish\bin\asadmin.bat" stop-domain --domaindir "C:\Program Files\Java\glassfish4\glassfish\
What I tried out:
Checking for any process listening to port 4848, there's none
deleted the standard domain domain1 and tried to create a new one, failed because the command asadmin is unknown.
added "asadmin" file from glassfish's directory to the PATH variable, still unknown.
Reinstalling GlassFish
GlassFish's and IntelliJ's version are are up to date
Has anyone an idea?
Problem was pretty trivial... Just had to run my IDE as an administrator because elseway IntelliJ had no access to the server log file and thus couldn't make neccessary changes in it.
Be sure to check out the other solutions I named in my questions though...
Have you tried to start IntelliJ with sudo permission?

gradle process command java finished with non-zero exit value 1

I am getting the following error when I type gradle bootRun --stacktrace --debug in the CentOS 7 terminal to use gradle to launch this sample spring boot app.
Caused by: org.gradle.process.internal.ExecException:
Process 'command '/opt/jdk1.8.0_45/bin/java'' finished with
non-zero exit value 1
I have googled this error and read other SO postings that are similar but not duplicates. For example, this is in eclipse in CentOS 7 and a web app. This is not an android app, etc. Also, commands given in other postings have not resolved this problem.
All of the code required to reproduce this problem is in the github link above, and all of the logs to diagnose the problem is in this OP below. How do I resolve this error so that I gradle bootRun can succussfully launch the sample app?
STEP BY STEP REPRODUCTION OF THE PROBLEM:
I downloaded the app as-is by navigating to /home/user/workspaces/ and typing git clone https://github.com/jrodenbostel/beyond-the-examples
I then navigated to cd /home/user/workspaces/beyond-the-examples/part-5 and typed gradle bootRun --stacktrace --debug, which resulted in the stack trace and logs that you can read by clicking on this link to a file sharing site. (The logs are too long to include in this OP.)
This was my original error message:
Changing my %JAVA_HOME% in Window's Environmental Variables from Java 9 (file directory C:\Program Files\Java\jdk-9.0.1) to Java 8 (C:\Program Files\Java\jdk1.8.0_151) was what fixed it for me. You can figure out what path you set %JAVA_HOME% to by typing echo %JAVA_HOME% in Command Prompt.
So yea, as of 12-20-2017, gradle bootRun doesn't play well with Java 9. Hopefully that will be fixed soon and I can delete this answer.
Looking at the logs this appears to be your problem:
nested exception is org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [inser t into users (username, password, enabled) values (?,?,?)]; Data truncation:
Data too long for column 'password' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'password' at row 1.
Anyway you can truncate the password size? Otherwise increasing the 'password' column size should do the trick.
In My case, I was getting this error when I was trying to launch my spring boot application. The reason for the error was the port 8080 (default port for running my app in my case) was already being used by another application (mySql) on my machine.
I killed that other application and retried to launch my app, and it worked!
Just wanted to add my experience with this error. I used the Grails Application Forge and included the full package in the name when generating my Grails 5.1.2 application. When I ran it, I got the "...java'' finished with
non-zero exit value 1" error. I went back and generated the application with only the application name, removing the package, and it worked. Also, this was only a problem on Windows 10 in a command prompt. Both versions of my application worked in a Cygwin command prompt.

Jenkins windows ssh slave access denied

I want to build my projects on a Windows machine, so I created a slave there. First we tried the standard java application runner, but our build sets up its own environment and it always ended up deleting the existing Java installation, not giving any proper error messages, but failing. Then I switched to using Cygwin sshd and have Jenkins log in via ssh. This works for the connection (just as the standard method worked), but when I ran the build then it failed again to install the jdk. I ended up running the following command by hand:
C:\jenkins\tools\hudson.model.JDK\Latest\jdk.exe ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\jenkins\tools\hudson.model.JDK\Latest /L
This is the same as Jenkins would run, but without the /s (silent) option. Now when I run the build, I get the following error:
Building remotely on jenkins-slave-win64 (Johnny5) (windows) in workspace C:\jenkins\workspace\continuous.xill
java.io.IOException: remote file operation failed: C:\jenkins\tools\hudson.model.JDK\Latest at hudson.remoting.Channel#200354fa:jenkins-slave-win64 (Johnny5): java.nio.file.AccessDeniedException: C:\jenkins\tools\hudson.model.JDK\Latest\bin\java.exe
at hudson.FilePath.act(FilePath.java:987)
at hudson.FilePath.act(FilePath.java:969)
at hudson.FilePath.deleteRecursive(FilePath.java:1171)
at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:130)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
at hudson.model.JDK.forNode(JDK.java:132)
at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:360)
at hudson.model.Run.getEnvironment(Run.java:2234)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:935)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1036)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1277)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: java.nio.file.AccessDeniedException: C:\jenkins\tools\hudson.model.JDK\Latest\bin\java.exe
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1126)
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:497)
at hudson.Util.deleteFile(Util.java:247)
Of course I tried everything:
Run sshd as a different (Administrator) user
Checked every error mentioned here:
https://wiki.jenkins-ci.org/display/JENKINS/SSH+slaves+and+Cygwin
here
https://wiki.jenkins-ci.org/display/JENKINS/My+software+builds+on+my+computer+but+not+on+Jenkins
and here
http://www.noah.org/ssh/cygwin-sshd.html
And nothing works. Do you have a hint where to look?
UPDATE:
Meanwhile I managed to get a bit further in the build process by deactivating the option to "Automatically install jdk" in the Jenkins settings, git clone works and gradle starts up. However, now the JAVA_HOME environment variable somehow is not accessible to the slave (although we even tried setting it in .bashrc, just to be sure). So the build fails with this message":
FAILURE: Build failed with an exception.
* Where:
Script 'http://dl.bintray.com/content/shemnon/javafx-gradle/8.1.1/javafx.plugin' line: 60
* What went wrong:
A problem occurred evaluating script.
> Could not find JavaFX Packager Tools, please set one of [jfxrtDir in Gradle Properties, JFXRT_HOME in System Environment, JAVA_HOME in System Environment, java.home in JVM properties]
For your build error after "UPDATE" I think you have to add a JDK under Manage Jenkins > Configure System > JDK or in newer versions under Manage Jenkins > Global Tool Configuration > JDK

Error when push Liberty for Java application in IBM Bluemix

when I run sample IBM Bluemix Liberty for Java application https://github.com/ibmjstart/bluemix-java-postgresql-uploader.git following error:
-----> Downloaded app package (1.9M)
-----> Downloaded app buildpack cache (4.0K)
OK
/var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:101:in build_pack': Unable to detect a supported application type (RuntimeError) from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:74:inblock in compile_with_timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:68:in timeout' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:73:incompile_with_timeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:54:in block in stage_application' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:inchdir'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:in stage_application' from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in'
FAILED
Server error, status code: 400, error code: 170001, message: Staging error: cannot get instances since staging failed
TIP: use 'cf logs jpu-henryhan --recent' for more information
The top error looks like you left off the -p <path_to_war> parameter when doing a push. If you just push a directory containing a WAR file, it will not be detected by the Java buildpack.
The tip provided in the output of your cf push request is relevant.
TIP: use 'cf logs jpu-henryhan --recent' for more information
Running that command will tail the log files produced during the staging process and let you see what error may have been raised. Often, it can be a missing dependency or a transient failure of some sort.
I just successfully deployed the sample using the "deploy to Bluemix" button and manually via the cf command line tool. Unless you changed the code, it is most likely that this error is a transient failure.
Run following command:
$ cf push jpu- -b https://github.com/cloudfoundry/java-buildpack --no-manifest --no-start -p PostgreSQLUpload.war
add the parameter to set the buildpack "-b https://github.com/cloudfoundry/java-buildpack"

Categories