title: Deploying WebApplication as a WAR file on Weblogic using SFTP Adapter
body: <p>I have configured SFTP Adapter configurations in Spring Aplication file and i have one JAR which is including in that war file &amp; i have rsa file on resource location of that Jar file but when i try to deploy it on Weblogic 10.3.6.0 it does not find rsa file and gives the following error: </p>
  
  <p>POM.XML:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.abc.tsi&lt;/groupId&gt;
      &lt;artifactId&gt;tsi-ibs2bank&lt;/artifactId&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;version&gt;1.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;Project&lt;/name&gt;
  
      &lt;modules&gt;
          &lt;module&gt;tsi-a-core&lt;/module&gt;
          &lt;module&gt;tsi-b-services&lt;/module&gt;
      &lt;/modules&gt;
  
      &lt;build&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.1&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;source&gt;1.6&lt;/source&gt;
                          &lt;target&gt;1.6&lt;/target&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
          &lt;extensions&gt;
              &lt;extension&gt;
                  &lt;groupId&gt;org.apache.maven.wagon&lt;/groupId&gt;
                  &lt;artifactId&gt;wagon-webdav-jackrabbit&lt;/artifactId&gt;
                  &lt;version&gt;1.0-beta-7&lt;/version&gt;
              &lt;/extension&gt;
          &lt;/extensions&gt;
      &lt;/build&gt;    
      &lt;properties&gt;
          &lt;cxf.version&gt;3.0.1&lt;/cxf.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Stacktrace:</p>
  
  <pre><code> synchronizing remote to local directory
          at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:209)
          at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.receive(AbstractInboundFileSynchronizingMessageSource.java:167)
          at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:144)
          at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:192)
          at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:55)
          at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:149)
          at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:146)
          at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:298)
          at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)
          at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:51)
          at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:59)
          at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:314)
          at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
          at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:82)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:440)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:139)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
          at java.lang.Thread.run(Thread.java:662)
  Caused by: org.springframework.messaging.MessagingException: Failed to obtain pooled item
          at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:177)
          at org.springframework.integration.file.remote.session.CachingSessionFactory.getSession(CachingSessionFactory.java:118)
          at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:310)
          at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.synchronizeToLocalDirectory(AbstractInboundFileSynchronizer.java:167)
          at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.receive(AbstractInboundFileSynchronizingMessageSource.java:168)
          ... 20 more
  Caused by: java.lang.IllegalStateException: failed to create SFTP Session
          at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:354)
          at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:76)
          at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:73)
          at org.springframework.integration.util.SimplePool.doGetItem(SimplePool.java:187)
          at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:167)
          ... 24 more
  Caused by: java.io.FileNotFoundException: ServletContext resource [/classpath*:WEB-INF/id_rsa] cannot be resolved to absolute file path - web application archive not expanded?
          at org.springframework.web.util.WebUtils.getRealPath(WebUtils.java:237)
          at org.springframework.web.context.support.ServletContextResource.getFile(ServletContextResource.java:176)
          at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.initJschSession(DefaultSftpSessionFactory.java:370)
  </code></pre>
  
  <p>Application.xml</p>
  
  <pre><code>    &lt;bean id="defaultSftpSessionFactory"
      class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory"&gt;
      &lt;property name="host" value="${sftp.host}" /&gt;
      &lt;property name="user" value="${sftp.username}" /&gt;
  &lt;!--&lt;property name="password" value="${sftp.password}"/&gt; --&gt;
      &lt;property name="port" value="${sftp.serverPort}" /&gt;
  
      &lt;property name="privateKey" value="${sftp.private.keyfile}" /&gt;
      &lt;property name="privateKeyPassphrase" value="${sftp.passphrase}" /&gt;
  
      &lt;/bean&gt;
  
  &lt;bean id="sftpSessionFactory"
      class="org.springframework.integration.file.remote.session.CachingSessionFactory"&gt;
      &lt;constructor-arg ref="defaultSftpSessionFactory" /&gt;
  
  &lt;/bean&gt;
  </code></pre>