fpravica / grep4j

Automatically exported from code.google.com/p/grep4j
0 stars 0 forks source link

com.jcraft.jsch.JSchException: Auth fail #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I am trying to use the grep4j to login to remote server and grep for a keyword.

Below is the code snippet . 
String host = "121.10.11.18";
                System.out.println("In  buildEngineRestartcount 2 ..................."+host);
                Profile remoteProfile = ProfileBuilder.newBuilder()
                                .name("Remote server log") 
                                .filePath("/logs/server/server.log")     
                                .onRemotehost(host)       
                                .credentials("id", "pswd") 
                                .build();
                System.out.println("In  buildEngineRestartcount 3 ..................."+remoteProfile);
                GrepExpression exp = new GrepExpression("TaskAccepted", false);

                Option ops = new Option(null, "", "");
               // GrepResults results = grep(exp, remoteProfile, ops);
            GrepResults results = grep(constantExpression("TaskAccepted"), on(remoteProfile));
                System.out.println("Grep results : " + results);
                System.out.println("Total lines found : " + results.totalLines());
                System.out.println("Total Execution Time : " + results.getExecutionTime());

What is the expected output? What do you see instead?
Getting these errors 

RROR   2014-11-17 16:49:00,825 [pool-10-thread-1] 
org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler  - 
Unexpected error occurred in scheduled task.
java.lang.RuntimeException: Error when executing the GrepTask
        at org.grep4j.core.executors.GrepExecutor.execute(GrepExecutor.java:59)
        at org.grep4j.core.executors.GrepExecutor.execute(GrepExecutor.java:27)
        at org.grep4j.core.Grep4j.execute(Grep4j.java:239)
        at org.grep4j.core.Grep4j.grep(Grep4j.java:145)
        at org.grep4j.core.Grep4j.grep(Grep4j.java:213)
        at com.wellsfargo.BO.GridScheduler.buildEngineRestartcount(GridScheduler.java:144)
        at com.wellsfargo.BO.GridScheduler$$FastClassBySpringCGLIB$$fcd0d09b.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:640)
        at com.wellsfargo.BO.GridScheduler$$EnhancerBySpringCGLIB$$3f43cfea.buildEngineRestartcount(<generated>)
        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.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
        at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: 
Error when executing the CommandExecutorTasks
        at java.util.concurrent.FutureTask.report(Unknown Source)
        at java.util.concurrent.FutureTask.get(Unknown Source)
        at org.grep4j.core.executors.GrepExecutor.execute(GrepExecutor.java:54)
        ... 23 more
Caused by: java.lang.RuntimeException: Error when executing the 
CommandExecutorTasks
        at org.grep4j.core.executors.GrepTaskExecutor.execute(GrepTaskExecutor.java:51)
        at org.grep4j.core.executors.GrepTaskExecutor.execute(GrepTaskExecutor.java:25)
        at org.grep4j.core.task.GrepTask.call(GrepTask.java:51)
        at org.grep4j.core.task.GrepTask.call(GrepTask.java:31)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        ... 3 more
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: 
ERROR: Unrecoverable error when performing remote command ERROR: Unrecoverable 
error when trying to connect to serverDetails :  
ServerDetails(host=wppra00a0177.wellsfargo.com, user=u334635, 
password=Smaran$3, port=22, privateKeyLocation=null, isPasswordRequired=true)
        at java.util.concurrent.FutureTask.report(Unknown Source)
        at java.util.concurrent.FutureTask.get(Unknown Source)
        at org.grep4j.core.executors.GrepTaskExecutor.execute(GrepTaskExecutor.java:48)
        ... 7 more
Caused by: java.lang.RuntimeException: ERROR: Unrecoverable error when 
performing remote command ERROR: Unrecoverable error when trying to connect to 
serverDetails :  ServerDetails(host=wppra00a0177.wellsfargo.com, user=u334635, 
password=Smaran$3, port=22, privateKeyLocation=null, isPasswordRequired=true)
        at org.grep4j.core.command.linux.JschCommandExecutor.execute(JschCommandExecutor.java:46)
        at org.grep4j.core.task.CommandExecutorTask.call(CommandExecutorTask.java:35)
        at org.grep4j.core.task.CommandExecutorTask.call(CommandExecutorTask.java:19)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        ... 4 more
Caused by: java.lang.RuntimeException: ERROR: Unrecoverable error when trying 
to connect to serverDetails :  ServerDetails(host=wppra00a0177.wellsfargo.com, 
user=u334635, password=Smaran$3, port=22, privateKeyLocation=null, 
isPasswordRequired=true)
        at org.grep4j.core.command.linux.SessionFactory.makeObject(SessionFactory.java:39)
        at org.grep4j.core.command.linux.SessionFactory.makeObject(SessionFactory.java:15)
        at org.apache.commons.pool.impl.StackKeyedObjectPool.borrowObject(StackKeyedObjectPool.java:165)
        at org.grep4j.core.command.linux.JschCommandExecutor.execute(JschCommandExecutor.java:37)
        ... 8 more
Caused by: com.jcraft.jsch.JSchException: Auth fail
        at com.jcraft.jsch.Session.connect(Session.java:491)
        at com.jcraft.jsch.Session.connect(Session.java:162)
        at org.grep4j.core.command.linux.SessionFactory.makeObject(SessionFactory.java:37)
        ... 11 more

What version of the product are you using? On what operating system?
I have this code running from eclipse windows.

Please provide any additional information below.

I have used the dependcies jar supplied. 
It will be great,if you can help me with this.

Original issue reported on code.google.com by shalini....@gmail.com on 18 Nov 2014 at 3:38