I am executing Camel code in Windows using Eclipse and it is working fine.
However, when I execute the same code in standalone from Linux, the route has print first log but when fetching file it stops without any error.
Here is my code:
from("timer://alertstrigtimer?period=90s&repeatCount=1")
.log(LoggingLevel.INFO, "*******************************Job-Alert-System: Started: alertstrigtimer******************************" + getFileURI(getWorkFilePath(), getWorkFileName()))
.pollEnrich(getFileURI(getWorkFilePath(), getWorkFileName()))
.log(LoggingLevel.INFO, "*******************************Job-Alert-System: Started: alertstrigtimer******************************" + getFileURI(getWorkFilePath(), getWorkFileName()))
.choice()
.when(header("CamelFileName").isNull())
.log(LoggingLevel.INFO, "No File")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
log.info("Job-Alert-System: No Date File Exist!!!! Calculate 15 Minutes Back and fetching data from Masterdata");
// Do something
}
})
.otherwise()
.log(LoggingLevel.INFO, "Job Alert System: Date File Loaded: ${header.CamelFileName} at ${header.CamelFileLastModified}")
.process(new Processor() {
// Do something by a processor
})
public static String getFileURI(String filePath, String fileName) {
return "file://" + filePath + "?fileName=" + fileName
+ "&preMove=$simple{file:onlyname.noext}.$simple{date:now:yyyy-MM-dd'T'hh-mm-ss}";
}
Here are my logs from the Linux environment:
[main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.21.1 (CamelContext: camel-1) is starting
[main] INFO org.apache.camel.management.ManagedManagementStrategy - JMX is enabled
[main] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Type converters loaded (core: 194, classpath: 0)
[main] INFO org.apache.camel.impl.DefaultCamelContext - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route1 started and consuming from: timer://alertstrigtimer?period=90s&repeatCount=1
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: loadDataAndAlerts started and consuming from: direct://loadDataAndAlerts
[main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2 routes, of which 2 are started
[main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.21.1 (CamelContext: camel-1) started in 0.664 seconds
[Camel (camel-1) thread #1 - timer://alertstrigtimer] INFO route1 - *******************************Job-Alert-System: Started: alertstrigtimer******************************file:///shared/wildfly/work-files/alerts?fileName=LastExecutionTime_JobAlerts.txt&preMove=.2020-10-12T06-48-16
It stops here. It creates a directory structure, but does not move forward.
Logs from My Local Machine:
[main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.21.1 (CamelContext: camel-1) is starting
[main] INFO org.apache.camel.management.ManagedManagementStrategy - JMX is enabled
[main] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Type converters loaded (core: 194, classpath: 5)
[main] INFO org.apache.camel.impl.DefaultCamelContext - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route1 started and consuming from: timer://alertstrigtimer?period=90s&repeatCount=1
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: loadDataAndAlerts started and consuming from: direct://loadDataAndAlerts
[main] INFO org.apache.camel.impl.DefaultCamelContext - Total 2 routes, of which 2 are started
[main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.21.1 (CamelContext: camel-1) started in 0.845 seconds
[Camel (camel-1) thread #1 - timer://alertstrigtimer] INFO route1 - *******************************Job-Alert-System: Started: alertstrigtimer******************************file://null?fileName=null&preMove=null.2020-10-12T10-28-51
[Camel (camel-1) thread #1 - timer://alertstrigtimer] INFO route1 - Job Alert System: Date File Loaded: null.2020-10-12T10-28-51 at 0
It creates directory structure in addition to a file, but the file is not present and it moves forward.
Related
I'm working on a simple "hello-world" Camel3 (Camel version 3.4.3) REST API example with the following setup:
REST API is described in OpenAPI specification (Swagger v2.0)
The API spec is converted to Java DSL with camel-restdsl-swagger-plugin
Using Camel Main
100% Java (i.e. no XML)
The example below works as expected but I fail to set jetty port. Therefore on every run the web server runs on a random port. How do I set the port (e.g. to 8081) in the Java code ? It also seems to be possible to set the port in application.properties file. Example of that option is also appreciated.
// https://camel.apache.org/components/latest/others/main.html
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.main.Main;
import org.apache.camel.main.RestConfigurationProperties;
import rest.dsl.generated.Api101;
public class App {
public static void main(String[] args) throws Exception {
Main main = new Main();
// How do I set the rest properties ?
// The code below doesn't seem to have effect.
RestConfigurationProperties p = main.configure().rest()
.withComponent("jetty")
.withHost("localhost")
.withPort(8081)
;
main.configure().addConfiguration(p);
// The route generated by camel-restdsl-swagger-plugin
main.configure().addRoutesBuilder(
new Api101()
);
// The actual route.
main.configure().addRoutesBuilder(
new RouteBuilder() {
public void configure() {
from("direct:rest1")
.routeId("Rest1Route")
.log("START:")
.setBody(constant("{hello: \"Hello, World!\"}"))
.log("END:")
;
}
}
);
main.run(args);
}
}
Generated Api101 code:
package rest.dsl.generated;
import javax.annotation.Generated;
import org.apache.camel.builder.RouteBuilder;
/**
* Generated from Swagger specification by Camel REST DSL generator.
*/
#Generated("org.apache.camel.generator.swagger.PathGenerator")
public final class Api101 extends RouteBuilder {
/**
* Defines Apache Camel routes using REST DSL fluent API.
*/
public void configure() {
rest("/api101")
.get("/hello")
.description("Basic Hello World")
.to("direct:rest1");
}
}
Compilation & run example:
/tmp/openapi$ mvn clean compile exec:java
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.stackoverflow:openapi >----------------------
[INFO] Building openapi 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # openapi ---
[INFO] Deleting /tmp/openapi/target
[INFO]
[INFO] --- camel-restdsl-swagger-plugin:3.4.3:generate-with-dto (default) # openapi ---
[INFO] reading from /tmp/openapi/swagger.yaml
[INFO] Generating Camel DSL source in directory: /tmp/openapi/target/generated-sources/restdsl-swagger
[INFO] Generating DTO classes using io.swagger:swagger-codegen-maven-plugin:2.4.12
[INFO] reading from /tmp/openapi/swagger.yaml
[WARNING] Output directory does not exist, or is inaccessible. No file (.swagger-codegen-ignore) will be evaluated.
[WARNING] 'host' not defined in the spec. Default to 'localhost'.
[INFO] writing file /tmp/openapi/target/generated-sources/swagger/src/main/java/io/swagger/client/model/InlineResponse200.java
[WARNING] 'host' not defined in the spec. Default to 'localhost'.
[INFO]
[INFO] --- build-helper-maven-plugin:3.2.0:add-source (default) # openapi ---
[INFO] Source directory: /tmp/openapi/target/generated-sources/restdsl-swagger added.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # openapi ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # openapi ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /tmp/openapi/target/classes
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) # openapi ---
[ App.main()] BaseMainSupport INFO Using properties from: classpath:application.properties;optional=true
[ App.main()] DefaultRoutesCollector INFO No additional Camel XML routes discovered from: classpath:camel/*.xml
[ App.main()] DefaultRoutesCollector INFO No additional Camel XML rests discovered from: classpath:camel-rest/*.xml
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) is starting
[ App.main()] AbstractCamelContext INFO StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
[ App.main()] JettyHttpComponent WARN JMX disabled in CamelContext. Jetty JMX extensions will remain disabled.
[ App.main()] log INFO Logging initialized #8774ms to org.eclipse.jetty.util.log.Slf4jLog
[ App.main()] Server INFO jetty-9.4.29.v20200521; built: 2020-05-21T17:20:40.598Z; git: 77c232aed8a45c818fd27232278d9f95a021095e; jvm 11.0.8+10-post-Ubuntu-0ubuntu120.04
[ App.main()] ContextHandler INFO Started o.e.j.s.ServletContextHandler#4d9f9a55{/,null,AVAILABLE}
[ App.main()] AbstractConnector INFO Started ServerConnector#157aa401{HTTP/1.1, (http/1.1)}{0.0.0.0:44267}
[ App.main()] Server INFO Started #8938ms
[ App.main()] InternalRouteStartupManager INFO Route: route1 started and consuming from: jetty:http://0.0.0.0:0/api101/hello
[ App.main()] InternalRouteStartupManager INFO Route: Rest1Route started and consuming from: direct://rest1
[ App.main()] AbstractCamelContext INFO Total 2 routes, of which 2 are started
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) started in 0.225 seconds
[ qtp1580225589-17] Rest1Route INFO START:
[ qtp1580225589-17] Rest1Route INFO END:
^C[ad #0 - CamelHangupInterceptor] DefaultMainShutdownStrategy INFO Received hang up - stopping the main instance.
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) is shutting down
[ad #0 - CamelHangupInterceptor] DefaultMainShutdownStrategy INFO Waiting for CamelContext to graceful shutdown, elapsed: 0.000 seconds
[ App.main()] DefaultShutdownStrategy INFO Starting to graceful shutdown 2 routes (timeout 45 seconds)
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Route: Rest1Route shutdown complete, was consuming from: direct://rest1
[el-1) thread #1 - ShutdownTask] AbstractConnector INFO Stopped ServerConnector#157aa401{HTTP/1.1, (http/1.1)}{0.0.0.0:0}
[el-1) thread #1 - ShutdownTask] ContextHandler INFO Stopped o.e.j.s.ServletContextHandler#4d9f9a55{/,null,UNAVAILABLE}
[el-1) thread #1 - ShutdownTask] DefaultShutdownStrategy INFO Route: route1 shutdown complete, was consuming from: rest://get:/api101:/hello
[ App.main()] DefaultShutdownStrategy INFO Graceful shutdown of 2 routes completed in 0 seconds
[ App.main()] MainLifecycleStrategy INFO CamelContext: camel-1 has been shutdown, triggering shutdown of the JVM.
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) uptime 44.386 seconds
[ App.main()] AbstractCamelContext INFO Apache Camel 3.4.3 (camel-1) is shutdown in 0.037 seconds
/tmp/openapi$
As you can see from the above the web server is available in port 44267:
Started ServerConnector#157aa401{HTTP/1.1, (http/1.1)}{0.0.0.0:44267}
And can be successfully accessed:
$ sudo netstat -tulpn | grep /java
tcp6 0 0 :::44267 :::* LISTEN 16926/java
$ curl http://0.0.0.0:44267/api101/hello
{hello: "Hello, World!"}
$
I found an answer to my secondary question: this is the way to define the port with the properties:
$ cat src/main/resources/application.properties
camel.rest.port=8081
$
This is also the method how to set all the other configuration options mention in the documentation. Might be obvious for Java veterans, but it was not obvious for me.
I'm using apache camel to make a ftp client for downloading some files to some local directory. The program reads a xml file to get the name of the file that will be fetched from the ftp.The program seems to work except that the files downloaded are corrupted. Right now I'm trying to download some image files but the ones I get are 14.9Kb and corrupted, no error message shown.
This is my code:
main
public void main() throws FileNotFoundException {
BasicConfigurator.configure();
RutaFtp routeBuilder = new RutaFtp();
CamelContext ctx = new DefaultCamelContext();
try {
ctx.addRoutes(routeBuilder);
ctx.start();
Thread.sleep(10000);
ctx.stop();
}
catch (Exception e) {
e.printStackTrace();
}
}
camel route:
from("file:./?fileName=Datos.xml&noop=true")
.split(xpath("//Datos/imagen/text()"))
.setProperty("rutaArchivo", this.body())
.log(LoggingLevel.INFO, "imagen: ${body}")
.process(ExtraerNombre).to("direct:ftp").end();
from("direct:ftp")
.pollEnrich("ftp://"+user+"#"+ftp+"/?password="+password+"&recursive=true&passiveMode=true&fileName=${body}&delete="+borrado+"")
.to("file:C:/outputFolder?flatten=true").end();
}
I've tried using the streamDownload parameter but tha prevents the files to be downloaded (I don't know why)
.pollEnrich("ftp://"+user+"#"+ftp+"/?password="+password+"&recursive=true&passiveMode=true&streamDownload=true&fileName=${body}&delete="+borrado+"")
console log:
INFO | Apache Camel 2.15.1.redhat-621084 (CamelContext: camel-1) is
starting 0 [main] INFO org.apache.camel.impl.DefaultCamelContext -
Apache Camel 2.15.1.redhat-621084 (CamelContext: camel-1) is starting
INFO | JMX is enabled 10 [main] INFO
org.apache.camel.management.ManagedManagementStrategy - JMX is
enabled INFO | Loaded 185 type converters 208 [main] INFO
org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 185
type converters INFO | AllowUseOriginalMessage is enabled. If access
to the original message is not needed, then its recommended to turn
this option off as it may improve performance. 395 [main] INFO
org.apache.camel.impl.DefaultCamelContext - AllowUseOriginalMessage
is enabled. If access to the original message is not needed, then its
recommended to turn this option off as it may improve performance.
INFO | StreamCaching is not in use. If using streams then its
recommended to enable stream caching. See more details at
http://camel.apache.org/stream-caching.html 395 [main] INFO
org.apache.camel.impl.DefaultCamelContext - StreamCaching is not in
use. If using streams then its recommended to enable stream caching.
See more details at http://camel.apache.org/stream-caching.html INFO
| Endpoint is configured with noop=true so forcing endpoint to be
idempotent as well 395 [main] INFO
org.apache.camel.component.file.FileEndpoint - Endpoint is configured
with noop=true so forcing endpoint to be idempotent as well INFO |
Using default memory based idempotent repository with cache max size:
1000 395 [main] INFO org.apache.camel.component.file.FileEndpoint -
Using default memory based idempotent repository with cache max size:
1000 INFO | Route: route1 started and consuming from:
Endpoint[file://./?fileName=Datos.xml&noop=true] 502 [main] INFO
org.apache.camel.impl.DefaultCamelContext - Route: route1 started and
consuming from: Endpoint[file://./?fileName=Datos.xml&noop=true] INFO
| Route: route2 started and consuming from: Endpoint[direct://ftp] 504
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route2
started and consuming from: Endpoint[direct://ftp] INFO | Total 2
routes, of which 2 is started. 504 [main] INFO
org.apache.camel.impl.DefaultCamelContext - Total 2 routes, of which
2 is started. INFO | Apache Camel 2.15.1.redhat-621084 (CamelContext:
camel-1) started in 0.504 seconds 507 [main] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel
2.15.1.redhat-621084 (CamelContext: camel-1) started in 0.504 seconds INFO | Created default XPathFactory
com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl#5434283f 1533
[Camel (camel-1) thread #0 - file://./] INFO
org.apache.camel.builder.xml.XPathBuilder - Created default
XPathFactory
com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl#5434283f INFO
| imagen: ftp://190.0.56.190:8021/pruebasumman/conductor/71708375.jpg
1635 [Camel (camel-1) thread #0 - file://./] INFO route1 - imagen:
ftp://190.0.56.190:8021/pruebasumman/conductor/71708375.jpg INFO |
Apache Camel 2.15.1.redhat-621084 (CamelContext: camel-1) is shutting
down 10521 [main] INFO org.apache.camel.impl.DefaultCamelContext -
Apache Camel 2.15.1.redhat-621084 (CamelContext: camel-1) is shutting
down INFO | Starting to graceful shutdown 2 routes (timeout 300
seconds) 10524 [main] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Starting to graceful
shutdown 2 routes (timeout 300 seconds) INFO | Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 300
seconds. 10524 [Camel (camel-1) thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 300
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 299 seconds. 11525 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 299
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 298 seconds. 12528 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 298
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 297 seconds. 13529 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 297
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 296 seconds. 14540 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 296
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 295 seconds. 15555 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 295
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 294 seconds. 16568 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 294
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 293 seconds. 17569 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 293
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 292 seconds. 18574 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 292
seconds.
Thanks in advance.
Download image file in binary mode
By default, Camel FTP is downloading file by ASCII mode.
Add binary=true into your ftp route will turn from ASCII mode to binary mode
While I was debugging my Camel application I realized, that the graceful shutdown of a route ignores the outstanding tasks that have been triggered by wireTap().
If I have a route definition like this:
from("direct:start")
.wireTap("bean:myWireTapBean")
.to("mock:result");
and I set a debugging breakpoint in myWireTapBean (i.e. suspend the asynchronous processing of wireTap) then a CamelContext.stopRoute(routeId) call produces the following log messages:
11:36:12.352 [Thread-1] INFO o.a.camel.spring.SpringCamelContext - Apache Camel 2.19.1 (CamelContext: camel-1) is shutting down
11:36:12.352 [Thread-1] INFO o.a.c.impl.DefaultShutdownStrategy - Starting to graceful shutdown 1 routes (timeout 300 seconds)
11:36:12.352 [Camel (camel-1) thread #6 - ShutdownTask] INFO o.a.c.impl.DefaultShutdownStrategy - Route: route1 shutdown complete, was consuming from: direct://myRoute
11:36:12.352 [Thread-1] INFO o.a.c.impl.DefaultShutdownStrategy - Graceful shutdown of 1 routes completed in 0 seconds
11:36:12.478 [Thread-1] WARN o.a.c.impl.DefaultInflightRepository - Shutting down while there are still 1 inflight exchanges.
11:36:12.478 [Thread-1] INFO o.a.camel.spring.SpringCamelContext - Apache Camel 2.19.1 (CamelContext: camel-1) uptime 1.411 seconds
11:36:12.478 [Thread-1] INFO o.a.camel.spring.SpringCamelContext - Apache Camel 2.19.1 (CamelContext: camel-1) is shutdown in 0.126 seconds
Is there any way to prevent Camel from shutting down while there are still inflight exchanges in the DefaultInflightRepository that have been created by wireTap?
I've already read the FAQ: How can I stop a route from a route but this doesn't seem to be an answer to this question.
Yeah the current implementation of WireTap does not take in account of active tasks if they are not being routed.
I logged a ticket to add support for deferring shutdown of the WireTap EIP if it has inflight tasks: https://issues.apache.org/jira/browse/CAMEL-11539
The workaround is to create a route such as direct and then call that route where you can then call the bean, then when you shutdown Camel the direct route will have inflight exchanges and therefore wait for it to complete.
The DefaultShutdownStrategy's default behavior is to complete route shutdowns, so it is one of those things where the default works for many scenarios, but not all and you are in the latter. If the exchange is run within a transaction, it would rollback, you might look at sourcing from a JMS queue or other so you can rollback and resume processing.
The Javadocs have good information on the behavior and various options you can use to configure the DefaultShutdownStrategy before considering writing a custom one:
DefaultShutdownStrategy
We try to import our data into SolrCloud using MapReduce batch indexing. We face a problem at the reduce phase, that solr.xml cannot be found. We create a 'twitter' collection but looking at the logs, after it failed to load in solr.xml, it uses the default one and tries to create 'collection1' (failed) and 'core1' (success) SolrCore. I'm not sure if we need to create our own solr.xml and where to put it (we try to put it at several places but it seems not to load in). Below is the log:
2022 [main] INFO org.apache.solr.hadoop.HeartBeater - Heart beat reporting class is org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
2025 [main] INFO org.apache.solr.hadoop.SolrRecordWriter - Using this unpacked directory as solr home: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip
2025 [main] INFO org.apache.solr.hadoop.SolrRecordWriter - Creating embedded Solr server with solrHomeDir: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip, fs: DFS[DFSClient[clientName=DFSClient_NONMAPREDUCE_-1828461666_1, ugi=nguyen (auth:SIMPLE)]], outputShardDir: hdfs://master.hadoop:8020/user/nguyen/twitter/outdir/reducers/_temporary/_attempt_201311191613_0320_r_000014_0/part-r-00014
2029 [Thread-64] INFO org.apache.solr.hadoop.HeartBeater - HeartBeat thread running
2030 [Thread-64] INFO org.apache.solr.hadoop.HeartBeater - Issuing heart beat for 1 threads
2083 [main] INFO org.apache.solr.core.SolrResourceLoader - new SolrResourceLoader for directory: '/data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/'
2259 [main] INFO org.apache.solr.hadoop.SolrRecordWriter - Constructed instance information solr.home /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip (/data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip), instance dir /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/, conf dir /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/conf/, writing index to solr.data.dir hdfs://master.hadoop:8020/user/nguyen/twitter/outdir/reducers/_temporary/_attempt_201311191613_0320_r_000014_0/part-r-00014/data, with permdir hdfs://master.hadoop:8020/user/nguyen/twitter/outdir/reducers/_temporary/_attempt_201311191613_0320_r_000014_0/part-r-00014
2266 [main] INFO org.apache.solr.core.ConfigSolr - Loading container configuration from /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/solr.xml
2267 [main] INFO org.apache.solr.core.ConfigSolr - /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/solr.xml does not exist, using default configuration
2505 [main] INFO org.apache.solr.core.CoreContainer - New CoreContainer 696103669
2505 [main] INFO org.apache.solr.core.CoreContainer - Loading cores into CoreContainer [instanceDir=/data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/]
2515 [main] INFO org.apache.solr.handler.component.HttpShardHandlerFactory - Setting socketTimeout to: 0
2515 [main] INFO org.apache.solr.handler.component.HttpShardHandlerFactory - Setting urlScheme to: http://
2515 [main] INFO org.apache.solr.handler.component.HttpShardHandlerFactory - Setting connTimeout to: 0
2515 [main] INFO org.apache.solr.handler.component.HttpShardHandlerFactory - Setting maxConnectionsPerHost to: 20
2516 [main] INFO org.apache.solr.handler.component.HttpShardHandlerFactory - Setting corePoolSize to: 0
2516 [main] INFO org.apache.solr.handler.component.HttpShardHandlerFactory - Setting maximumPoolSize to: 2147483647
2516 [main] INFO org.apache.solr.handler.component.HttpShardHandlerFactory - Setting maxThreadIdleTime to: 5
2516 [main] INFO org.apache.solr.handler.component.HttpShardHandlerFactory - Setting sizeOfQueue to: -1
2516 [main] INFO org.apache.solr.handler.component.HttpShardHandlerFactory - Setting fairnessPolicy to: false
2527 [main] INFO org.apache.solr.client.solrj.impl.HttpClientUtil - Creating new http client, config:maxConnectionsPerHost=20&maxConnections=10000&socketTimeout=0&connTimeout=0&retry=false
2648 [main] INFO org.apache.solr.logging.LogWatcher - Registering Log Listener [Log4j (org.slf4j.impl.Log4jLoggerFactory)]
2676 [coreLoadExecutor-3-thread-1] INFO org.apache.solr.core.CoreContainer - Creating SolrCore 'collection1' using instanceDir: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/collection1
2677 [coreLoadExecutor-3-thread-1] INFO org.apache.solr.core.SolrResourceLoader - new SolrResourceLoader for directory: '/data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/collection1/'
2691 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer - Failed to load file /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/collection1/solrconfig.xml
2693 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer - Unable to create core: collection1
org.apache.solr.common.SolrException: Could not load config for solrconfig.xml
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:596)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:661)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:368)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:360)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
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:724)
Caused by: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or '/data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/collection1/conf/', cwd=/data/05/mapred/local/taskTracker/nguyen/jobcache/job_201311191613_0320/attempt_201311191613_0320_r_000014_0/work
at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:322)
at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:287)
at org.apache.solr.core.Config.<init>(Config.java:116)
at org.apache.solr.core.Config.<init>(Config.java:86)
at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:120)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:593)
... 11 more
2695 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer - null:org.apache.solr.common.SolrException: Unable to create core: collection1
at org.apache.solr.core.CoreContainer.recordAndThrow(CoreContainer.java:1158)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:670)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:368)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:360)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
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:724)
Caused by: org.apache.solr.common.SolrException: Could not load config for solrconfig.xml
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:596)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:661)
... 10 more
Caused by: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or '/data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/collection1/conf/', cwd=/data/05/mapred/local/taskTracker/nguyen/jobcache/job_201311191613_0320/attempt_201311191613_0320_r_000014_0/work
at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:322)
at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:287)
at org.apache.solr.core.Config.<init>(Config.java:116)
at org.apache.solr.core.Config.<init>(Config.java:86)
at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:120)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:593)
... 11 more
2697 [main] INFO org.apache.solr.core.CoreContainer - Creating SolrCore 'core1' using instanceDir: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip
2697 [main] INFO org.apache.solr.core.SolrResourceLoader - new SolrResourceLoader for directory: '/data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/'
2751 [main] INFO org.apache.solr.core.SolrConfig - Adding specified lib dirs to ClassLoader
2752 [main] WARN org.apache.solr.core.SolrResourceLoader - Can't find (or read) directory to add to classloader: ../../../contrib/extraction/lib (resolved as: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/../../../contrib/extraction/lib).
2752 [main] WARN org.apache.solr.core.SolrResourceLoader - Can't find (or read) directory to add to classloader: ../../../dist/ (resolved as: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/../../../dist).
2752 [main] WARN org.apache.solr.core.SolrResourceLoader - Can't find (or read) directory to add to classloader: ../../../contrib/clustering/lib/ (resolved as: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/../../../contrib/clustering/lib).
2753 [main] WARN org.apache.solr.core.SolrResourceLoader - Can't find (or read) directory to add to classloader: ../../../dist/ (resolved as: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/../../../dist).
2753 [main] WARN org.apache.solr.core.SolrResourceLoader - Can't find (or read) directory to add to classloader: ../../../contrib/langid/lib/ (resolved as: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/../../../contrib/langid/lib).
2753 [main] WARN org.apache.solr.core.SolrResourceLoader - Can't find (or read) directory to add to classloader: ../../../dist/ (resolved as: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/../../../dist).
2753 [main] WARN org.apache.solr.core.SolrResourceLoader - Can't find (or read) directory to add to classloader: ../../../contrib/velocity/lib (resolved as: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/../../../contrib/velocity/lib).
2753 [main] WARN org.apache.solr.core.SolrResourceLoader - Can't find (or read) directory to add to classloader: ../../../dist/ (resolved as: /data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/../../../dist).
2785 [main] INFO org.apache.solr.update.SolrIndexConfig - IndexWriter infoStream solr logging is enabled
2790 [main] INFO org.apache.solr.core.SolrConfig - Using Lucene MatchVersion: LUCENE_44
2869 [main] INFO org.apache.solr.core.Config - Loaded SolrConfig: solrconfig.xml
2879 [main] INFO org.apache.solr.schema.IndexSchema - Reading Solr Schema from schema.xml
2937 [main] INFO org.apache.solr.schema.IndexSchema - [core1] Schema name=twitter
3352 [main] INFO org.apache.solr.schema.IndexSchema - unique key field: id
3471 [main] INFO org.apache.solr.schema.FileExchangeRateProvider - Reloading exchange rates from file currency.xml
3478 [main] INFO org.apache.solr.schema.FileExchangeRateProvider - Reloading exchange rates from file currency.xml
3635 [main] INFO org.apache.solr.core.HdfsDirectoryFactory - Solr Kerberos Authentication disabled
3636 [main] INFO org.apache.solr.core.JmxMonitoredMap - No JMX servers found, not exposing Solr information with JMX.
3652 [main] INFO org.apache.solr.core.HdfsDirectoryFactory - creating directory factory for path hdfs://master.hadoop:8020/user/nguyen/twitter/outdir/reducers/_temporary/_attempt_201311191613_0320_r_000014_0/part-r-00014/data
3686 [main] INFO org.apache.solr.core.CachingDirectoryFactory - return new directory for hdfs://master.hadoop:8020/user/nguyen/twitter/outdir/reducers/_temporary/_attempt_201311191613_0320_r_000014_0/part-r-00014/data
3711 [main] WARN org.apache.solr.core.SolrCore - [core1] Solr index directory 'hdfs:/master.hadoop:8020/user/nguyen/twitter/outdir/reducers/_temporary/_attempt_201311191613_0320_r_000014_0/part-r-00014/data/index' doesn't exist. Creating new index...
3719 [main] INFO org.apache.solr.core.HdfsDirectoryFactory - creating directory factory for path hdfs://master.hadoop:8020/user/nguyen/twitter/outdir/reducers/_temporary/_attempt_201311191613_0320_r_000014_0/part-r-00014/data/index
3719 [main] INFO org.apache.solr.core.HdfsDirectoryFactory - Number of slabs of block cache [1] with direct memory allocation set to [true]
3720 [main] INFO org.apache.solr.core.HdfsDirectoryFactory - Block cache target memory usage, slab size of [134217728] will allocate [1] slabs and use ~[134217728] bytes
3721 [main] INFO org.apache.solr.store.blockcache.BufferStore - Initializing the 1024 buffers with [8192] buffers.
3740 [main] INFO org.apache.solr.store.blockcache.BufferStore - Initializing the 8192 buffers with [8192] buffers.
3891 [main] INFO org.apache.solr.core.CachingDirectoryFactory - return new directory for hdfs://master.hadoop:8020/user/nguyen/twitter/outdir/reducers/_temporary/_attempt_201311191613_0320_r_000014_0/part-r-00014/data/index
3988 [main] INFO org.apache.solr.update.LoggingInfoStream - [IFD][main]: init: current segments file is "null"; deletionPolicy=org.apache.solr.core.IndexDeletionPolicyWrapper#65b01d5d
3992 [main] INFO org.apache.solr.update.LoggingInfoStream - [IFD][main]: now checkpoint "" [0 segments ; isCommit = false]
3992 [main] INFO org.apache.solr.update.LoggingInfoStream - [IFD][main]: 0 msec to checkpoint
3992 [main] INFO org.apache.solr.update.LoggingInfoStream - [IW][main]: init: create=true
3992 [main] INFO org.apache.solr.update.LoggingInfoStream - [IW][main]:
dir=NRTCachingDirectory(org.apache.solr.store.hdfs.HdfsDirectory#17e5a6d8 lockFactory=org.apache.solr.store.hdfs.HdfsLockFactory#7f117668; maxCacheMB=192.0 maxMergeSizeMB=16.0)
solr looks for solr.home parameter and searchs solrConfig.xml file there. if there is none it tries to load default configuration.
it looks like your solr home is
/data/06/mapred/local/taskTracker/distcache/3866561797898787678_-1754062477_512745567/master.hadoop/tmp/9501daf9-5011-4665-bae3-d5af1c8bcd62.solr.zip/collection1/
check that folder for solrconfig.xml file
if there is none, copy one from example directory of solr
if there is one, match the file/folder permissions with the server instance
I'm using apache camel 2.12.1 to create a route and then move some files in my local directory, the exmple runs fine but the files are never moved, this is the code for the class.
public class MoveFilesTest {
private static final Log LOG = LogFactory.getLog(MoveFilesTest.class);
public static void main(String args[]) throws Exception {
LOG.debug("create CamelContext");
CamelContext context = new DefaultCamelContext();
// add our route to the CamelContext
context.addRoutes(new RouteBuilder() {
File file = null;
public void configure() {
from("file:data/inbox?delay=100&noop=true")
.process( new Processor() {
public void process(Exchange msg) throws Exception {
File file = msg.getIn().getBody(File.class);
LOG.debug("Processing file: " + file.getName());
}
})
.to("file:data/outbox").end();
}
});
LOG.debug("start the route and let it do its work");
context.start();
context.stop();
}
}
as a note, this code just to work, now i'm working on mac os x 10.7, this is the debug log. i added the noop=false and the delete=true, but the result is the same. thank you
DEBUG [main] (MoveFilesTest.java:24) - create CamelContext
DEBUG [main] (MoveFilesTest.java:45) - start the route and let it do its work
INFO [main] (DefaultCamelContext.java:1498) - Apache Camel 2.12.1 (CamelContext: camel-1) is starting
INFO [main] (ManagedManagementStrategy.java:187) - JMX is enabled
INFO [main] (DefaultTypeConverter.java:50) - Loaded 176 type converters
INFO [main] (DefaultCamelContext.java:1689) - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
INFO [main] (FileEndpoint.java:83) - Endpoint is configured with noop=true so forcing endpoint to be idempotent as well
INFO [main] (FileEndpoint.java:89) - Using default memory based idempotent repository with cache max size: 1000
INFO [main] (DefaultCamelContext.java:2183) - Route: route1 started and consuming from: Endpoint[file://data/inbox?delay=100&noop=true]
INFO [main] (DefaultCamelContext.java:1533) - Total 1 routes, of which 1 is started.
INFO [main] (DefaultCamelContext.java:1534) - Apache Camel 2.12.1 (CamelContext: camel-1) started in 8.936 seconds
INFO [main] (DefaultCamelContext.java:1706) - Apache Camel 2.12.1 (CamelContext: camel-1) is shutting down
INFO [main] (DefaultShutdownStrategy.java:172) - Starting to graceful shutdown 1 routes (timeout 300 seconds)
INFO [Camel (camel-1) thread #2 - ShutdownTask] (DefaultShutdownStrategy.java:600) - Route: route1 shutdown complete, was consuming from: Endpoint[file://data/inbox?delay=100&noop=true]
INFO [main] (DefaultShutdownStrategy.java:217) - Graceful shutdown of 1 routes completed in 0 seconds
INFO [main] (DefaultCamelContext.java:1780) - Apache Camel 2.12.1 (CamelContext: camel-1) uptime 8.953 seconds
INFO [main] (DefaultCamelContext.java:1781) - Apache Camel 2.12.1 (CamelContext: camel-1) is shutdown in 0.013 seconds
Yes, you start Camel and stop it immediately. So, when you put a file to a folder. It wont process cuz camel is already stopped.
Camel contains Main implementation to keep Camel running in standalone application.
There is link: http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html
CamelContext.start does not block, so basically you are starting the context and then immediately stopping it. You need to wait or block on something until the context should stop. You can reference this thread for some ways of doing this.
I had a similar problem but that was to do with streamCaching() not getting set properly and so the code below was failing
context.getStreamCachingStrategy().setSpoolDirectory(spoolDirectory);
from(uri.toString()).streamCaching().to(destination);
I set the Streaming directly on CamelContext and that solved the problem
CamelContext context = getContext();
context.setStreamCaching(true);
context.getStreamCachingStrategy().setSpoolDirectory(localSpoolDirectory);
context.getStreamCachingStrategy().setSpoolThreshold(Long.parseLong(spoolThreshold.trim()));
context.getStreamCachingStrategy().setBufferSize(Integer.parseInt(bufferSize.trim()));