Closed Nagaraj-Vyoog closed 8 years ago
Ok thanks it is unclear of the exact cause of the problem, at this point I would attempt to try connecting via ssh on production without the usage of the executeCommand method first
or if you can't get that to work then this
See if that is working..
ava.lang.VerifyError: (class: grails/plugin/remotessh/RsshService, method: executeCommand signature: (Lch/ethz/ssh2/Session;Lch/ethz/ssh2/Connection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/StringBuilder;) Expecting to find integer on stack at java.lang.Class.forName(Class.java:278)
That to me doesn't say what exactly is causing the problem unless you have something more meaningful in the entire stack trace.
I would try doing an initial connection just to ensure keys / ssh perms etc are all working as expected
Thanks for your support .your are saying war that ssh plugin working . I another trying for only install plugin and configuration in config.groovy .same above occurs.any way thanks for your mail.if possible for working in sshpass shell cmd in tomcat war file On Apr 11, 2016 9:13 PM, "Vahid Hedayati" notifications@github.com wrote:
Ok thanks it is unclear of the exact cause of the problem, at this point I would attempt to try connecting via ssh on production without the usage of the executeCommand method first https://github.com/vahidhedayati/RemoteSSH/wiki/older-method-grails3
or if you can't get that to work then this https://github.com/vahidhedayati/test-rssh/blob/master/grails-app/controllers/test/rssh/TestController.groovy#L52-L89
See if that is working..
ava.lang.VerifyError: (class: grails/plugin/remotessh/RsshService, method: executeCommand signature: (Lch/ethz/ssh2/Session;Lch/ethz/ssh2/Connection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/StringBuilder;) Expecting to find integer on stack at java.lang.Class.forName(Class.java:278)
That to me doesn't say what exactly is causing the problem unless you have something more meaningful in the entire stack trace.
I would try doing an initial connection just to ensure keys / ssh perms etc are all working as expected
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/vahidhedayati/RemoteSSH/issues/5#issuecomment-208409097
Error in tomcat log file
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener 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.VerifyError: (class: grails/plugin/remotessh/RsshService, method: executeCommand signature: (Lch/ethz/ssh2/Session;Lch/ethz/ssh2/Connection;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/StringBuilder;) Expecting to find integer on stack at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.VerifyError: (class: grails/plugin/remotessh/RsshService, method: executeCommand signature: (Lch/ethz/ssh2/Session;Lch/ethz/ssh2/Connection;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/StringBuilder;) Expecting to find integer on stack at java.lang.Class.forName(Class.java:278) ... 5 more
Can you provide further information I will take a look later tonight .. Are you using password or key connection ?
Can you send me a sample of your Config.groovy stripping off anything sensitive so I get an idea of how you are trying to use the plugin
You say it works in dev but not in production that all depends on all of above keys/password ?
With keys I know when I had it working the .ssh folder had to have access by the running use of tomcat - that was based on keys
I am using password . How to provide ssh access in tomcat7. On Apr 12, 2016 2:09 PM, "Vahid Hedayati" notifications@github.com wrote:
Can you provide further information I will take a look later tonight .. Are you using password or key connection ?
Can you send me a sample of your Config.groovy stripping off anything sensitive so I get an idea of how you are trying to use the plugin
You say it works in dev but not in production that all depends on all of above keys/password ?
With keys I know when I had it working the .ssh folder had to have access by the running use of tomcat - that was based on keys
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/vahidhedayati/RemoteSSH/issues/5#issuecomment-208768771
:) when you run in development mode I presume you are on a Linux machine
so you are
usera> grails run-app
This then triggers
usera>.ssh/id_???
etc so in that user's folder exists the .ssh folder that has relevant access rights / keys etc
When running in production the user that is running tomcat also needs to have the relevant .ssh folders access.
So if tomcat is running as tomcat then try
sudo su - tomcat
then try ssh to what ever host you are trying ensure that is working first of all
thanks for your feedback .i will try On Apr 12, 2016 9:26 PM, "Vahid Hedayati" notifications@github.com wrote:
:) when you run in development mode I presume you are on a Linux machine
so you are
usera> grails run-app
This then triggers
usera>.ssh/id_???
etc so in that user's folder exists the .ssh folder that has relevant access rights / keys etc
When running in production the user that is running tomcat also needs to have the relevant .ssh folders access.
So if tomcat is running as tomcat then try
sudo su - tomcat
then try ssh to what ever host you are trying ensure that is working first of all
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/vahidhedayati/RemoteSSH/issues/5#issuecomment-208978155
no hangon I am trying it in tomcat and it doesn't work same issue you have reported. I think there is an issue with the upgrade of 3.0 to 3.1 - I had a similar issue in another plugin.
Please wait I will probably end up releasing a new version
Thank for your messaging On Apr 12, 2016 10:38 PM, "Vahid Hedayati" notifications@github.com wrote:
no hangon I am trying it in tomcat and it doesn't work same issue you have reported. I think there is an issue with the upgrade of 3.0 to 3.1 - I had a similar issue in another plugin.
Please wait I will probably end up releasing a new version
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/vahidhedayati/RemoteSSH/issues/5#issuecomment-209010591
In short the problem I was seeing was related to a fudged version of tomcat running locally,
The fact that I have a variety of plugins I think something related to chat plugin on that tomcat was causing my issues (I was getting listener socket issues)
Anyhow I am unsure of what the new release will do for you
I have whilst attempting to get it working on my broken tomcat updated various bits and brought it up in line with grails 3.1.4
compile "org.grails.plugins:RemoteSSH:3.0.2"
Please try above
and I can confirm
https://github.com/vahidhedayati/testrssh works in dev mode as well as in\ tomcat I downloaded the latest 8**
I did grails war then dropped the war into tomcat webapps as ROOT.war (nothign else in webapps)
started tomcat and it all worked.
In my test example
https://github.com/vahidhedayati/testrssh/blob/master/grails-app/conf/application.groovy I have configured some ssh values which connects through my key
I would advise using that test site to base your example on since the controllers etc are all in place to work with the taglib service calls
I will try and updated the status of plugin On Apr 12, 2016 11:48 PM, "Vahid Hedayati" notifications@github.com wrote:
In short the problem I was seeing was related to a fudged version of tomcat running locally,
The fact that I have a variety of plugins I think something related to chat plugin on that tomcat was causing my issues (I was getting listener socket issues)
Anyhow I am unsure of what the new release will do for you
I have whilst attempting to get it working on my broken tomcat updated various bits and brought it up in line with grails 3.1.4
compile "org.grails.plugins:RemoteSSH:3.0.2"
Please try above
and I can confirm
https://github.com/vahidhedayati/testrssh works in dev mode as well as in tomcat
I did grails war then dropped the war into tomcat webapps as ROOT.war (nothign else in webapps)
started tomcat and it all worked.
In my test example
https://github.com/vahidhedayati/testrssh/blob/master/grails-app/conf/application.groovy I have configured some ssh values which connects through my key
I would advise using that test site to base your example on since the controllers etc are all in place to work with the taglib service calls
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/vahidhedayati/RemoteSSH/issues/5#issuecomment-209039651
You updated the artifact in RemoteSSH:3.0.2
Sorry unsure what you mean by artifact in RemoteSSH:3.0.2
The only thing that changes was the build.gradle and gradle.properties
There was no actual code changes.
I also noticed that I have left out a plugin from the build.gradle
Please add
compile 'org.grails.plugins:ajax-tags:1.0.0'
To your build.gradle since this was supposed to have been updated but during the upgrade it got missed out. Will include it as part of 3.0.3 sometime soon,
If you can let me know what the issue by the change in artifact I can see if it is a fix required to be included as part of 3.0.3
Thanks for your support .i am finished ssh problem issue in other method.once again thank you very much On Apr 13, 2016 1:30 PM, "Vahid Hedayati" notifications@github.com wrote:
Sorry unsure what you mean by artifact in RemoteSSH:3.0.2
The only thing that changes was the build.gradle and gradle.properties
There was no actual code changes.
I also noticed that I have left out a plugin from the build.gradle
Please add
compile 'org.grails.plugins:ajax-tags:1.0.0'
To your build.gradle since this was supposed to have been updated but during the upgrade it got missed out. Will include it as part of 3.0.3 sometime soon,
If you can let me know what the issue by the change in artifact I can see if it is a fix required to be included as part of 3.0.3
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/vahidhedayati/RemoteSSH/issues/5#issuecomment-209292353
@Nagaraj-Vyoog : Could you please share the solution to fix this issue? I'm also facing the same problem.
i am using *org.grails.plugins:jsch-ssh2:0.2 *plugin for run
ssh command .please try it
I will take a look later tonight and see if I can replicate / fix the issue at hand and update the plugin accordingly.
@Nagaraj-Vyoog : tried with the new plugin, and is working fine. Thanks for the update. @vahidhedayati : it will be very helpful to fix this existing issue in production environment. Waiting for the updates.
@burtbeckwith : Could you please suggest a solutions for this issue? In dev environment RemoteSSH plugin is working fine, but in production deployment is sucess, but while start up it is getting failed as : java.lang.VerifyError: (class: grails/plugin/remotessh/RsshService, method: executeCommand signature: (Lch/ethz/ssh2/Session;Lch/ethz/ssh2/Connection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/StringBuilder;) Expecting to find integer on stack at java.lang.Class.forName(Class.java:278)
I tried with _org.grails.plugins:jsch-ssh2:0.2_ plugin, but reading from single box is working fine. But we have a list of VMs to grep some logs. Do we have a solution for this?
Thanks in advance, Jini
https://bintray.com/vahid/maven/RemoteSSH/3.0.4#files/org/grails/plugins/RemoteSSH for some reason the packaged files are going missing. I think this all relates to the naming convention.
I was unable to install 3.0.4 which was what was last published.
Going to try renaming it all to lower case and asking for approval again. I hope to have it fixed by later I will update what to try
Also wondering if anyone has tried jssh it is a bit more complex but uses websockets for real time communication (just wondering if any issues with that too)
Okay unsure of what the issue was, the actual versions were going missing. I tried to upload and it kept complaining about the pom file and package location.
In the end I have renamed it and removed all the older versions.
I can confirm I have tested the app in tomcat and it does appear to be working:
This is the test site running on grails 3.10: https://github.com/vahidhedayati/testrssh
You will need to update the config here accordingly : https://github.com/vahidhedayati/testrssh/blob/master/grails-app/conf/application.groovy#L1-L3
Once you run grails war, I then used a tomcat-8.0.33 locally removed all contents of webapps and copied the war file as you can see
cp ../testrssh/build/libs/testrssh-0.1.war webapps/ROOT.war
I also copied id_rsa.pub over to authorized_keys (this is a test .ssh key )
~/.ssh# ls -l id_rsa.pub authorized_keys -rw-r--r-- 1 mx1 mx1 393 Aug 9 18:42 authorized_keys -rw-r--r-- 1 mx1 mx1 393 Aug 9 18:41 id_rsa.pub
Now it all works for me in tomcat
Try installing this plugin using this now:
compile "org.grails.plugins:remotessh:3.0.5"
@JayKayMeow Burt doesn't maintain this plugin. He helped tidy up initial release.
You have a list of vms to grep log file
You can use either or any of these plugins including jsch
You just need to write a wrapper
I think https://github.com/vahidhedayati/jssh is better for this
I have used it to do this exact thing for another project. It us actually quite easy use a gsp to iterate through each host name then using jssh taglib make a connection to host and send command
@vahidhedayati : Thank you so much, lemme work on this.. and let u know the updates ASAP
I'm not sure why this jsch-ssh2:0.2 plugin is restricting one VM connection. For the below code, if this is calling one time this is working exactly what I expcted. But calling from a loop causing execption as "Auth Failed"
try{ serverData = new RunSshCommand().execute() { host = server // name of server - String username = AuthenticationConstant.remoteSSH.USER password = AuthenticationConstant.remoteSSH.PASS command = "cat /path/services/log*-0.log |grep "+searchKey strictHostKeyChecking = "yes" } } catch (Exception e) { println "Exception Occurred"+e }
I can't choose other two plugins, as it required ssh_key. We don't have permission to change file permission in production environment.
You can supply username and password with both other plugins
If you load up jssh it has a connection screen and you can with username password Just supply username and password when connecting
Here is this plugin using a taglib (so within a gsp)
https://github.com/vahidhedayati/test-rssh/blob/master/grails-app/views/test/runCommand.gsp
Here is how you use the older method https://github.com/vahidhedayati/RemoteSSH/blob/master/src/main/groovy/grails/plugin/remotessh/RemoteSSH.groovy#L21-L24
You can provide the pass in the config file
Here is how you pass in a password:
https://github.com/vahidhedayati/RemoteSSH/wiki/older-method
RemoteSSH rsh=new RemoteSSH()
rsh.setHost('XX.XX.XX.XX')
rsh.setPort(0)
rsh.setUser('myuser')
rsh.setPass('myPass')
rsh.setUsercommand('whoami')
def g=rsh.Result(sshConfig)
return g
If you have further questions it may be worth raising a new issue on here.
In regards to jssh it is also documented - if you get stuck on that raise an issue on jssh plugin.
I manage this and jssh plugin the jsch plugin is written by someone else and you need to raise issues accordingly on the specific plugins.
@vahidhedayati : thank you. After disconnecting the session it is working fine. We can close this issue also.
@vahidhedayati hi having the same exact issue on prodution. But using plugin for Grails 2.x. Is there a way to fix that? Otherwise I have to trash days of work to integrte the plugin
I will take a look for you when I get a chance today and update this.
This is remote-ssh plugin using the test site https://github.com/vahidhedayati/test-rssh I updated BuildConfig.groovy to include latest version compile ":remote-ssh:0.5"
It is using grails-2.4.4
I unzipped tomcat-8 put the war file into webapps started it and both old test and new methods worked on that demo site.
Maybe it relates to a specific version of grails / tomcat ? Does that test site work for you as a demo under your tomcat ? You will have to update other configuration values for the ssh config in that demo site to see.
@vahidhedayati thank you for your support.
It fails both in production (Tomcat 7) and on fresh tomcat 8 install, unfortunately it works if running on my local machine.
Moreover:
grails.plugin.location.'remote-ssh' = "../RemoteSSH"
compile ":remote-ssh:0.5"
May they be different?
compile ":remote-ssh:0.5"
is what i changed that demo to locally this morning. If you expand the image I have two terminator consoles. In the top one I have opened the BuildConfig.groovy of the test site and updated the plugin to use that latest version.
The reference of grails.plugin.location.'remote-ssh' = "../RemoteSSH"
would have been when I was testing out the plugin before publishing it and sometimes I forget to update the buildConfig.groovy
Right so to clarify
It fails both in production (Tomcat 7) and on fresh tomcat 8 install, unfortunately it works if running on my local machine.
What version of Java ?
what version of grails have you built it against ?
and the error you see in tomcat is: ?
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
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.VerifyError: (class: grails/plugin/remotessh/RsshService, method: executeCommand signature: (Lch/ethz/ssh2/Session;Lch/ethz/ssh2/Connection;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/StringBuilder;) Expecting to find integer on stack
May I bother you on any IM privately? In any case, I have tried all the combination of Java (6,7,8) and Tomcat (7,8). It fails.
I also cloned code and connected locally. Same behaviour...
I have build with 2.3.8 (but I am confident it happens with 2.4), and wht you pointed is the exact error.
Thanks again for supporting me.
https://github.com/vahidhedayati/RemoteSSH/blob/grails2/RemoteSshGrailsPlugin.groovy#L8 am logged into gmail google hangouts. feel free to contact me on there. I finish at 5.30pm in about 2.5 hours and can give you more of my time then (no work in the way) but logged in at the moment and will try to help. Are you using a key to connect or username and password ? you can send it thorugh hangouts if you wish I would like to see your configuration and what you are attempting that causes the issue too
I have done a variety of tests and all is working for me.
First important test as the user running tomcat:
ssh -i /opt/.ssh/id_rsa localhost
That will be the path to the key declared followed by hostname connecting to
Now thinking about it there is another segment I enabled in my overall sshd_config which appears to be as was per testing for the JSSH plugin:
https://github.com/vahidhedayati/jssh/wiki/j2ssh-and-openssh-server-issues
So my sshd_config looks like:
cat /etc/ssh/sshd_config |grep -v "^#"|grep -v -e '^$'
Port 22
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
UsePrivilegeSeparation yes
Ciphers 3des-cbc,blowfish-cbc,cast128-cbc,arcfour,arcfour128,arcfour256,aes128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
KeyRegenerationInterval 3600
ServerKeyBits 1024
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
But in all honesty I removed ssh fully and re-installed it and even with a clean reinstall of ssh, with/without restart of tomcat all seemed to work fine
apt-get remove --purge openssh*
apt-get install openssh-server
I have even exhausted variety of config changes as in just having a user and key and port and also setting port to be a string since it is complaining in the unclear error above about it is expecting integer. (it's not here)
remotessh.USER = "mx1"
remotessh.KEY="/opt/.ssh/id_rsa"
remotessh.PORT='t'
So going back to the actual error
RsshService, method: executeCommand signature: (Lch/ethz/ssh2/Session;Lch/ethz/ssh2/Connection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/StringBuilder;) Expecting to find integer on stack at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
I am going to rewrite how executeCommand
works and release 0.6
and update the demo site. Can you please test 0.6 tomorrow and see if the issue has gone away ? if it fixes the issue I will change grails 3 version of the plugin too.
Really thanks. I can confirm tht fixes solve the issue
Great thanks for the feedback I will roll out 1 more iteration to catch out boolean override and release 0.7 then update grails 3 plugin which is obviously suffering from initial issue reported still now.
Strangely enough I didn't experience problem locally but then that must be what is being set by end users vs my local tests having a difference
i am try to use your ssh plugin its working but war can't deployed.error occured.