ANT SSHEXEC task Issues using keyfile - ant

I am having issues with an SSHEXEC ant task.
I am trying to connect to a remote host and execute a command.
I am trying to use "keyfile" so I do not need to use user/pass and hitting an issue.
I can get it to connect, but getting prompted for:
[sshexec] Connecting to $HOST:22
[sshexec] Kerberos username [$Local_USER]:
[sshexec] Kerberos password for $Local_USER:
Now if I just hit return at each prompt, it proceeds and executes the command.
I am using this method for automation, so defeats the purpose if you need to interact.
Here is the ANT syntax:
<target name="explode" depends="deploy" description="Creating build on Deployment Server">
<sshexec host="${host}"
username="${user}"
keyfile="c:\paul\testkey"
trust="true"
command="${bin}/createBuild.sh"/>
</target>
Ant version - 1.8.3
Jsch version - jsch-0.1.42 (also tried with jsch-0.1.29)
Can anyone help or advise if I am doing something wrong?
Thanks in advance.
Paul

The issue here lies within Java 7.
In JAVA 7 they have introduced Kerberos into the java.security and in such this has caused the issue to prompt for kerberos user / password before proceeding.
I have fixed this issue by downgrading to Java 1.6.
I am still researching the fix for the 1.7 version of Java - may require further configuration of the kerberos conf file for java.

You can downgrade to Java 1.6 as Cambolie suggested or you can just add -noinput to fix this problem.
For example:
ant -noinput [some_target]

This issue has now been addressed in the latest versions of Ant (1.9.1) and Jsch (0.1.50).
There was a bug report with Apache which shows it having been fixed as of Jan-2013.

This is probably a misconfiguration on the remote side. It certainly shouldn't ask for the user name. Talk to your sysadmin about this. I'm also worried about Kerberos because that's completely unrelated to SSH.
Also make sure the public key is installed in the user's account.

Related

grails 3.0.1 proxy settings

I am new to Grails 3.0.1 and wonder how and where to set the correct Proxy settings. I know what my proxy configuration is - IP and port, but don't know where to place.
I am getting errors like these when trying to run grails command within my helloworld project:
ivo#ivotrisquel:~/grails/projects/helloworld$ grails --stacktrace
| Error Problem updating profiles from origin git repository (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.eclipse.jgit.api.errors.TransportException: https://github.com/grails/grails-profile-repository: cannot open git-upload-pack
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
at org.grails.cli.profile.git.GitProfileRepository.fetchAndRebaseIfExpired(GitProfileRepository.groovy:140)
at org.grails.cli.profile.git.GitProfileRepository.createOrUpdateRepository(GitProfileRepository.groovy:109)
at org.grails.cli.profile.git.GitProfileRepository.getProfile(GitProfileRepository.groovy:56)
at org.grails.cli.GrailsCli.initializeProfile(GrailsCli.groovy:347)
at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:192)
at org.grails.cli.GrailsCli.main(GrailsCli.groovy:99)
Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/grails/grails-profile-repository: cannot open git-upload-pack
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:524)
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:309)
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1115)
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
... 6 more
Caused by: java.net.ConnectException: Connection timed out github.com
at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:175)
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:475)
... 11 more
| Error Problem updating profiles from origin git repository
I had the same problem and solved it adding the proxy configuration to the GRAILS_HOME/bin/grails.bat file in the following way:
>set GRAILS_OPTS=%GRAILS_OPTS% -Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort -Dhttp.proxyUser=bob -Dhttp.proxyPassword=theBuilder
I believe there must be another way to configure the proxy in Grails 3.0.x but I haven't found it so far.
Regards
In linux adding the configuration
export GRAILS_OPTS="-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort"
in the GRAILS_HOME/bin/grails.sh file. Resolve my problem in Netbeans 8.1
I adedd the following to my ~/.grails/ProxySettings.groovy file.
client=['http.proxyHost':'myproxy', 'http.proxyPort':'myport', 'http.proxyUser':'myusername', 'http.proxyPassword':'mypass', 'http.nonProxyHosts':'localhost']
currentProxy='client'
For GRAILS3 there is now enough documentation on how to setup proxy.
As said by #campos, in Windows you must
set GRAILS_OPTS=-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort
but that makes correction only for half the way, because you also have to correct gradle engine, inserting in its gradle.properties values as below
systemProp.http.proxyHost=proxy.yourdomain.com
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=yourpass
systemProp.http.nonProxyHosts=localhost
There is complete explanation here and here for gradle. With all that on my Windows10 I can correctly compile and build packages behind my corporate proxy.
After long struggle I found the solution for windows environment
The following worked for me
set GRAILS_OPTS=-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=myPort -Dhttps.proxyHost=myProxy -Dhttps.proxyPort=myPort -Dhttp.proxyUser=bob -Dhttp.proxyPassword=theBuilder

OfBiz Installation Failure

Apache OfBiz is not installing correctly, and fails to compile in the command prompt.
After creating the system variable JAVA_HOME to C:\Program Files\Java\jdk1.8.0_40, and editing "Path" to be C:\Program Files (x86)\Java\jre7\bin;C:\apache-ant-1.9.4\bin, I downloaded OfBiz 13.07.01 to my C:\ folder and unzipped it there. In the command prompt, I typed the following:
C:\Users\CalS>cd C:\apache-ofbiz-13.07.01
C:\apache-ofbiz-13.07.01>ant load-seed
Then, after about 50 seconds, I get this:
BUILD FAILED
C:\apache-ofbiz-13.07.01\build.xml:229: the following error occurred while executing this line:
C:\apache-ofbiz-13.07.01\build.xml:248: the following error occurred while executing this line:
C:\apache-ofbiz-13.07.01\build.xml:39: the following error occurred while executing this line:
C:\apache-ofbiz-13.07.01\build.xml:91: compile failed; see the compiler error output for details.
Please note it has been years since I dealt with DOS, so I do not know how to access the error output.
This is after I get a few dozen errors like:
[javac16] class file for org.ofbiz.widget.ContentWorkerInterfaice not found
and
[javac16] warning: [options] bootstrap class path not set in conjunctions with -source 1.6
Under 'classes'.
Misc. I have tried 'ant run-install' and 'load-demo' commands without avail. I've followed step-by-step tutorials, but very likely missed something. Please let me know what I can do to fix this and run this program successfully. Thanks!
Please have a look at the following Apache Jira Tickets for OFBiz where your problem is addressed and was fixed, so that OFBiz could be build with java 1.8.
The build errors occur due to missing fileset entries in the build.xml for some applications (party, workeffort, product, order, ebay, and pos), see: OFBIZ-5835
A fix is available in related ticket: OFBIZ-6079
There was another bug in the current release branches (checked 14.12.01, 12.04.06, 13.07.02) that I fixed last week. The fix is already committed to the branches.
See: OFBIZ-6252
You have to compile/run with the same Java version.
Seems you have some inconsistencies: JAVA_HOME ist 1.8, Path is set to jre 7 and the warning states it is using an 1.6 compiler.
With the 13.07. Release, using Java 1.7 or 1.8 is recommended and supported.
Alright, so it looks like Apache OFBiz and Java JDK 1.8.XX don't get along. I found help on another forum that confirmed the discrepancy in compatibility between OFBiz 13.07.01/Apache ant 1.9.4 and JDK 1.8.XX. This will cause the compiling of the Apache Ant to fail (which seems to run off of JDK 1.6).
I remedied the problem by downloading the archived JDK 1.7.0_67 from Oracle, re-mapping the System Variables accordingly, and re-initializing the Command Prompt.
It works now! Thank you all for your contributions.
Though solved, let me add something important. JDK version is not always an issue in such errors. Ofbiz v13.X.X works well on JDK 1.7 and above. The error shown is a peculiar issue with Ofbiz v13.07.01 dist.
As Martin pointed out, one need to add widget jars in the classpath of order, party, product & workeffort. Add the below line
<fileset dir="../../framework/widget/build/lib" includes="*.jar"/>
in build.xml of order, party, product & workeffort under applications directory.

Ant version wrongly picked with weblogic 10.3.6.0

I have installed Weblogic 10.3.6.0 and using apache-ant-1.8.1 for build. ANT_HOME, JAVA_HOME are set
When I ran diagnostics I get this part
-------------------------------------------
ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant version 1.7.1 compiled on June 27 2008
ant.java.version: 1.6
ant.core.lib: C:\BEA11\modules\org.apache.ant_1.7.1\lib\ant.jar
ant.home: C:\apps\apache-ant-1.8.1
Ant home is 1.8 but the core lib is referring older version. Is there any way to override this issue?
Thanks!
EDIT
after adding ant\bin location to PATH, I get different problem.
taskdef class weblogic.ant.taskdefs.management.WLDeploy cannot be found using the classloader AntClassLoader[]
Solution : mentioned the weblogic server path properly.
I'll bet the older version is bundled with WebLogic.
See if you can find it to confirm.
I'd argue that the WebLogic version ought to be sufficient. What functionality is it missing that you can't do without?
http://docs.oracle.com/cd/E14571_01/web.1111/e13750/anttasks.htm

Ant telnet is hanging on a simple task

<?xml version="1.0" ?>
<project name="test" default="root">
<target name="telnet">
<telnet server="10.1.1.1">
<read>login:</read>
<write>root</write>
<read>password:</read>
<write>${PASSWORD}</write>
<read>#</read>
<write>ls</write>
<read>#</read>
</telnet>
</target>
</project>
That is the code I have in a build.xml file. When I run ant (version 1.8, in bash) (I have downloaded and copied over the jars for commons-net-2.0 and jakarta-oro-2.0.8 already), this is the output I get:
Buildfile: /home/sagar/build.xml
telnet:
and then it just sits there. When I do a "who" on my server, I can see "System" waiting on login. But there is no progress after this. I can telnet into the server using normal telnet means (putty, bash, etc).
I even tried the full telnet command instead of read/write:
<telnet server="10.1.1.1" userid="root" password="root">
Any help is much appreciated!
Note: JRE 1.5, Ant 1.8, commons-net version 2.0, jakarta version 2.0.8
Figured it out. For anyone else who has this issue:
Ant 1.8.0 does not seem to work with commons-net-telnet. Not sure why, but if you can go down to version 1.7, it will work.
6 hours of head banging and frustration later, it is an undocumented version issue. Great! >:
Not an expert in Ant (I use Nant on the Dark Side) but looking at the telnet task it looks like there is an attribute called initialCR which sends a carriage return after login - the default value appears to be 'no'.
My thinking is that the username/password has not been submitted, i.e. its just waiting for the "pseudo enter key" to be pressed.
http://ant.apache.org/manual/Tasks/telnet.html
Hope this helps

Why is Nant not working with TeamCity?

I have nant set up to build my ASP.NET MVC project and it works fine locally. I add nant to a tools folder and add it to version control. TeamCity picks up my changes and starts the build but it fails.
I believe I'm using the latest version of Nant and I have added the .net framework 3.5 to the nant.exe.config. What am I missing on the server and yes the .net framework is installed on the server as the asp.net mvc app does work if I manually build and deploy there?
The build file is as follows:
<target name="compile" description="Compiles using the AutomatedDebug Configuration">
<msbuild project="Tolt.Sims.sln" />
</target>
Here is the error:
BUILD FAILED Failed to initialize the 'Microsoft .NET Framework 2.0' (net-2.0) target framework.
Property evaluation failed. Expression: ${path::combine(sdkInstallRoot, 'bin')} ^^^^^^^^^^^^^^ Property 'sdkInstallRoot' has not been set.
For more information regarding the cause of the build failure, run the build again in debug mode. Try 'nant -help' for more information
If you're using the beta version of NAnt (which currently is the only way you'll get support for targeting anything greater than the 2.0 framework), you maybe running into a registry problem. A similar problem was reported by Tim Barcz.
Things pretty much boiled down to NAntContrib (provider of msbuild task) pointing to the 2.0 version of msbuild. Check out his solution to see if it applies to your scenario.
Potentially, you dont have the .NET Framework 2.0 SDK installed.
You can install it from
http://www.microsoft.com/downloads/details.aspx?familyid=fe6f2099-b7b4-4f47-a244-c96d69c35dec&displaylang=en
I fixed this by adding the following in the registry:
New string value at: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework
Named: sdkInstallRootv2.0
With the value: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\
Seemed to spring into life...
w://
This was fixed after the 0.86 beta1 release. On April 1, 2010, 0.90 was released with the fix in case upgrading nant is an option for you. To provide further detail, the fix release in 0.90 appears to have been simple changes to the nant.exe.config file. The bolded text below was added and will likely fix the problem without having to install the 2.0 SDK.
<directory name="${path::combine(sdkInstallRoot, 'bin')}" if="${property::exists('sdkInstallRoot')}" />
Update the net-2.0 section to fix it.
See http://www.mail-archive.com/nant-developers#lists.sourceforge.net/msg07519.html; it's a known bug in 0.86 beta1.
I've run into similar issues with NAnt. I know this isn't the Best solution, but it is one that works if you need to get your project moving.
I've found that installing a development environment (C# Express didn't work for me, but VS 2008 did) on the server makes this issue go away. (Yes, I realize this goes against normal best practices, but it works and lets my scripts run so I can get back to coding.)
Just figured I'd share incase anyone else is in a similar situation..(this has worked for me both with CruiseControl.Net and with Hudson).

Resources