Apache Camel FTP Download does not delete remote file - ftp

First of all: I am quite new to Apache Camel and to Stack Overflow!
I have created a route which filters and downloads files from an SFTP Server and deletes those after processing.
My problem: On my local computer the route works perfectly. When I deploy this route (the same .war) on the production server, the download works but when the FTP component tries to delete the file I get the exception below. The development and production machine have the same camel, tomcat and java version. The only difference is the OS (Dev: Windows 7, Prod: Windows Server 2008 R2)
Any ideas???
java.lang.IllegalArgumentException: Resolving language: header detected type conflict: Not a Language implementation. Found: org.apache.camel.language.header.HeaderLanguage
at org.apache.camel.impl.DefaultLanguageResolver.resolveLanguage(DefaultLanguageResolver.java:76)
at org.apache.camel.impl.DefaultCamelContext.resolveLanguage(DefaultCamelContext.java:1135)
at org.apache.camel.model.language.ExpressionDefinition.createExpression(ExpressionDefinition.java:177)
at org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:118)
at org.apache.camel.builder.BinaryPredicateSupport.matchesReturningFailureMessage(BinaryPredicateSupport.java:60)
at org.apache.camel.builder.BinaryPredicateSupport.matches(BinaryPredicateSupport.java:50)
at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:90)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:60)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:166)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:401)
at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:99)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:201)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:165)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
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:744)
Here's the route:
String uri = "sftp://" + sftpUserId + "#" + sftpHost + "?" +
"password=" + sftpPassword + "&" +
"recursive=true" + "&" +
"filter=#fileFilter" + "&" +
"binary=true" + "&" +
"delete=true";

This is some other kind of problem. You need to tell more about the production environment. Do you use some special application server for your Camel app or how do you run it?
That error indicates some kind of class loading issue.

This problem is still unsolved. Running in Tomcat in a Windows Server (even as administrator) we did not manage to make this route work. Deploying the route in a Tomcat in Ubuntu Linux it worked right from the start without any modifications!!!

Related

Team City - URL Trigger - Not working

We are using TeamCity Professional 9.1.7, We have setup automated tests in Team City which using Selenium.
In order to invoke the test suite we are leveraging the URL build trigger.
Once the application is deployed on the target server we have an URL which will return the installed version and date time stamp on the server everyday.
When we made an attempt to hit URL manually the version and date time is getting returned. And there is connectivity between TeamCity and deployed server.
We have configured the URL as : abc.XXX/sample.txt and TeamCity is complaining with the following message:
URL build trigger failed with error: URL abc.XXX/sample.txt: null
Hide stacktrace
jetbrains.buildServer.buildTriggers.BuildTriggerException: URL build trigger failed with error: URL https://abc.XXX/sample.txt: null
at jetbrains.buildServer.buildTriggers.url.UrlBuildTrigger$2.makeTriggerException(UrlBuildTrigger.java:117)
at jetbrains.buildServer.buildTriggers.async.impl.AsyncPolledBuildTrigger.processJobResults(AsyncPolledBuildTrigger.java:146)
at jetbrains.buildServer.buildTriggers.async.impl.AsyncPolledBuildTrigger.triggerBuild(AsyncPolledBuildTrigger.java:60)
at jetbrains.buildServer.serverSide.impl.BuildTriggersChecker$4.run(BuildTriggersChecker.java)
at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:89)
at jetbrains.buildServer.serverSide.impl.BuildTriggersChecker.callTrigger(BuildTriggersChecker.java:32)
at jetbrains.buildServer.serverSide.impl.BuildTriggersChecker.access$1100(BuildTriggersChecker.java:65)
at jetbrains.buildServer.serverSide.impl.BuildTriggersChecker$BuildTriggersGroup.processTriggers(BuildTriggersChecker.java:37)
at jetbrains.buildServer.serverSide.impl.BuildTriggersChecker.triggerBuilds(BuildTriggersChecker.java:50)
at jetbrains.buildServer.serverSide.impl.BuildServerRunner$4.doSomething(BuildServerRunner.java)
at jetbrains.buildServer.serverSide.impl.BuildServerRunner$BuildServerWorker.runAction(BuildServerRunner.java:47)
at jetbrains.buildServer.serverSide.impl.BuildServerRunner$BuildServerWorker.run(BuildServerRunner.java:9)
at java.lang.Thread.run(Thread.java:745)
Caused by: jetbrains.buildServer.buildTriggers.async.DetectionException: URL https://abc.XXX/sample.txt: null
at jetbrains.buildServer.buildTriggers.url.UrlBuildTrigger.createThrowableResult(UrlBuildTrigger.java:203)
at jetbrains.buildServer.buildTriggers.url.UrlBuildTrigger.access$700(UrlBuildTrigger.java:39)
at jetbrains.buildServer.buildTriggers.url.UrlBuildTrigger$2$1.perform(UrlBuildTrigger.java:169)
at jetbrains.buildServer.buildTriggers.async.impl.AsyncPolledBuildTrigger$2.run(AsyncPolledBuildTrigger.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
Caused by: jetbrains.buildServer.buildTriggers.url.ResourceHashProviderException: URL https://abc.XXX/sample.txt: null
at jetbrains.buildServer.buildTriggers.url.HttpResourceHashProvider.getResourceHash(HttpResourceHashProvider.java:115)
at jetbrains.buildServer.buildTriggers.url.UrlBuildTrigger$2$1.perform(UrlBuildTrigger.java:149)
... 4 more
Caused by: java.lang.NullPointerException
Please help.
Finally the issue resolved, our URL was having underscore _ in it. There seems to be a constraint/defect with team city that the URL trigger cant have underscore _ in it.
We replaced all _ with - and it worked.

Spring Boot with Tomcat embedded under windows server 2008 R2 doesn't work

Folks, I have a spring-boot app running locally with gradle build tool, with custom: server:
servlet-path: /own/api
port: 8989 without any problem. However it doesn't work in WindowServer 2008-R2, I just get in log:
DispatcherServlet with name dispatcherServlet processing GET request for [/own/api]
Looking up handler method for path [/own/api]
Maybe WindowsServer would require something extra configuration, but not sure, i guess to deploy a spring boot application with tomcat embedded wouldn't have any trouble:
java -jar myfile.jar
Under AdvancedREST client tool I just get:
http://SERVER-API:8989/own/api
{
"timestamp": "2016-07-05T21:13:25.884+0000"
"status": 404
"error": "Not Found"
"message": "/own/api"
"path": "/own/api"
}
As aforementioned, locally it works fine but not in windows server 2008R2. I was wondering if there was a manager in tomcat embedded, just to figure out what basePath would be, because I tried with:
http://SERVER-IP:8989/myfile/own/api //but didn't work either.
Any help I'd really appreciate.
Folks, I found the solution which is adding a slash character to the end of the URL.
http://server:port/own/api/ instead of http://server:port/own/api
I've faced with this issue in the past in other scenarios with Tomcat.

Unable to run write-attribute in jboss EAP 6.3.3 CLI

I am trying to run the below java code in my custom app:
I am using JBoss EAP 6.3.3 with Java 1.8.0_92 have also used Java 7. This used to work in JBoss EAP 6.3.2 (java 7)
ccp = new CLICommandParser(standalone + "/subsystem=security/security-domain=EncryptDBPassword/authentication=classic:write-attribute"
+ "(name=login-modules,value=["
+ "{flag=required,code=org.picketbox.datasource.security.SecureIdentityLoginModule,"
+ "module-options=[(username=" + dbUser + "),(password=" + dbPassword + "),(managedConnectionFactoryName=jboss.jca:name=jdbc/fooDS),(service=XATxCM)]}"
+ "])");
ccp.execute(client, true);
The error I get is, the security domain gets security-domain gets added by fails in next line of code mentioned above.
INFONFO: Command executed sucessfully: /subsystem=security/security-domain=EncryptDBPasswordXA/authentication=classic:add
Exception in thread "main" java.lang.IllegalArgumentException
at org.jboss.dmr.ModelValue.addChild(ModelValue.java:120)
at org.jboss.dmr.ModelNode.add(ModelNode.java:1116)
at org.jboss.dmr.ModelNode.add(ModelNode.java:930)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1417)
at com.foo.org.App$CLICommandParser.getNameOrValue(App.java:1448)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1380)
at com.foo.org.App$CLICommandParser.getNameOrValue(App.java:1460)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1363)
at com.foo.org.App$CLICommandParser.getNameOrValue(App.java:1448)
at com.foo.org.App$CLICommandParser.getListArgs(App.java:1380)
at com.foo.org.App$CLICommandParser.setOPArgs(App.java:1344)
at com.foo.org.App$CLICommandParser.setCommand(App.java:1253)
at com.foo.org.App$CLICommandParser.<init>(App.java:1224)
at com.foo.org.App.addSecurity(App.java:492)
at com.foo.org.App.run(App.java:176)
at com.foo.org.App.main(App.java:54)
I can however run the same command in JBoss CLI and this works. Is there a change I need to do around the code, seems like patch 3 doesn't like to use "write-attribute" in JBoss CLI.
Any pointers will be grateful.

Why do I get "Internal Server Error" with PHPStorm and XAMPP on Localhost as soon as I add more code?

I am working with PHPStorm and XAMPP on Win7. Both works fine, but at some point I start getting "500 Internal Server Error PhpStorm 9.0.2" as soon as I add more code e.g. a new <div></div>. When I delete it again, it works again. The same code works on webhosting but not on localhost.
What could be the issue?
That just makes no sense, why would adding a new div cause an server error?
There are no logs about this issue in the error.log or php_error_log.
Found out that there is a IDE-error log, it says:
2015-11-08 17:49:28,975 [6667034] ERROR - ains.io.fastCgi.FastCgiService - readerIndex(5) + length(1) exceeds writerIndex(5): CompositeByteBuf(ridx: 5, widx: 5, cap: 8189, components=2)
java.lang.IndexOutOfBoundsException: readerIndex(5) + length(1) exceeds writerIndex(5): CompositeByteBuf(ridx: 5, widx: 5, cap: 8189, components=2)
at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1138)
at io.netty.buffer.AbstractByteBuf.readByte(AbstractByteBuf.java:542)
at org.jetbrains.io.fastCgi.FastCgiService.a(FastCgiService.java:197)
at org.jetbrains.io.fastCgi.FastCgiService.responseReceived(FastCgiService.java:170)
at org.jetbrains.io.fastCgi.FastCgiDecoder.contentReceived(FastCgiDecoder.java:128)
at org.jetbrains.io.fastCgi.FastCgiDecoder.contentReceived(FastCgiDecoder.java:15)
at org.jetbrains.io.Decoder.readContent(Decoder.java:68)
at org.jetbrains.io.fastCgi.FastCgiDecoder.messageReceived(FastCgiDecoder.java:75)
at org.jetbrains.io.Decoder.channelRead(Decoder.java:38)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:187)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:947)
at io.netty.channel.oio.AbstractOioByteChannel.doRead(AbstractOioByteChannel.java:147)
at io.netty.channel.oio.AbstractOioChannel$1.run(AbstractOioChannel.java:44)
at io.netty.channel.ThreadPerChannelEventLoop.run(ThreadPerChannelEventLoop.java:52)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:834)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
2015-11-08 17:49:28,975 [6667034] ERROR - ains.io.fastCgi.FastCgiService - PhpStorm 9.0.2 Build #PS-141.2462
2015-11-08 17:49:28,975 [6667034] ERROR - ains.io.fastCgi.FastCgiService - JDK: 1.8.0_51
2015-11-08 17:49:28,976 [6667035] ERROR - ains.io.fastCgi.FastCgiService - VM: Java HotSpot(TM) Server VM
2015-11-08 17:49:28,976 [6667035] ERROR - ains.io.fastCgi.FastCgiService - Vendor: Oracle Corporation
2015-11-08 17:49:28,976 [6667035] ERROR - ains.io.fastCgi.FastCgiService - OS: Windows 7
2015-11-08 17:49:28,976 [6667035] ERROR - ains.io.fastCgi.FastCgiService - Last Action: ShowLog
You are using PhpStorm's own simple built-in web server. For some reason it shows those errors. If you have XAMPP .. then just XAMPP.
For that you need to create an Deployment entry where you will specify your base URL which PhpStorm will use to open files in browser. For that:
Settings | Build, Execution, Deployment | Deployment
Create and configure new deployment entry ("In Place" should be fine)
Do not forget to mark it as Default for this project
Now IDE will use URL specified there instead of built-in web server.
As for actual error:
Please try latest & recently released PhpStorm v10
Try changing your PHP version (in case if you have upgraded it recently)
Submit bug report ticket to JetBrains' Issue Tracker if you wish keep using built-in web server for devs to look into.

wso2 esb deploy failed on windows

I'm using WSO2 ESB 4.8.1 with JDK 1.7.0_67 x64 on windows 7 x64.
I'm deploying carbon application(.car) using any method:
maven car deploy plugin
web admin console
CarbonAppUploader web service
First deployment succeeds but log file contains:
CarbonAppUploader temp file: C:\Java\WSO2ES~1.1\bin\..\tmp\carbonappsuploads\first-esb_1.0.0.car deletion failed, scheduled deletion on server exit.
Second deployment of same car (name and version) fails with exception in logs (see below)
I Apologize for localized error message but generally it says cant overwrite this file.
If you check, it's actually locked for deletion. Looks like CarbonAppUploader class didn't properly close InputStream.
Strangely enough this bug is not reproducible in unix (centos)
Question to WSO2: do you plan to fix that?
Question to all: Did you meet such bug and how did you solve it?
exception stack trace (partially)
TID: [0] [ESB] [2014-08-18 22:04:58,254] ERROR {org.wso2.carbon.application.upload.CarbonAppUploader} - Error occurred while uploading Carbon App artifacts {org.wso2.carbon.application.upload.CarbonAppUploader}
java.io.FileNotFoundException: C:\Java\WSO2ES~1.1\bin\..\tmp\carbonappsuploads\first-esb_1.0.0.car (Запрошенную операцию нельзя выполнить для файла с открытой пользователем сопоставленной секцией)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
at org.wso2.carbon.application.upload.CarbonAppUploader.writeResource(CarbonAppUploader.java:78)
at org.wso2.carbon.application.upload.CarbonAppUploader.uploadApp(CarbonAppUploader.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
I checked out source code from svn, fixed bug myself. If anybody experiencing same issue, you may download sources and compiled jar from https://wso2.org/jira/browse/ESBJAVA-3272
Hopefully this bug fix will be included in next releases

Resources